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/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 string16 extension_name = UTF8ToUTF16(new_extension->name()); | 39 string16 extension_name = UTF8ToUTF16(new_extension->name()); |
40 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 40 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
41 string16 msg = l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, | 41 string16 msg = l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, |
42 extension_name) | 42 extension_name) |
43 + UTF8ToUTF16(" ") | 43 + UTF8ToUTF16(" ") |
44 + l10n_util::GetStringUTF16( | 44 + l10n_util::GetStringUTF16( |
45 IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); | 45 IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); |
46 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); | 46 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); |
47 InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate( | 47 InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate( |
48 infobar_helper, new gfx::Image(new SkBitmap(icon)), msg, true); | 48 infobar_helper, new gfx::Image(icon), msg, true); |
49 infobar_helper->AddInfoBar(delegate); | 49 infobar_helper->AddInfoBar(delegate); |
50 } | 50 } |
51 | 51 |
52 namespace browser { | 52 namespace browser { |
53 | 53 |
54 void ShowExtensionInstalledBubble( | 54 void ShowExtensionInstalledBubble( |
55 const Extension* extension, | 55 const Extension* extension, |
56 Browser* browser, | 56 Browser* browser, |
57 const SkBitmap& icon, | 57 const SkBitmap& icon, |
58 Profile* profile) { | 58 Profile* profile) { |
59 if ((extension->browser_action()) || !extension->omnibox_keyword().empty() || | 59 if ((extension->browser_action()) || !extension->omnibox_keyword().empty() || |
60 (extension->page_action() && | 60 (extension->page_action() && |
61 !extension->page_action()->default_icon_path().empty())) { | 61 !extension->page_action()->default_icon_path().empty())) { |
62 // The controller is deallocated when the window is closed, so no need to | 62 // The controller is deallocated when the window is closed, so no need to |
63 // worry about it here. | 63 // worry about it here. |
64 [[ExtensionInstalledBubbleController alloc] | 64 [[ExtensionInstalledBubbleController alloc] |
65 initWithParentWindow:browser->window()->GetNativeHandle() | 65 initWithParentWindow:browser->window()->GetNativeHandle() |
66 extension:extension | 66 extension:extension |
67 browser:browser | 67 browser:browser |
68 icon:icon]; | 68 icon:icon]; |
69 } else { | 69 } else { |
70 // If the extension is of type GENERIC, meaning it doesn't have a UI | 70 // If the extension is of type GENERIC, meaning it doesn't have a UI |
71 // surface to display for this window, launch infobar instead of popup | 71 // surface to display for this window, launch infobar instead of popup |
72 // bubble, because we have no guaranteed wrench menu button to point to. | 72 // bubble, because we have no guaranteed wrench menu button to point to. |
73 ShowGenericExtensionInstalledInfoBar(extension, icon, profile); | 73 ShowGenericExtensionInstalledInfoBar(extension, icon, profile); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 } // namespace browser | 77 } // namespace browser |
OLD | NEW |