diff options
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.cc | 43 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.h | 6 |
2 files changed, 45 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 70347ff..ef410d1 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -35,6 +35,10 @@ #include "chrome/browser/gtk/gtk_theme_provider.h" #endif +#if defined(OS_MACOSX) +#include "chrome/browser/cocoa/extension_installed_bubble_bridge.h" +#endif + namespace { static std::wstring GetInstallWarning(Extension* extension) { @@ -196,15 +200,26 @@ void ExtensionInstallUI::OnInstallSuccess(Extension* extension) { return; ExtensionInstalledBubble::Show(extension, browser, icon_); +#elif defined(OS_MACOSX) + if (extension->browser_action() || + (extension->page_action() && + !extension->page_action()->default_icon_path().empty())) { + Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); + DCHECK(browser); + ExtensionInstalledBubbleCocoa::ShowExtensionInstalledBubble( + browser->window()->GetNativeHandle(), + extension, browser, icon_); + } else { + // If the extension is of type GENERIC, launch infobar instead of popup + // bubble, because we have no guaranteed wrench menu button to point to. + ShowGenericExtensionInstalledInfoBar(extension); + } #elif defined(TOOLKIT_GTK) Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); if (!browser) return; - ExtensionInstalledBubbleGtk::Show(extension, browser, icon_); -#else -// TODO(port) crbug.com/26974 (mac) -#endif +#endif // TOOLKIT_VIEWS } void ExtensionInstallUI::OnInstallFailure(const std::string& error) { @@ -253,6 +268,26 @@ void ExtensionInstallUI::ShowThemeInfoBar(Extension* new_theme) { tab_contents->AddInfoBar(new_delegate); } +#if defined(OS_MACOSX) +void ExtensionInstallUI::ShowGenericExtensionInstalledInfoBar( + Extension* new_extension) { + Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); + if (!browser) + return; + + TabContents* tab_contents = browser->GetSelectedTabContents(); + if (!tab_contents) + return; + + std::wstring msg = l10n_util::GetStringF(IDS_EXTENSION_INSTALLED_HEADING, + UTF8ToWide(new_extension->name())) + + L" " + l10n_util::GetString(IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); + InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate( + tab_contents, msg, new SkBitmap(icon_)); + tab_contents->AddInfoBar(delegate); +} +#endif + InfoBarDelegate* ExtensionInstallUI::GetNewInfoBarDelegate( Extension* new_theme, TabContents* tab_contents) { #if defined(TOOLKIT_GTK) diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h index dcf8cd9..3e51659 100644 --- a/chrome/browser/extensions/extension_install_ui.h +++ b/chrome/browser/extensions/extension_install_ui.h @@ -81,6 +81,12 @@ class ExtensionInstallUI { // the user a choice to keep it or undo the installation. void ShowThemeInfoBar(Extension* new_theme); +#if defined(OS_MACOSX) + // When an extension is installed on Mac with neither browser action nor + // page action icons, show an infobar instead of a popup bubble. + void ShowGenericExtensionInstalledInfoBar(Extension* new_extension); +#endif + // Returns the delegate to control the browser's info bar. This is within its // own function due to its platform-specific nature. InfoBarDelegate* GetNewInfoBarDelegate(Extension* new_theme, |