| 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_list.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 17 #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" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/extensions/extension_action.h" | 20 #include "chrome/common/extensions/extension_action.h" |
| 21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
| 22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
| 25 | 25 |
| 26 using extensions::BundleInstaller; | 26 using extensions::BundleInstaller; |
| 27 | 27 |
| 28 // 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 |
| 29 // page action icons, show an infobar instead of a popup bubble. | 29 // page action icons, show an infobar instead of a popup bubble. |
| 30 static void ShowGenericExtensionInstalledInfoBar( | 30 static void ShowGenericExtensionInstalledInfoBar( |
| 31 const Extension* new_extension, | 31 const Extension* new_extension, |
| 32 const SkBitmap& icon, | 32 const SkBitmap& icon, |
| 33 Profile* profile) { | 33 Profile* profile) { |
| 34 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 34 Browser* browser = browser::FindLastActiveWithProfile(profile); |
| 35 if (!browser) | 35 if (!browser) |
| 36 return; | 36 return; |
| 37 | 37 |
| 38 TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); | 38 TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); |
| 39 if (!wrapper) | 39 if (!wrapper) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 string16 extension_name = UTF8ToUTF16(new_extension->name()); | 42 string16 extension_name = UTF8ToUTF16(new_extension->name()); |
| 43 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 43 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
| 44 string16 msg = l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, | 44 string16 msg = l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 const BundleInstaller* bundle, Browser* browser) { | 84 const BundleInstaller* bundle, Browser* browser) { |
| 85 // The controller is deallocated when the window is closed, so no need to | 85 // The controller is deallocated when the window is closed, so no need to |
| 86 // worry about it here. | 86 // worry about it here. |
| 87 [[ExtensionInstalledBubbleController alloc] | 87 [[ExtensionInstalledBubbleController alloc] |
| 88 initWithParentWindow:browser->window()->GetNativeHandle() | 88 initWithParentWindow:browser->window()->GetNativeHandle() |
| 89 extension:NULL | 89 extension:NULL |
| 90 bundle:bundle | 90 bundle:bundle |
| 91 browser:browser | 91 browser:browser |
| 92 icon:SkBitmap()]; | 92 icon:SkBitmap()]; |
| 93 } | 93 } |
| OLD | NEW |