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" |
11 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
12 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 12 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_dialogs.h" | 14 #include "chrome/browser/ui/browser_dialogs.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.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.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents.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 |
25 using extensions::BundleInstaller; | 26 using extensions::BundleInstaller; |
26 | 27 |
27 // 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 |
28 // page action icons, show an infobar instead of a popup bubble. | 29 // page action icons, show an infobar instead of a popup bubble. |
29 static void ShowGenericExtensionInstalledInfoBar( | 30 static void ShowGenericExtensionInstalledInfoBar( |
30 const extensions::Extension* new_extension, | 31 const extensions::Extension* new_extension, |
31 Browser* browser, | 32 Browser* browser, |
32 const SkBitmap& icon) { | 33 const SkBitmap& icon) { |
33 TabContents* tab_contents = browser->GetActiveTabContents(); | 34 TabContents* tab_contents = chrome::GetActiveTabContents(browser); |
34 if (!tab_contents) | 35 if (!tab_contents) |
35 return; | 36 return; |
36 | 37 |
37 string16 extension_name = UTF8ToUTF16(new_extension->name()); | 38 string16 extension_name = UTF8ToUTF16(new_extension->name()); |
38 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 39 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
39 string16 msg = l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, | 40 string16 msg = l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, |
40 extension_name) | 41 extension_name) |
41 + UTF8ToUTF16(" ") | 42 + UTF8ToUTF16(" ") |
42 + l10n_util::GetStringUTF16( | 43 + l10n_util::GetStringUTF16( |
43 IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); | 44 IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const BundleInstaller* bundle, Browser* browser) { | 79 const BundleInstaller* bundle, Browser* browser) { |
79 // The controller is deallocated when the window is closed, so no need to | 80 // The controller is deallocated when the window is closed, so no need to |
80 // worry about it here. | 81 // worry about it here. |
81 [[ExtensionInstalledBubbleController alloc] | 82 [[ExtensionInstalledBubbleController alloc] |
82 initWithParentWindow:browser->window()->GetNativeWindow() | 83 initWithParentWindow:browser->window()->GetNativeWindow() |
83 extension:NULL | 84 extension:NULL |
84 bundle:bundle | 85 bundle:bundle |
85 browser:browser | 86 browser:browser |
86 icon:SkBitmap()]; | 87 icon:SkBitmap()]; |
87 } | 88 } |
OLD | NEW |