| 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/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "chrome/browser/ui/chrome_pages.h" | 65 #include "chrome/browser/ui/chrome_pages.h" |
| 66 #include "chrome/browser/ui/extensions/app_launch_params.h" | 66 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 67 #include "chrome/browser/ui/extensions/application_launch.h" | 67 #include "chrome/browser/ui/extensions/application_launch.h" |
| 68 #include "chrome/browser/ui/session_crashed_bubble.h" | 68 #include "chrome/browser/ui/session_crashed_bubble.h" |
| 69 #include "chrome/browser/ui/startup/automation_infobar_delegate.h" | 69 #include "chrome/browser/ui/startup/automation_infobar_delegate.h" |
| 70 #include "chrome/browser/ui/startup/bad_flags_prompt.h" | 70 #include "chrome/browser/ui/startup/bad_flags_prompt.h" |
| 71 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 71 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 72 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" | 72 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" |
| 73 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" | 73 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" |
| 74 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 74 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 75 #include "chrome/browser/ui/startup/startup_features.h" | |
| 76 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 75 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
| 77 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 76 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 78 #include "chrome/common/chrome_constants.h" | 77 #include "chrome/common/chrome_constants.h" |
| 79 #include "chrome/common/chrome_paths.h" | 78 #include "chrome/common/chrome_paths.h" |
| 80 #include "chrome/common/chrome_result_codes.h" | 79 #include "chrome/common/chrome_result_codes.h" |
| 81 #include "chrome/common/chrome_switches.h" | 80 #include "chrome/common/chrome_switches.h" |
| 82 #include "chrome/common/extensions/extension_constants.h" | 81 #include "chrome/common/extensions/extension_constants.h" |
| 83 #include "chrome/common/extensions/extension_metrics.h" | 82 #include "chrome/common/extensions/extension_metrics.h" |
| 84 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
| 85 #include "chrome/common/url_constants.h" | 84 #include "chrome/common/url_constants.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 extension_id, extensions::ExtensionRegistry::EVERYTHING); | 275 extension_id, extensions::ExtensionRegistry::EVERYTHING); |
| 277 return extension && extension->is_platform_app() ? extension : NULL; | 276 return extension && extension->is_platform_app() ? extension : NULL; |
| 278 } | 277 } |
| 279 | 278 |
| 280 // Appends the contents of |from| to the end of |to|. | 279 // Appends the contents of |from| to the end of |to|. |
| 281 void AppendTabs(const StartupTabs& from, StartupTabs* to) { | 280 void AppendTabs(const StartupTabs& from, StartupTabs* to) { |
| 282 if (!from.empty()) | 281 if (!from.empty()) |
| 283 to->insert(to->end(), from.begin(), from.end()); | 282 to->insert(to->end(), from.begin(), from.end()); |
| 284 } | 283 } |
| 285 | 284 |
| 286 // Determines whether the Consolidated startup flow should be used, based on | 285 // Prevent profiles created in M56 from seeing Welcome page. See |
| 287 // the kUseConsolidatedStartupFlow Feature. Not enabled on Windows 10+. | 286 // crbug.com/704977. |
| 288 bool UseConsolidatedFlow() { | 287 // TODO(tmartino): Remove this in ~M60. |
| 289 #if defined(OS_WIN) | 288 void ProcessErroneousWelcomePagePrefs(Profile* profile) { |
| 290 if (base::win::GetVersion() >= base::win::VERSION_WIN10) | 289 const std::string kVersionErroneousWelcomeFixed = "58.0.0.0"; |
| 291 return base::FeatureList::IsEnabled(features::kEnableWelcomeWin10); | 290 if (profile->WasCreatedByVersionOrLater(kVersionErroneousWelcomeFixed)) |
| 292 #endif // defined(OS_WIN) | 291 return; |
| 293 return base::FeatureList::IsEnabled(features::kUseConsolidatedStartupFlow); | 292 profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, true); |
| 294 } | 293 } |
| 295 | 294 |
| 296 } // namespace | 295 } // namespace |
| 297 | 296 |
| 298 namespace internals { | 297 namespace internals { |
| 299 | 298 |
| 300 GURL GetTriggeredResetSettingsURL() { | 299 GURL GetTriggeredResetSettingsURL() { |
| 301 return GURL( | 300 return GURL( |
| 302 chrome::GetSettingsUrl(chrome::kTriggeredResetProfileSettingsSubPage)); | 301 chrome::GetSettingsUrl(chrome::kTriggeredResetProfileSettingsSubPage)); |
| 303 } | 302 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // URLs in that case. The user should see the window as an app, | 373 // URLs in that case. The user should see the window as an app, |
| 375 // not as chrome. | 374 // not as chrome. |
| 376 // Special case is when app switches are passed but we do want to restore | 375 // Special case is when app switches are passed but we do want to restore |
| 377 // session. In that case open app window + focus it after session is restored. | 376 // session. In that case open app window + focus it after session is restored. |
| 378 if (OpenApplicationWindow(profile)) { | 377 if (OpenApplicationWindow(profile)) { |
| 379 RecordLaunchModeHistogram(LM_AS_WEBAPP); | 378 RecordLaunchModeHistogram(LM_AS_WEBAPP); |
| 380 } else { | 379 } else { |
| 381 RecordLaunchModeHistogram(urls_to_open.empty() ? | 380 RecordLaunchModeHistogram(urls_to_open.empty() ? |
| 382 LM_TO_BE_DECIDED : LM_WITH_URLS); | 381 LM_TO_BE_DECIDED : LM_WITH_URLS); |
| 383 | 382 |
| 384 if (UseConsolidatedFlow()) | 383 if (StartupBrowserCreator::UseConsolidatedFlow()) |
| 385 ProcessLaunchUrlsUsingConsolidatedFlow(process_startup, urls_to_open); | 384 ProcessLaunchUrlsUsingConsolidatedFlow(process_startup, urls_to_open); |
| 386 else | 385 else |
| 387 ProcessLaunchURLs(process_startup, urls_to_open); | 386 ProcessLaunchURLs(process_startup, urls_to_open); |
| 388 | 387 |
| 389 if (command_line_.HasSwitch(switches::kInstallChromeApp)) { | 388 if (command_line_.HasSwitch(switches::kInstallChromeApp)) { |
| 390 install_chrome_app::InstallChromeApp( | 389 install_chrome_app::InstallChromeApp( |
| 391 command_line_.GetSwitchValueASCII(switches::kInstallChromeApp)); | 390 command_line_.GetSwitchValueASCII(switches::kInstallChromeApp)); |
| 392 } | 391 } |
| 393 | 392 |
| 394 // If this is an app launch, but we didn't open an app window, it may | 393 // If this is an app launch, but we didn't open an app window, it may |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 return (app_tab != NULL); | 619 return (app_tab != NULL); |
| 621 } | 620 } |
| 622 | 621 |
| 623 void StartupBrowserCreatorImpl::ProcessLaunchUrlsUsingConsolidatedFlow( | 622 void StartupBrowserCreatorImpl::ProcessLaunchUrlsUsingConsolidatedFlow( |
| 624 bool process_startup, | 623 bool process_startup, |
| 625 const std::vector<GURL>& cmd_line_urls) { | 624 const std::vector<GURL>& cmd_line_urls) { |
| 626 // Don't open any browser windows if starting up in "background mode". | 625 // Don't open any browser windows if starting up in "background mode". |
| 627 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow)) | 626 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow)) |
| 628 return; | 627 return; |
| 629 | 628 |
| 629 ProcessErroneousWelcomePagePrefs(profile_); |
| 630 |
| 630 StartupTabs cmd_line_tabs; | 631 StartupTabs cmd_line_tabs; |
| 631 UrlsToTabs(cmd_line_urls, &cmd_line_tabs); | 632 UrlsToTabs(cmd_line_urls, &cmd_line_tabs); |
| 632 | 633 |
| 633 bool is_incognito_or_guest = | 634 bool is_incognito_or_guest = |
| 634 profile_->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE; | 635 profile_->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE; |
| 635 bool is_post_crash_launch = HasPendingUncleanExit(profile_); | 636 bool is_post_crash_launch = HasPendingUncleanExit(profile_); |
| 636 StartupTabs tabs = | 637 StartupTabs tabs = |
| 637 DetermineStartupTabs(StartupTabProviderImpl(), cmd_line_tabs, | 638 DetermineStartupTabs(StartupTabProviderImpl(), cmd_line_tabs, |
| 638 is_incognito_or_guest, is_post_crash_launch); | 639 is_incognito_or_guest, is_post_crash_launch); |
| 639 | 640 |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 #if defined(OS_WIN) | 1250 #if defined(OS_WIN) |
| 1250 TriggeredProfileResetter* triggered_profile_resetter = | 1251 TriggeredProfileResetter* triggered_profile_resetter = |
| 1251 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1252 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
| 1252 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1253 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
| 1253 if (triggered_profile_resetter) { | 1254 if (triggered_profile_resetter) { |
| 1254 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1255 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
| 1255 } | 1256 } |
| 1256 #endif // defined(OS_WIN) | 1257 #endif // defined(OS_WIN) |
| 1257 return has_reset_trigger; | 1258 return has_reset_trigger; |
| 1258 } | 1259 } |
| OLD | NEW |