| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/bundle_installer.h" | 9 #include "chrome/browser/extensions/bundle_installer.h" |
| 10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 extension_name) | 41 extension_name) |
| 42 + UTF8ToUTF16(" ") | 42 + UTF8ToUTF16(" ") |
| 43 + l10n_util::GetStringUTF16( | 43 + l10n_util::GetStringUTF16( |
| 44 IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); | 44 IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); |
| 45 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); | 45 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); |
| 46 InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate( | 46 InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate( |
| 47 infobar_helper, new gfx::Image(icon), msg, true); | 47 infobar_helper, new gfx::Image(icon), msg, true); |
| 48 infobar_helper->AddInfoBar(delegate); | 48 infobar_helper->AddInfoBar(delegate); |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace browser { | 51 namespace chrome { |
| 52 | 52 |
| 53 void ShowExtensionInstalledBubble( | 53 void ShowExtensionInstalledBubble(const extensions::Extension* extension, |
| 54 const extensions::Extension* extension, | 54 Browser* browser, |
| 55 Browser* browser, | 55 const SkBitmap& icon) { |
| 56 const SkBitmap& icon) { | |
| 57 if ((extension->browser_action()) || !extension->omnibox_keyword().empty() || | 56 if ((extension->browser_action()) || !extension->omnibox_keyword().empty() || |
| 58 (extension->page_action() && | 57 (extension->page_action() && |
| 59 !extension->page_action()->default_icon_path().empty())) { | 58 !extension->page_action()->default_icon_path().empty())) { |
| 60 // The controller is deallocated when the window is closed, so no need to | 59 // The controller is deallocated when the window is closed, so no need to |
| 61 // worry about it here. | 60 // worry about it here. |
| 62 [[ExtensionInstalledBubbleController alloc] | 61 [[ExtensionInstalledBubbleController alloc] |
| 63 initWithParentWindow:browser->window()->GetNativeWindow() | 62 initWithParentWindow:browser->window()->GetNativeWindow() |
| 64 extension:extension | 63 extension:extension |
| 65 bundle:NULL | 64 bundle:NULL |
| 66 browser:browser | 65 browser:browser |
| 67 icon:icon]; | 66 icon:icon]; |
| 68 } else { | 67 } else { |
| 69 // If the extension is of type GENERIC, meaning it doesn't have a UI | 68 // If the extension is of type GENERIC, meaning it doesn't have a UI |
| 70 // surface to display for this window, launch infobar instead of popup | 69 // surface to display for this window, launch infobar instead of popup |
| 71 // bubble, because we have no guaranteed wrench menu button to point to. | 70 // bubble, because we have no guaranteed wrench menu button to point to. |
| 72 ShowGenericExtensionInstalledInfoBar(extension, browser, icon); | 71 ShowGenericExtensionInstalledInfoBar(extension, browser, icon); |
| 73 } | 72 } |
| 74 } | 73 } |
| 75 | 74 |
| 76 } // namespace browser | 75 } // namespace chrome |
| 77 | 76 |
| 78 void extensions::BundleInstaller::ShowInstalledBubble( | 77 void extensions::BundleInstaller::ShowInstalledBubble( |
| 79 const BundleInstaller* bundle, Browser* browser) { | 78 const BundleInstaller* bundle, Browser* browser) { |
| 80 // The controller is deallocated when the window is closed, so no need to | 79 // The controller is deallocated when the window is closed, so no need to |
| 81 // worry about it here. | 80 // worry about it here. |
| 82 [[ExtensionInstalledBubbleController alloc] | 81 [[ExtensionInstalledBubbleController alloc] |
| 83 initWithParentWindow:browser->window()->GetNativeWindow() | 82 initWithParentWindow:browser->window()->GetNativeWindow() |
| 84 extension:NULL | 83 extension:NULL |
| 85 bundle:bundle | 84 bundle:bundle |
| 86 browser:browser | 85 browser:browser |
| 87 icon:SkBitmap()]; | 86 icon:SkBitmap()]; |
| 88 } | 87 } |
| OLD | NEW |