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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; | 623 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; |
624 } | 624 } |
625 #endif | 625 #endif |
626 | 626 |
627 std::vector<GURL> adjusted_urls(urls_to_open); | 627 std::vector<GURL> adjusted_urls(urls_to_open); |
628 AddSpecialURLs(&adjusted_urls); | 628 AddSpecialURLs(&adjusted_urls); |
629 | 629 |
630 // The startup code only executes for browsers launched in desktop mode. | 630 // The startup code only executes for browsers launched in desktop mode. |
631 // i.e. HOST_DESKTOP_TYPE_NATIVE. Ash should never get here. | 631 // i.e. HOST_DESKTOP_TYPE_NATIVE. Ash should never get here. |
632 Browser* browser = SessionRestore::RestoreSession( | 632 Browser* browser = SessionRestore::RestoreSession( |
633 profile_, NULL, desktop_type, restore_behavior, adjusted_urls); | 633 profile_, NULL, restore_behavior, adjusted_urls); |
634 | 634 |
635 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 635 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
636 return true; | 636 return true; |
637 } | 637 } |
638 | 638 |
639 Browser* browser = ProcessSpecifiedURLs(urls_to_open, desktop_type); | 639 Browser* browser = ProcessSpecifiedURLs(urls_to_open, desktop_type); |
640 if (!browser) | 640 if (!browser) |
641 return false; | 641 return false; |
642 | 642 |
643 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 643 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 chrome::HostDesktopType desktop_type) { | 737 chrome::HostDesktopType desktop_type) { |
738 DCHECK(!tabs.empty()); | 738 DCHECK(!tabs.empty()); |
739 | 739 |
740 // If we don't yet have a profile, try to use the one we're given from | 740 // If we don't yet have a profile, try to use the one we're given from |
741 // |browser|. While we may not end up actually using |browser| (since it | 741 // |browser|. While we may not end up actually using |browser| (since it |
742 // could be a popup window), we can at least use the profile. | 742 // could be a popup window), we can at least use the profile. |
743 if (!profile_ && browser) | 743 if (!profile_ && browser) |
744 profile_ = browser->profile(); | 744 profile_ = browser->profile(); |
745 | 745 |
746 if (!browser || !browser->is_type_tabbed()) | 746 if (!browser || !browser->is_type_tabbed()) |
747 browser = new Browser(Browser::CreateParams(profile_, desktop_type)); | 747 browser = new Browser(Browser::CreateParams(profile_)); |
748 | 748 |
749 bool first_tab = true; | 749 bool first_tab = true; |
750 ProtocolHandlerRegistry* registry = profile_ ? | 750 ProtocolHandlerRegistry* registry = profile_ ? |
751 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) : NULL; | 751 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) : NULL; |
752 for (size_t i = 0; i < tabs.size(); ++i) { | 752 for (size_t i = 0; i < tabs.size(); ++i) { |
753 // We skip URLs that we'd have to launch an external protocol handler for. | 753 // We skip URLs that we'd have to launch an external protocol handler for. |
754 // This avoids us getting into an infinite loop asking ourselves to open | 754 // This avoids us getting into an infinite loop asking ourselves to open |
755 // a URL, should the handler be (incorrectly) configured to be us. Anyone | 755 // a URL, should the handler be (incorrectly) configured to be us. Anyone |
756 // asking us to open such a URL should really ask the handler directly. | 756 // asking us to open such a URL should really ask the handler directly. |
757 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || | 757 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 #if defined(OS_WIN) | 1017 #if defined(OS_WIN) |
1018 TriggeredProfileResetter* triggered_profile_resetter = | 1018 TriggeredProfileResetter* triggered_profile_resetter = |
1019 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1019 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
1020 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1020 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
1021 if (triggered_profile_resetter) { | 1021 if (triggered_profile_resetter) { |
1022 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1022 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
1023 } | 1023 } |
1024 #endif // defined(OS_WIN) | 1024 #endif // defined(OS_WIN) |
1025 return has_reset_trigger; | 1025 return has_reset_trigger; |
1026 } | 1026 } |
OLD | NEW |