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" | |
9 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
12 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 11 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
13 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 12 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
14 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
15 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 14 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/search/search.h" | 16 #include "chrome/browser/search/search.h" |
18 #include "chrome/browser/themes/theme_service.h" | 17 #include "chrome/browser/themes/theme_service.h" |
19 #include "chrome/browser/themes/theme_service_factory.h" | 18 #include "chrome/browser/themes/theme_service_factory.h" |
20 #include "chrome/browser/ui/app_list/app_list_service.h" | 19 #include "chrome/browser/ui/app_list/app_list_service.h" |
21 #include "chrome/browser/ui/app_list/app_list_util.h" | 20 #include "chrome/browser/ui/app_list/app_list_util.h" |
22 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_dialogs.h" | 22 #include "chrome/browser/ui/browser_dialogs.h" |
24 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
25 #include "chrome/browser/ui/browser_navigator.h" | 24 #include "chrome/browser/ui/browser_navigator.h" |
26 #include "chrome/browser/ui/browser_tabstrip.h" | 25 #include "chrome/browser/ui/browser_tabstrip.h" |
27 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
28 #include "chrome/browser/ui/host_desktop.h" | 27 #include "chrome/browser/ui/host_desktop.h" |
29 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 28 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
30 #include "chrome/browser/ui/simple_message_box.h" | 29 #include "chrome/browser/ui/simple_message_box.h" |
31 #include "chrome/browser/ui/singleton_tabs.h" | 30 #include "chrome/browser/ui/singleton_tabs.h" |
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 31 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
33 #include "chrome/common/chrome_switches.h" | |
34 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
35 #include "components/infobars/core/infobar.h" | 33 #include "components/infobars/core/infobar.h" |
36 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
38 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
39 #include "extensions/common/extension.h" | 37 #include "extensions/common/extension.h" |
40 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
41 #include "grit/theme_resources.h" | 39 #include "grit/theme_resources.h" |
42 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
43 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 return; | 236 return; |
239 } | 237 } |
240 | 238 |
241 // Extensions aren't enabled by default in incognito so we confirm | 239 // Extensions aren't enabled by default in incognito so we confirm |
242 // the install in a normal window. | 240 // the install in a normal window. |
243 Profile* current_profile = profile()->GetOriginalProfile(); | 241 Profile* current_profile = profile()->GetOriginalProfile(); |
244 if (extension->is_app()) { | 242 if (extension->is_app()) { |
245 bool use_bubble = false; | 243 bool use_bubble = false; |
246 | 244 |
247 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 245 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
248 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 246 use_bubble = use_app_installed_bubble_; |
249 use_bubble = (use_app_installed_bubble_ || | |
250 cmdline->HasSwitch(switches::kAppsNewInstallBubble)); | |
251 #endif | 247 #endif |
252 | 248 |
253 if (IsAppLauncherEnabled()) { | 249 if (IsAppLauncherEnabled()) { |
254 // TODO(tapted): ExtensionInstallUI should retain the desktop type from | 250 // TODO(tapted): ExtensionInstallUI should retain the desktop type from |
255 // the browser used to initiate the flow. http://crbug.com/308360. | 251 // the browser used to initiate the flow. http://crbug.com/308360. |
256 AppListService::Get(chrome::GetActiveDesktop())-> | 252 AppListService::Get(chrome::GetActiveDesktop())-> |
257 ShowForProfile(current_profile); | 253 ShowForProfile(current_profile); |
258 | 254 |
259 content::NotificationService::current()->Notify( | 255 content::NotificationService::current()->Notify( |
260 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, | 256 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, |
(...skipping 28 matching lines...) Expand all Loading... |
289 browser->tab_strip_model()->GetActiveWebContents(); | 285 browser->tab_strip_model()->GetActiveWebContents(); |
290 if (!web_contents) | 286 if (!web_contents) |
291 return; | 287 return; |
292 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), | 288 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), |
293 error); | 289 error); |
294 } | 290 } |
295 | 291 |
296 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { | 292 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { |
297 use_app_installed_bubble_ = use_bubble; | 293 use_app_installed_bubble_ = use_bubble; |
298 } | 294 } |
OLD | NEW |