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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if (browser) | 184 if (browser) |
185 web_contents = browser->tab_strip_model()->GetActiveWebContents(); | 185 web_contents = browser->tab_strip_model()->GetActiveWebContents(); |
186 return new ExtensionInstallPrompt(web_contents); | 186 return new ExtensionInstallPrompt(web_contents); |
187 } | 187 } |
188 | 188 |
189 // static | 189 // static |
190 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( | 190 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( |
191 Profile* profile) { | 191 Profile* profile) { |
192 Browser* browser = chrome::FindLastActiveWithProfile(profile, | 192 Browser* browser = chrome::FindLastActiveWithProfile(profile, |
193 chrome::GetActiveDesktop()); | 193 chrome::GetActiveDesktop()); |
194 return CreateInstallPromptWithBrowser(browser); | 194 if (browser) |
| 195 return CreateInstallPromptWithBrowser(browser); |
| 196 // No browser window is open yet. Create a free-standing dialog associated |
| 197 // with |profile|. |
| 198 return new ExtensionInstallPrompt(profile, NULL, NULL); |
195 } | 199 } |
196 | 200 |
197 | 201 |
198 // ExtensionInstallUIDefault -------------------------------------------------- | 202 // ExtensionInstallUIDefault -------------------------------------------------- |
199 | 203 |
200 ExtensionInstallUIDefault::ExtensionInstallUIDefault(Profile* profile) | 204 ExtensionInstallUIDefault::ExtensionInstallUIDefault(Profile* profile) |
201 : ExtensionInstallUI(profile), | 205 : ExtensionInstallUI(profile), |
202 previous_using_native_theme_(false), | 206 previous_using_native_theme_(false), |
203 use_app_installed_bubble_(false) { | 207 use_app_installed_bubble_(false) { |
204 // |profile| can be NULL during tests. | 208 // |profile| can be NULL during tests. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 browser->tab_strip_model()->GetActiveWebContents(); | 288 browser->tab_strip_model()->GetActiveWebContents(); |
285 if (!web_contents) | 289 if (!web_contents) |
286 return; | 290 return; |
287 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), | 291 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), |
288 error); | 292 error); |
289 } | 293 } |
290 | 294 |
291 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { | 295 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { |
292 use_app_installed_bubble_ = use_bubble; | 296 use_app_installed_bubble_ = use_bubble; |
293 } | 297 } |
OLD | NEW |