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

Unified Diff: extensions/browser/api/runtime/runtime_api.cc

Issue 936123002: [Extensions] Implement chrome.runtime.openOptionsPage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: default impl Created 5 years, 10 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
« no previous file with comments | « extensions/browser/api/runtime/runtime_api.h ('k') | extensions/browser/api/runtime/runtime_api_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/runtime/runtime_api.cc
diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc
index 51e8ec9bcf771dfcd5fe4e89eeaa52edff2d2108..6f0716a24898d75fd40acbcb7f1140512047f5d0 100644
--- a/extensions/browser/api/runtime/runtime_api.cc
+++ b/extensions/browser/api/runtime/runtime_api.cc
@@ -46,6 +46,7 @@ namespace {
const char kNoBackgroundPageError[] = "You do not have a background page.";
const char kPageLoadError[] = "Background page failed to load.";
+const char kFailedToCreateOptionsPage[] = "Could not create an options page.";
const char kInstallId[] = "id";
const char kInstallReason[] = "reason";
const char kInstallReasonChromeUpdate[] = "chrome_update";
@@ -268,6 +269,10 @@ bool RuntimeAPI::RestartDevice(std::string* error_message) {
return delegate_->RestartDevice(error_message);
}
+bool RuntimeAPI::OpenOptionsPage(const Extension* extension) {
+ return delegate_->OpenOptionsPage(extension);
+}
+
///////////////////////////////////////////////////////////////////////////////
// static
@@ -425,6 +430,13 @@ void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) {
}
}
+ExtensionFunction::ResponseAction RuntimeOpenOptionsPageFunction::Run() {
+ RuntimeAPI* api = RuntimeAPI::GetFactoryInstance()->Get(browser_context());
+ return RespondNow(api->OpenOptionsPage(extension())
+ ? NoArguments()
+ : Error(kFailedToCreateOptionsPage));
+}
+
ExtensionFunction::ResponseAction RuntimeSetUninstallURLFunction::Run() {
std::string url_string;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url_string));
« no previous file with comments | « extensions/browser/api/runtime/runtime_api.h ('k') | extensions/browser/api/runtime/runtime_api_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698