Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1364)

Unified Diff: chrome/browser/extensions/api/developer_private/developer_private_api.cc

Issue 2074263002: [Experimental] Fool around with exposing extension bindings via blink Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/developer_private/developer_private_api.cc
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index 2f1847f4350e972aa39d580d66148181b6c9b085..f375710cf5726172d1360877895f1b9aaa75ccf9 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -607,51 +607,54 @@ DeveloperPrivateUpdateProfileConfigurationFunction::Run() {
}
DeveloperPrivateUpdateExtensionConfigurationFunction::
-~DeveloperPrivateUpdateExtensionConfigurationFunction() {}
+ DeveloperPrivateUpdateExtensionConfigurationFunction(
+ const mojo::Callback<void()>& callback)
+ : MojoExtensionFunction(callback) {}
-ExtensionFunction::ResponseAction
-DeveloperPrivateUpdateExtensionConfigurationFunction::Run() {
- std::unique_ptr<developer::UpdateExtensionConfiguration::Params> params(
- developer::UpdateExtensionConfiguration::Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params);
-
- const developer::ExtensionConfigurationUpdate& update = params->update;
-
- const Extension* extension = GetExtensionById(update.extension_id);
+DeveloperPrivateUpdateExtensionConfigurationFunction::
+ ~DeveloperPrivateUpdateExtensionConfigurationFunction() {}
+
+MojoExtensionFunctionBase::RunResult
+DeveloperPrivateUpdateExtensionConfigurationFunction::Run(
+ mojom::UpdateExtensionConfigurationParamsPtr update) {
+ const Extension* extension = ExtensionRegistry::Get(browser_context())
+ ->enabled_extensions()
+ .GetByID(update->extension_id);
if (!extension)
- return RespondNow(Error(kNoSuchExtensionError));
+ return Error(kNoSuchExtensionError);
if (!user_gesture())
- return RespondNow(Error(kRequiresUserGestureError));
+ return Error(kRequiresUserGestureError);
- if (update.file_access) {
+ if (update->has_file_access) {
std::string error;
if (!UserCanModifyExtensionConfiguration(extension,
browser_context(),
&error)) {
- return RespondNow(Error(error));
+ return Error(error);
}
- util::SetAllowFileAccess(
- extension->id(), browser_context(), *update.file_access);
+ util::SetAllowFileAccess(extension->id(), browser_context(),
+ update->file_access);
}
- if (update.incognito_access) {
- util::SetIsIncognitoEnabled(
- extension->id(), browser_context(), *update.incognito_access);
+ if (update->has_incognito_access) {
+ util::SetIsIncognitoEnabled(extension->id(), browser_context(),
+ update->incognito_access);
}
- if (update.error_collection) {
- ErrorConsole::Get(browser_context())->SetReportingAllForExtension(
- extension->id(), *update.error_collection);
+ if (update->has_error_collection) {
+ ErrorConsole::Get(browser_context())
+ ->SetReportingAllForExtension(extension->id(),
+ update->error_collection);
}
- if (update.run_on_all_urls) {
- util::SetAllowedScriptingOnAllUrls(
- extension->id(), browser_context(), *update.run_on_all_urls);
+ if (update->has_run_on_all_urls) {
+ util::SetAllowedScriptingOnAllUrls(extension->id(), browser_context(),
+ update->run_on_all_urls);
}
- if (update.show_action_button) {
- ExtensionActionAPI::Get(browser_context())->SetBrowserActionVisibility(
- extension->id(),
- *update.show_action_button);
+ if (update->has_show_action_button) {
+ ExtensionActionAPI::Get(browser_context())
+ ->SetBrowserActionVisibility(extension->id(),
+ update->show_action_button);
}
- return RespondNow(NoArguments());
+ return Respond();
}
DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {}

Powered by Google App Engine
This is Rietveld 408576698