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 #include "chrome/browser/ui/extensions/extension_install_ui_default.h" | 5 #include "chrome/browser/ui/extensions/extension_install_ui_default.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // No browser window is open yet. Create a free-standing dialog associated | 195 // No browser window is open yet. Create a free-standing dialog associated |
196 // with |profile|. | 196 // with |profile|. |
197 return new ExtensionInstallPrompt(profile, NULL, NULL); | 197 return new ExtensionInstallPrompt(profile, NULL, NULL); |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 // ExtensionInstallUIDefault -------------------------------------------------- | 201 // ExtensionInstallUIDefault -------------------------------------------------- |
202 | 202 |
203 ExtensionInstallUIDefault::ExtensionInstallUIDefault(Profile* profile) | 203 ExtensionInstallUIDefault::ExtensionInstallUIDefault(Profile* profile) |
204 : ExtensionInstallUI(profile), | 204 : ExtensionInstallUI(profile), |
205 previous_using_native_theme_(false), | 205 previous_using_system_theme_(false), |
206 use_app_installed_bubble_(false) { | 206 use_app_installed_bubble_(false) { |
207 // |profile| can be NULL during tests. | 207 // |profile| can be NULL during tests. |
208 if (profile) { | 208 if (profile) { |
209 // Remember the current theme in case the user presses undo. | 209 // Remember the current theme in case the user presses undo. |
210 const Extension* previous_theme = | 210 const Extension* previous_theme = |
211 ThemeServiceFactory::GetThemeForProfile(profile); | 211 ThemeServiceFactory::GetThemeForProfile(profile); |
212 if (previous_theme) | 212 if (previous_theme) |
213 previous_theme_id_ = previous_theme->id(); | 213 previous_theme_id_ = previous_theme->id(); |
214 previous_using_native_theme_ = | 214 previous_using_system_theme_ = |
215 ThemeServiceFactory::GetForProfile(profile)->UsingNativeTheme(); | 215 ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme(); |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 ExtensionInstallUIDefault::~ExtensionInstallUIDefault() {} | 219 ExtensionInstallUIDefault::~ExtensionInstallUIDefault() {} |
220 | 220 |
221 void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension, | 221 void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension, |
222 SkBitmap* icon) { | 222 SkBitmap* icon) { |
223 if (skip_post_install_ui()) | 223 if (skip_post_install_ui()) |
224 return; | 224 return; |
225 | 225 |
226 if (!profile()) { | 226 if (!profile()) { |
227 // TODO(zelidrag): Figure out what exact conditions cause crash | 227 // TODO(zelidrag): Figure out what exact conditions cause crash |
228 // http://crbug.com/159437 and write browser test to cover it. | 228 // http://crbug.com/159437 and write browser test to cover it. |
229 NOTREACHED(); | 229 NOTREACHED(); |
230 return; | 230 return; |
231 } | 231 } |
232 | 232 |
233 if (extension->is_theme()) { | 233 if (extension->is_theme()) { |
234 ThemeInstalledInfoBarDelegate::Create( | 234 ThemeInstalledInfoBarDelegate::Create( |
235 extension, profile(), previous_theme_id_, previous_using_native_theme_); | 235 extension, profile(), previous_theme_id_, previous_using_system_theme_); |
236 return; | 236 return; |
237 } | 237 } |
238 | 238 |
239 // Extensions aren't enabled by default in incognito so we confirm | 239 // Extensions aren't enabled by default in incognito so we confirm |
240 // the install in a normal window. | 240 // the install in a normal window. |
241 Profile* current_profile = profile()->GetOriginalProfile(); | 241 Profile* current_profile = profile()->GetOriginalProfile(); |
242 if (extension->is_app()) { | 242 if (extension->is_app()) { |
243 bool use_bubble = false; | 243 bool use_bubble = false; |
244 | 244 |
245 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 245 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 browser->tab_strip_model()->GetActiveWebContents(); | 285 browser->tab_strip_model()->GetActiveWebContents(); |
286 if (!web_contents) | 286 if (!web_contents) |
287 return; | 287 return; |
288 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), | 288 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), |
289 error); | 289 error); |
290 } | 290 } |
291 | 291 |
292 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { | 292 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { |
293 use_app_installed_bubble_ = use_bubble; | 293 use_app_installed_bubble_ = use_bubble; |
294 } | 294 } |
OLD | NEW |