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

Unified Diff: chrome/browser/extensions/extension_page_actions_module.cc

Issue 545068: Allow extensions to add, remove, or change their page action popup. (Closed)
Patch Set: Rebase, to run trybots with test data in place. Created 10 years, 11 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/extension_page_actions_module.cc
diff --git a/chrome/browser/extensions/extension_page_actions_module.cc b/chrome/browser/extensions/extension_page_actions_module.cc
index ace93174c21d3146f3a193ef30993595959670ce..1379b2f370085cc1022c46d8b1913ac92679c64d 100644
--- a/chrome/browser/extensions/extension_page_actions_module.cc
+++ b/chrome/browser/extensions/extension_page_actions_module.cc
@@ -192,6 +192,29 @@ bool PageActionSetTitleFunction::RunImpl() {
return true;
}
+bool PageActionSetPopupFunction::RunImpl() {
+ EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
+ const DictionaryValue* args = args_as_dictionary();
+
+ int tab_id;
+ EXTENSION_FUNCTION_VALIDATE(args->GetInteger(L"tabId", &tab_id));
+ if (!InitCommon(tab_id))
+ return false;
+
+ // TODO(skerner): Consider allowing null and undefined to mean the popup
+ // should be removed.
+ std::string popup_string;
+ EXTENSION_FUNCTION_VALIDATE(args->GetString(L"popup", &popup_string));
+
+ GURL popup_url;
+ if (!popup_string.empty())
+ popup_url = GetExtension()->GetResourceURL(popup_string);
+
+ page_action_->SetPopupUrl(tab_id, popup_url);
+ contents_->PageActionStateChanged();
+ return true;
+}
+
// Not currently exposed to extensions. To re-enable, add mapping in
// extension_function_dispatcher.
bool PageActionSetBadgeBackgroundColorFunction::RunImpl() {
« no previous file with comments | « chrome/browser/extensions/extension_page_actions_module.h ('k') | chrome/browser/extensions/page_action_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698