Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/ui/browser_tabstrip.h" | 22 #include "chrome/browser/ui/browser_tabstrip.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" | 24 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" |
| 25 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 25 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 26 #include "chrome/browser/ui/simple_message_box.h" | 26 #include "chrome/browser/ui/simple_message_box.h" |
| 27 #include "chrome/browser/ui/singleton_tabs.h" | 27 #include "chrome/browser/ui/singleton_tabs.h" |
| 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 29 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
| 30 #include "components/infobars/core/confirm_infobar_delegate.h" | 30 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 31 #include "components/infobars/core/infobar.h" | 31 #include "components/infobars/core/infobar.h" |
| 32 #include "components/search/search.h" | |
| 33 #include "components/strings/grit/components_strings.h" | 32 #include "components/strings/grit/components_strings.h" |
| 34 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 35 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 36 #include "extensions/browser/install/crx_install_error.h" | 35 #include "extensions/browser/install/crx_install_error.h" |
| 37 #include "extensions/common/extension.h" | 36 #include "extensions/common/extension.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 39 | 38 |
| 40 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 41 #include "chrome/browser/ui/extensions/extension_installed_notification.h" | 40 #include "chrome/browser/ui/extensions/extension_installed_notification.h" |
| 42 #else | 41 #else |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 221 |
| 223 void ExtensionInstallUIDefault::OpenAppInstalledUI(const std::string& app_id) { | 222 void ExtensionInstallUIDefault::OpenAppInstalledUI(const std::string& app_id) { |
| 224 #if defined(OS_CHROMEOS) | 223 #if defined(OS_CHROMEOS) |
| 225 // Notification always enabled on ChromeOS, so always handled in | 224 // Notification always enabled on ChromeOS, so always handled in |
| 226 // OnInstallSuccess. | 225 // OnInstallSuccess. |
| 227 NOTREACHED(); | 226 NOTREACHED(); |
| 228 #else | 227 #else |
| 229 Profile* current_profile = profile_->GetOriginalProfile(); | 228 Profile* current_profile = profile_->GetOriginalProfile(); |
| 230 Browser* browser = FindOrCreateVisibleBrowser(current_profile); | 229 Browser* browser = FindOrCreateVisibleBrowser(current_profile); |
| 231 if (browser) { | 230 if (browser) { |
| 232 GURL url(search::IsInstantExtendedAPIEnabled() | 231 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| 233 ? chrome::kChromeUIAppsURL | 232 browser, GURL(chrome::kChromeUIAppsURL))); |
| 234 : chrome::kChromeUINewTabURL); | |
|
Marc Treib
2016/11/17 18:10:45
I suspect this was from way back when the NTP had
| |
| 235 chrome::NavigateParams params( | |
| 236 chrome::GetSingletonTabNavigateParams(browser, url)); | |
| 237 chrome::Navigate(¶ms); | 233 chrome::Navigate(¶ms); |
| 238 | 234 |
| 239 content::NotificationService::current()->Notify( | 235 content::NotificationService::current()->Notify( |
| 240 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, | 236 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, |
| 241 content::Source<WebContents>(params.target_contents), | 237 content::Source<WebContents>(params.target_contents), |
| 242 content::Details<const std::string>(&app_id)); | 238 content::Details<const std::string>(&app_id)); |
| 243 } | 239 } |
| 244 #endif | 240 #endif |
| 245 } | 241 } |
| 246 | 242 |
| 247 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { | 243 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { |
| 248 use_app_installed_bubble_ = use_bubble; | 244 use_app_installed_bubble_ = use_bubble; |
| 249 } | 245 } |
| 250 | 246 |
| 251 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) { | 247 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) { |
| 252 skip_post_install_ui_ = skip_ui; | 248 skip_post_install_ui_ = skip_ui; |
| 253 } | 249 } |
| 254 | 250 |
| 255 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { | 251 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { |
| 256 Browser* browser = chrome::FindLastActiveWithProfile(profile_); | 252 Browser* browser = chrome::FindLastActiveWithProfile(profile_); |
| 257 if (browser) { | 253 if (browser) { |
| 258 content::WebContents* contents = | 254 content::WebContents* contents = |
| 259 browser->tab_strip_model()->GetActiveWebContents(); | 255 browser->tab_strip_model()->GetActiveWebContents(); |
| 260 return contents->GetTopLevelNativeWindow(); | 256 return contents->GetTopLevelNativeWindow(); |
| 261 } | 257 } |
| 262 return NULL; | 258 return NULL; |
| 263 } | 259 } |
| OLD | NEW |