| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/extensions/extension_install_ui.h" | 5 #include "chrome/browser/extensions/extension_install_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" |
| 10 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 11 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 12 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 13 #include "chrome/browser/browser_window.h" | 14 #include "chrome/browser/browser_window.h" |
| 14 #include "chrome/browser/extensions/theme_preview_infobar_delegate.h" | 15 #include "chrome/browser/extensions/theme_preview_infobar_delegate.h" |
| 15 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
| 16 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
| 17 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
| 19 #include "grit/browser_resources.h" |
| 18 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
| 19 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 20 | 22 |
| 21 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 22 #include "app/win_util.h" | 24 #include "app/win_util.h" |
| 23 #elif defined(OS_MACOSX) | 25 #elif defined(OS_MACOSX) |
| 24 #include "base/scoped_cftyperef.h" | 26 #include "base/scoped_cftyperef.h" |
| 25 #include "base/sys_string_conversions.h" | 27 #include "base/sys_string_conversions.h" |
| 26 #include <CoreFoundation/CFUserNotification.h> | 28 #include <CoreFoundation/CFUserNotification.h> |
| 27 #endif | 29 #endif |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Remember the current theme in case the user pressed undo. | 97 // Remember the current theme in case the user pressed undo. |
| 96 Extension* previous_theme = profile_->GetTheme(); | 98 Extension* previous_theme = profile_->GetTheme(); |
| 97 if (previous_theme) | 99 if (previous_theme) |
| 98 previous_theme_id_ = previous_theme->id(); | 100 previous_theme_id_ = previous_theme->id(); |
| 99 | 101 |
| 100 delegate->ContinueInstall(); | 102 delegate->ContinueInstall(); |
| 101 return; | 103 return; |
| 102 } | 104 } |
| 103 | 105 |
| 104 #if defined(OS_WIN) || defined(TOOLKIT_GTK) | 106 #if defined(OS_WIN) || defined(TOOLKIT_GTK) |
| 107 if (!install_icon) { |
| 108 install_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 109 IDR_DEFAULT_EXTENSION_ICON_128); |
| 110 } |
| 111 |
| 105 ShowExtensionInstallPrompt(profile_, delegate, extension, install_icon, | 112 ShowExtensionInstallPrompt(profile_, delegate, extension, install_icon, |
| 106 GetInstallWarning(extension)); | 113 GetInstallWarning(extension)); |
| 107 | 114 |
| 108 #elif defined(OS_MACOSX) | 115 #elif defined(OS_MACOSX) |
| 109 // TODO(port): Implement nicer UI. | 116 // TODO(port): Implement nicer UI. |
| 110 // Using CoreFoundation to do this dialog is unimaginably lame but will do | 117 // Using CoreFoundation to do this dialog is unimaginably lame but will do |
| 111 // until the UI is redone. | 118 // until the UI is redone. |
| 112 scoped_cftyperef<CFStringRef> confirm_title(base::SysWideToCFStringRef( | 119 scoped_cftyperef<CFStringRef> confirm_title(base::SysWideToCFStringRef( |
| 113 l10n_util::GetString(IDS_EXTENSION_PROMPT_TITLE))); | 120 l10n_util::GetString(IDS_EXTENSION_PROMPT_TITLE))); |
| 114 | 121 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 216 |
| 210 // Then either replace that old one or add a new one. | 217 // Then either replace that old one or add a new one. |
| 211 InfoBarDelegate* new_delegate = new ThemePreviewInfobarDelegate(tab_contents, | 218 InfoBarDelegate* new_delegate = new ThemePreviewInfobarDelegate(tab_contents, |
| 212 new_theme->name(), previous_theme_id_); | 219 new_theme->name(), previous_theme_id_); |
| 213 | 220 |
| 214 if (old_delegate) | 221 if (old_delegate) |
| 215 tab_contents->ReplaceInfoBar(old_delegate, new_delegate); | 222 tab_contents->ReplaceInfoBar(old_delegate, new_delegate); |
| 216 else | 223 else |
| 217 tab_contents->AddInfoBar(new_delegate); | 224 tab_contents->AddInfoBar(new_delegate); |
| 218 } | 225 } |
| OLD | NEW |