Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 2775773003: [Desktop FRE] Do not show Welcome page to profiles created in M56 or M57 (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 PrefService* pref = profile->GetPrefs();
293 if (pref)
Peter Kasting 2017/03/28 21:42:43 Can this conditional ever fail? I don't know why
tmartino 2017/03/29 20:01:05 I was taking a conservative approach, since GetPre
294 pref->SetBoolean(prefs::kHasSeenWelcomePage, true);
294 } 295 }
295 296
296 } // namespace 297 } // namespace
297 298
298 namespace internals { 299 namespace internals {
299 300
300 GURL GetTriggeredResetSettingsURL() { 301 GURL GetTriggeredResetSettingsURL() {
301 return GURL( 302 return GURL(
302 chrome::GetSettingsUrl(chrome::kTriggeredResetProfileSettingsSubPage)); 303 chrome::GetSettingsUrl(chrome::kTriggeredResetProfileSettingsSubPage));
303 } 304 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // URLs in that case. The user should see the window as an app, 375 // URLs in that case. The user should see the window as an app,
375 // not as chrome. 376 // not as chrome.
376 // Special case is when app switches are passed but we do want to restore 377 // 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. 378 // session. In that case open app window + focus it after session is restored.
378 if (OpenApplicationWindow(profile)) { 379 if (OpenApplicationWindow(profile)) {
379 RecordLaunchModeHistogram(LM_AS_WEBAPP); 380 RecordLaunchModeHistogram(LM_AS_WEBAPP);
380 } else { 381 } else {
381 RecordLaunchModeHistogram(urls_to_open.empty() ? 382 RecordLaunchModeHistogram(urls_to_open.empty() ?
382 LM_TO_BE_DECIDED : LM_WITH_URLS); 383 LM_TO_BE_DECIDED : LM_WITH_URLS);
383 384
384 if (UseConsolidatedFlow()) 385 if (StartupBrowserCreator::UseConsolidatedFlow())
385 ProcessLaunchUrlsUsingConsolidatedFlow(process_startup, urls_to_open); 386 ProcessLaunchUrlsUsingConsolidatedFlow(process_startup, urls_to_open);
386 else 387 else
387 ProcessLaunchURLs(process_startup, urls_to_open); 388 ProcessLaunchURLs(process_startup, urls_to_open);
388 389
389 if (command_line_.HasSwitch(switches::kInstallChromeApp)) { 390 if (command_line_.HasSwitch(switches::kInstallChromeApp)) {
390 install_chrome_app::InstallChromeApp( 391 install_chrome_app::InstallChromeApp(
391 command_line_.GetSwitchValueASCII(switches::kInstallChromeApp)); 392 command_line_.GetSwitchValueASCII(switches::kInstallChromeApp));
392 } 393 }
393 394
394 // If this is an app launch, but we didn't open an app window, it may 395 // 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
620 return (app_tab != NULL); 621 return (app_tab != NULL);
621 } 622 }
622 623
623 void StartupBrowserCreatorImpl::ProcessLaunchUrlsUsingConsolidatedFlow( 624 void StartupBrowserCreatorImpl::ProcessLaunchUrlsUsingConsolidatedFlow(
624 bool process_startup, 625 bool process_startup,
625 const std::vector<GURL>& cmd_line_urls) { 626 const std::vector<GURL>& cmd_line_urls) {
626 // Don't open any browser windows if starting up in "background mode". 627 // Don't open any browser windows if starting up in "background mode".
627 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow)) 628 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow))
628 return; 629 return;
629 630
631 ProcessErroneousWelcomePagePrefs(profile_);
632
630 StartupTabs cmd_line_tabs; 633 StartupTabs cmd_line_tabs;
631 UrlsToTabs(cmd_line_urls, &cmd_line_tabs); 634 UrlsToTabs(cmd_line_urls, &cmd_line_tabs);
632 635
633 bool is_incognito_or_guest = 636 bool is_incognito_or_guest =
634 profile_->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE; 637 profile_->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE;
635 bool is_post_crash_launch = HasPendingUncleanExit(profile_); 638 bool is_post_crash_launch = HasPendingUncleanExit(profile_);
636 StartupTabs tabs = 639 StartupTabs tabs =
637 DetermineStartupTabs(StartupTabProviderImpl(), cmd_line_tabs, 640 DetermineStartupTabs(StartupTabProviderImpl(), cmd_line_tabs,
638 is_incognito_or_guest, is_post_crash_launch); 641 is_incognito_or_guest, is_post_crash_launch);
639 642
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 #if defined(OS_WIN) 1252 #if defined(OS_WIN)
1250 TriggeredProfileResetter* triggered_profile_resetter = 1253 TriggeredProfileResetter* triggered_profile_resetter =
1251 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); 1254 TriggeredProfileResetterFactory::GetForBrowserContext(profile_);
1252 // TriggeredProfileResetter instance will be nullptr for incognito profiles. 1255 // TriggeredProfileResetter instance will be nullptr for incognito profiles.
1253 if (triggered_profile_resetter) { 1256 if (triggered_profile_resetter) {
1254 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); 1257 has_reset_trigger = triggered_profile_resetter->HasResetTrigger();
1255 } 1258 }
1256 #endif // defined(OS_WIN) 1259 #endif // defined(OS_WIN)
1257 return has_reset_trigger; 1260 return has_reset_trigger;
1258 } 1261 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698