Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm

Issue 9460045: Add Mac interface for installing bundles of extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // The controller is deallocated when the window is closed, so no need to
86 // worry about it here.
87 [[ExtensionInstalledBubbleController alloc]
88 initWithParentWindow:browser->window()->GetNativeHandle()
89 extension:NULL
90 bundle:bundle
91 browser:browser
92 icon:SkBitmap()];
93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698