1
2
3
4
5
6
|
class
ManagementShowButtonFunction :
public
ManagementFunction {
public
:
DECLARE_EXTENSION_FUNCTION(
"management.showButton"
, MANAGEMENT_UNINSTALL)
private
:
virtual
bool
RunImpl() OVERRIDE;
};
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
bool
ManagementShowButtonFunction::RunImpl() {
std::string extension_id;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id));
bool
enable;
EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &enable));
const
Extension* extension = service()->GetExtensionById(extension_id,
true
);
if
(!extension) {
error_ = ErrorUtils::FormatErrorMessage(
keys::kNoExtensionError, extension_id);
return
false
;
}
service()->extension_prefs()->SetBrowserActionVisibility(extension, enable);
return
true
;
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{
"name" : "showButton",
"description" : "Show/Hide extension icon on extension bar.",
"parameters" : [
{
"name" : "id",
"type" : "string",
"description" : "This should be the id from an item of $ref:ExtensionInfo."
},
{
"name" : "enabled",
"type" : "boolean",
"description" : "Whether this item should be enabled or disabled."
}
]
}
|