| 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/extensions/extension_install_ui_default.h" | 5 #include "chrome/browser/extensions/extension_install_ui_default.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 void ExtensionInstallUIDefault::OnInstallFailure( | 200 void ExtensionInstallUIDefault::OnInstallFailure( |
| 201 const extensions::CrxInstallerError& error) { | 201 const extensions::CrxInstallerError& error) { |
| 202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 203 if (disable_failure_ui_for_tests || skip_post_install_ui_) | 203 if (disable_failure_ui_for_tests || skip_post_install_ui_) |
| 204 return; | 204 return; |
| 205 | 205 |
| 206 Browser* browser = chrome::FindLastActiveWithProfile(profile_, | 206 Browser* browser = chrome::FindLastActiveWithProfile(profile_, |
| 207 chrome::GetActiveDesktop()); | 207 chrome::GetActiveDesktop()); |
| 208 if (!browser) // unit tests |
| 209 return; |
| 208 WebContents* web_contents = | 210 WebContents* web_contents = |
| 209 browser->tab_strip_model()->GetActiveWebContents(); | 211 browser->tab_strip_model()->GetActiveWebContents(); |
| 210 if (!web_contents) | 212 if (!web_contents) |
| 211 return; | 213 return; |
| 212 ErrorInfobarDelegate::Create(InfoBarService::FromWebContents(web_contents), | 214 ErrorInfobarDelegate::Create(InfoBarService::FromWebContents(web_contents), |
| 213 browser, error); | 215 browser, error); |
| 214 } | 216 } |
| 215 | 217 |
| 216 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) { | 218 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) { |
| 217 skip_post_install_ui_ = skip_ui; | 219 skip_post_install_ui_ = skip_ui; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 return new ExtensionInstallPrompt(web_contents); | 264 return new ExtensionInstallPrompt(web_contents); |
| 263 } | 265 } |
| 264 | 266 |
| 265 // static | 267 // static |
| 266 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( | 268 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( |
| 267 Profile* profile) { | 269 Profile* profile) { |
| 268 Browser* browser = chrome::FindLastActiveWithProfile(profile, | 270 Browser* browser = chrome::FindLastActiveWithProfile(profile, |
| 269 chrome::GetActiveDesktop()); | 271 chrome::GetActiveDesktop()); |
| 270 return CreateInstallPromptWithBrowser(browser); | 272 return CreateInstallPromptWithBrowser(browser); |
| 271 } | 273 } |
| OLD | NEW |