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

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

Issue 2396133002: Adding Pinned Tab and Preferences-specified Tab logic to Startup Flow refactor (Closed)
Patch Set: Autoformatting Created 4 years, 2 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
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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 return distribution_tabs; 654 return distribution_tabs;
655 655
656 // Policies for onboarding (e.g., first run) may show promotional and 656 // Policies for onboarding (e.g., first run) may show promotional and
657 // introductory content depending on a number of system status factors, 657 // introductory content depending on a number of system status factors,
658 // including OS and whether or not this is First Run. 658 // including OS and whether or not this is First Run.
659 StartupTabs onboarding_tabs = provider.GetOnboardingTabs(); 659 StartupTabs onboarding_tabs = provider.GetOnboardingTabs();
660 AppendTabs(onboarding_tabs, &tabs); 660 AppendTabs(onboarding_tabs, &tabs);
661 661
662 // If the user has set the preference indicating URLs to show on opening, 662 // If the user has set the preference indicating URLs to show on opening,
663 // read and add those. 663 // read and add those.
664 StartupTabs prefs_tabs = provider.GetPreferencesTabs(); 664 StartupTabs prefs_tabs = provider.GetPreferencesTabs(command_line_, profile_);
665 AppendTabs(prefs_tabs, &tabs); 665 AppendTabs(prefs_tabs, &tabs);
666 666
667 // Potentially add the New Tab Page. Onboarding content is designed to 667 // Potentially add the New Tab Page. Onboarding content is designed to
668 // replace (and eventually funnel the user to) the NTP. Likewise, URLs read 668 // replace (and eventually funnel the user to) the NTP. Likewise, URLs read
669 // from preferences are explicitly meant to override showing the NTP. 669 // from preferences are explicitly meant to override showing the NTP.
670 if (onboarding_tabs.empty() && prefs_tabs.empty()) 670 if (onboarding_tabs.empty() && prefs_tabs.empty())
671 tabs.emplace_back(GURL(chrome::kChromeUINewTabURL), false); 671 tabs.emplace_back(GURL(chrome::kChromeUINewTabURL), false);
672 672
673 // Add any tabs which the user has previously pinned. 673 // Add any tabs which the user has previously pinned.
674 AppendTabs(provider.GetPinnedTabs(), &tabs); 674 AppendTabs(provider.GetPinnedTabs(profile_), &tabs);
675 675
676 return tabs; 676 return tabs;
677 } 677 }
678 678
679 void StartupBrowserCreatorImpl::AddUniqueURLs(const std::vector<GURL>& urls, 679 void StartupBrowserCreatorImpl::AddUniqueURLs(const std::vector<GURL>& urls,
680 StartupTabs* tabs) { 680 StartupTabs* tabs) {
681 size_t num_existing_tabs = tabs->size(); 681 size_t num_existing_tabs = tabs->size();
682 for (size_t i = 0; i < urls.size(); ++i) { 682 for (size_t i = 0; i < urls.size(); ++i) {
683 bool in_tabs = false; 683 bool in_tabs = false;
684 for (size_t j = 0; j < num_existing_tabs; ++j) { 684 for (size_t j = 0; j < num_existing_tabs; ++j) {
Peter Kasting 2016/10/19 21:17:56 Note: In this CL or a future one, consider applyin
tmartino 2016/10/19 22:01:29 Haven't forgotten about this! However, this is par
685 if (urls[i] == (*tabs)[j].url) { 685 if (urls[i] == (*tabs)[j].url) {
686 in_tabs = true; 686 in_tabs = true;
687 break; 687 break;
688 } 688 }
689 } 689 }
690 if (!in_tabs) { 690 if (!in_tabs) {
691 StartupTab tab; 691 StartupTab tab;
692 tab.is_pinned = false; 692 tab.is_pinned = false;
693 tab.url = urls[i]; 693 tab.url = urls[i];
694 tabs->push_back(tab); 694 tabs->push_back(tab);
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 #if defined(OS_WIN) 1081 #if defined(OS_WIN)
1082 TriggeredProfileResetter* triggered_profile_resetter = 1082 TriggeredProfileResetter* triggered_profile_resetter =
1083 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); 1083 TriggeredProfileResetterFactory::GetForBrowserContext(profile_);
1084 // TriggeredProfileResetter instance will be nullptr for incognito profiles. 1084 // TriggeredProfileResetter instance will be nullptr for incognito profiles.
1085 if (triggered_profile_resetter) { 1085 if (triggered_profile_resetter) {
1086 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); 1086 has_reset_trigger = triggered_profile_resetter->HasResetTrigger();
1087 } 1087 }
1088 #endif // defined(OS_WIN) 1088 #endif // defined(OS_WIN)
1089 return has_reset_trigger; 1089 return has_reset_trigger;
1090 } 1090 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698