diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-31 21:45:17 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-31 21:45:17 +0000 |
commit | 54bc0925f6430d3fd94fbfc8cabff0a41128701a (patch) | |
tree | 0596552395a069054716171e111bb5c971367290 /chrome/browser/extensions | |
parent | 007cb731cd1d0af76a0688faa5d1e125c6f57db3 (diff) | |
download | chromium_src-54bc0925f6430d3fd94fbfc8cabff0a41128701a.zip chromium_src-54bc0925f6430d3fd94fbfc8cabff0a41128701a.tar.gz chromium_src-54bc0925f6430d3fd94fbfc8cabff0a41128701a.tar.bz2 |
ExtensionInstalledBubble for Mac.
Adds ExtensionInstalledBubble.xib, which contains the framework for the bubble itself (icon view, close button, and three message fields).
BUG= 26974
TEST= Install an extension. Bubble should show same information as windows bubble.
Review URL: http://codereview.chromium.org/527012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37671 0039d316-1c4b-4281-b951-d872f2087c98
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, |