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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 ShowExtensionInstalledBubble(extension, current_profile, *icon); | 205 ShowExtensionInstalledBubble(extension, current_profile, *icon); |
206 } | 206 } |
207 | 207 |
208 void ExtensionInstallUIDefault::OnInstallFailure( | 208 void ExtensionInstallUIDefault::OnInstallFailure( |
209 const extensions::CrxInstallError& error) { | 209 const extensions::CrxInstallError& error) { |
210 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 210 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
211 if (disable_failure_ui_for_tests() || skip_post_install_ui_) | 211 if (disable_failure_ui_for_tests() || skip_post_install_ui_) |
212 return; | 212 return; |
213 | 213 |
214 Browser* browser = | 214 Browser* browser = chrome::FindLastActiveWithProfile(profile_); |
215 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); | |
216 if (!browser) // Can be NULL in unittests. | 215 if (!browser) // Can be NULL in unittests. |
217 return; | 216 return; |
218 WebContents* web_contents = | 217 WebContents* web_contents = |
219 browser->tab_strip_model()->GetActiveWebContents(); | 218 browser->tab_strip_model()->GetActiveWebContents(); |
220 if (!web_contents) | 219 if (!web_contents) |
221 return; | 220 return; |
222 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), | 221 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), |
223 error); | 222 error); |
224 } | 223 } |
225 | 224 |
(...skipping 23 matching lines...) Expand all Loading... |
249 | 248 |
250 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { | 249 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { |
251 use_app_installed_bubble_ = use_bubble; | 250 use_app_installed_bubble_ = use_bubble; |
252 } | 251 } |
253 | 252 |
254 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) { | 253 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) { |
255 skip_post_install_ui_ = skip_ui; | 254 skip_post_install_ui_ = skip_ui; |
256 } | 255 } |
257 | 256 |
258 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { | 257 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { |
259 Browser* browser = | 258 Browser* browser = chrome::FindLastActiveWithProfile(profile_); |
260 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); | |
261 if (browser) { | 259 if (browser) { |
262 content::WebContents* contents = | 260 content::WebContents* contents = |
263 browser->tab_strip_model()->GetActiveWebContents(); | 261 browser->tab_strip_model()->GetActiveWebContents(); |
264 return contents->GetTopLevelNativeWindow(); | 262 return contents->GetTopLevelNativeWindow(); |
265 } | 263 } |
266 return NULL; | 264 return NULL; |
267 } | 265 } |
OLD | NEW |