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/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
11 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 12 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_dialogs.h" | 14 #include "chrome/browser/ui/browser_dialogs.h" |
14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
16 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h" | 17 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h" |
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
18 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
19 #include "chrome/common/extensions/extension_action.h" | 20 #include "chrome/common/extensions/extension_action.h" |
20 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
24 | 25 |
26 using extensions::BundleInstaller; | |
27 | |
25 // When an extension is installed on Mac with neither browser action nor | 28 // When an extension is installed on Mac with neither browser action nor |
26 // page action icons, show an infobar instead of a popup bubble. | 29 // page action icons, show an infobar instead of a popup bubble. |
27 static void ShowGenericExtensionInstalledInfoBar( | 30 static void ShowGenericExtensionInstalledInfoBar( |
28 const Extension* new_extension, | 31 const Extension* new_extension, |
29 const SkBitmap& icon, | 32 const SkBitmap& icon, |
30 Profile* profile) { | 33 Profile* profile) { |
31 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 34 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); |
32 if (!browser) | 35 if (!browser) |
33 return; | 36 return; |
34 | 37 |
(...skipping 22 matching lines...) Expand all Loading... | |
57 const SkBitmap& icon, | 60 const SkBitmap& icon, |
58 Profile* profile) { | 61 Profile* profile) { |
59 if ((extension->browser_action()) || !extension->omnibox_keyword().empty() || | 62 if ((extension->browser_action()) || !extension->omnibox_keyword().empty() || |
60 (extension->page_action() && | 63 (extension->page_action() && |
61 !extension->page_action()->default_icon_path().empty())) { | 64 !extension->page_action()->default_icon_path().empty())) { |
62 // The controller is deallocated when the window is closed, so no need to | 65 // The controller is deallocated when the window is closed, so no need to |
63 // worry about it here. | 66 // worry about it here. |
64 [[ExtensionInstalledBubbleController alloc] | 67 [[ExtensionInstalledBubbleController alloc] |
65 initWithParentWindow:browser->window()->GetNativeHandle() | 68 initWithParentWindow:browser->window()->GetNativeHandle() |
66 extension:extension | 69 extension:extension |
70 bundle:NULL | |
67 browser:browser | 71 browser:browser |
68 icon:icon]; | 72 icon:icon]; |
69 } else { | 73 } else { |
70 // If the extension is of type GENERIC, meaning it doesn't have a UI | 74 // 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 | 75 // surface to display for this window, launch infobar instead of popup |
72 // bubble, because we have no guaranteed wrench menu button to point to. | 76 // bubble, because we have no guaranteed wrench menu button to point to. |
73 ShowGenericExtensionInstalledInfoBar(extension, icon, profile); | 77 ShowGenericExtensionInstalledInfoBar(extension, icon, profile); |
74 } | 78 } |
75 } | 79 } |
76 | 80 |
77 } // namespace browser | 81 } // namespace browser |
82 | |
83 void extensions::BundleInstaller::ShowInstalledBubble( | |
84 const BundleInstaller* bundle, Browser* browser) { | |
85 | |
Robert Sesek
2012/02/27 18:59:20
nit: remove
jstritar
2012/03/05 18:05:08
Done.
| |
86 // The controller is deallocated when the window is closed, so no need to | |
87 // worry about it here. | |
88 [[ExtensionInstalledBubbleController alloc] | |
89 initWithParentWindow:browser->window()->GetNativeHandle() | |
90 extension:NULL | |
91 bundle:bundle | |
92 browser:browser | |
93 icon:SkBitmap()]; | |
94 } | |
OLD | NEW |