Chromium Code Reviews| Index: chrome/browser/extensions/api/extension_action/extension_action_api.cc |
| diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc |
| index 488e852afc0dd84d7abcddc6411398c4576ff659..3af22b4584932b9ee0032a6225e9cfb12b209af6 100644 |
| --- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc |
| +++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc |
| @@ -32,6 +32,8 @@ |
| #include "ui/gfx/image/image.h" |
| #include "ui/gfx/image/image_skia.h" |
| +#include "chrome/browser/ui/browser_finder.h" |
| + |
| using content::WebContents; |
| namespace page_actions_keys = extension_page_actions_api_constants; |
| @@ -209,6 +211,7 @@ ExtensionActionAPI::ExtensionActionAPI(Profile* profile) { |
| registry->RegisterFunction<BrowserActionGetPopupFunction>(); |
| registry->RegisterFunction<BrowserActionEnableFunction>(); |
| registry->RegisterFunction<BrowserActionDisableFunction>(); |
| + registry->RegisterFunction<BrowserActionOpenPopupFunction>(); |
| // Page Actions |
| registry->RegisterFunction<EnablePageActionsFunction>(); |
| @@ -805,6 +808,19 @@ bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
| return true; |
| } |
| +bool BrowserActionOpenPopupFunction::RunImpl() { |
| + Browser* browser = |
| + chrome::FindOrCreateTabbedBrowser(profile_, chrome::GetActiveDesktop()); |
|
mark a. foltz
2013/10/07 22:08:14
Need to decide which window gets the popup.
- W
justinlin
2013/10/09 18:19:32
Yes, we should use the last active.
|
| + std::pair<const std::string, void* /*gfx::NativeWindow*/> details = |
| + std::make_pair(extension_id(), browser/*browser->window()->GetNativeWindow()*/); |
| + content::NotificationService::current()->Notify( |
|
mark a. foltz
2013/10/07 22:08:14
It looks like only the Mac UI handles this notific
justinlin
2013/10/09 18:19:32
Using an observer notification instead now.
|
| + chrome::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC, |
| + content::Source<Profile>(profile_), |
| + content::Details< |
| + std::pair<const std::string, void* /*gfx::NativeWindow*/> >(&details)); |
| + return true; |
| +} |
| + |
| // |
| // ScriptBadgeGetAttentionFunction |
| // |