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

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

Issue 8872009: Revert 113568 - extensions: remove install/uninstall terminology (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" 11 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_dialogs.h" 13 #include "chrome/browser/ui/browser_dialogs.h"
14 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/browser_window.h" 15 #include "chrome/browser/ui/browser_window.h"
16 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h" 16 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
18 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
19 #include "chrome/common/extensions/extension_action.h" 19 #include "chrome/common/extensions/extension_action.h"
20 #include "grit/chromium_strings.h"
21 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
24 23
25 // When an extension is installed on Mac with neither browser action nor 24 // When an extension is installed on Mac with neither browser action nor
26 // page action icons, show an infobar instead of a popup bubble. 25 // page action icons, show an infobar instead of a popup bubble.
27 static void ShowGenericExtensionInstalledInfoBar( 26 static void ShowGenericExtensionInstalledInfoBar(
28 const Extension* new_extension, 27 const Extension* new_extension,
29 const SkBitmap& icon, 28 const SkBitmap& icon,
30 Profile* profile) { 29 Profile* profile) {
31 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); 30 Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
32 if (!browser) 31 if (!browser)
33 return; 32 return;
34 33
35 TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); 34 TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper();
36 if (!wrapper) 35 if (!wrapper)
37 return; 36 return;
38 37
39 string16 extension_name = UTF8ToUTF16(new_extension->name()); 38 string16 extension_name = UTF8ToUTF16(new_extension->name());
40 base::i18n::AdjustStringForLocaleDirection(&extension_name); 39 base::i18n::AdjustStringForLocaleDirection(&extension_name);
41 string16 msg = l10n_util::GetStringFUTF16( 40 string16 msg =
42 IDS_EXTENSION_INSTALLED_HEADING, 41 l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING,
43 extension_name, 42 extension_name) +
44 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)) +
45 UTF8ToUTF16(" ") + 43 UTF8ToUTF16(" ") +
46 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); 44 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC);
47 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); 45 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper();
48 InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate( 46 InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate(
49 infobar_helper, new gfx::Image(new SkBitmap(icon)), msg, true); 47 infobar_helper, new gfx::Image(new SkBitmap(icon)), msg, true);
50 infobar_helper->AddInfoBar(delegate); 48 infobar_helper->AddInfoBar(delegate);
51 } 49 }
52 50
53 namespace browser { 51 namespace browser {
54 52
(...skipping 14 matching lines...) Expand all
69 icon:icon]; 67 icon:icon];
70 } else { 68 } else {
71 // If the extension is of type GENERIC, meaning it doesn't have a UI 69 // If the extension is of type GENERIC, meaning it doesn't have a UI
72 // surface to display for this window, launch infobar instead of popup 70 // surface to display for this window, launch infobar instead of popup
73 // bubble, because we have no guaranteed wrench menu button to point to. 71 // bubble, because we have no guaranteed wrench menu button to point to.
74 ShowGenericExtensionInstalledInfoBar(extension, icon, profile); 72 ShowGenericExtensionInstalledInfoBar(extension, icon, profile);
75 } 73 }
76 } 74 }
77 75
78 } // namespace browser 76 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698