| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // If we don't yet have a profile, try to use the one we're given from | 417 // If we don't yet have a profile, try to use the one we're given from |
| 418 // |browser|. While we may not end up actually using |browser| (since it | 418 // |browser|. While we may not end up actually using |browser| (since it |
| 419 // could be a popup window), we can at least use the profile. | 419 // could be a popup window), we can at least use the profile. |
| 420 if (!profile_ && browser) | 420 if (!profile_ && browser) |
| 421 profile_ = browser->profile(); | 421 profile_ = browser->profile(); |
| 422 | 422 |
| 423 if (!browser || !browser->is_type_tabbed()) | 423 if (!browser || !browser->is_type_tabbed()) |
| 424 browser = new Browser(Browser::CreateParams(profile_)); | 424 browser = new Browser(Browser::CreateParams(profile_)); |
| 425 | 425 |
| 426 bool first_tab = true; | 426 bool first_tab = true; |
| 427 ProtocolHandlerRegistry* registry = profile_ ? | 427 ProtocolHandlerRegistry* web_based_protocol_handlers = |
| 428 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) : NULL; | 428 profile_ ? ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) |
| 429 : NULL; |
| 429 for (size_t i = 0; i < tabs.size(); ++i) { | 430 for (size_t i = 0; i < tabs.size(); ++i) { |
| 430 // We skip URLs that we'd have to launch an external protocol handler for. | 431 // We skip URLs that we'd have to launch an external protocol handler for. |
| 431 // This avoids us getting into an infinite loop asking ourselves to open | 432 // This avoids us getting into an infinite loop asking ourselves to open |
| 432 // a URL, should the handler be (incorrectly) configured to be us. Anyone | 433 // a URL, should the handler be (incorrectly) configured to be us. Anyone |
| 433 // asking us to open such a URL should really ask the handler directly. | 434 // asking us to open such a URL should really ask the handler directly. |
| 434 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || | 435 bool handled_by_chrome = |
| 435 (registry && registry->IsHandledProtocol(tabs[i].url.scheme())); | 436 ProfileIOData::HasBuiltInProtocol(tabs[i].url) || |
| 437 (web_based_protocol_handlers && |
| 438 web_based_protocol_handlers->IsHandledProtocol(tabs[i].url.scheme())); |
| 436 if (!process_startup && !handled_by_chrome) | 439 if (!process_startup && !handled_by_chrome) |
| 437 continue; | 440 continue; |
| 438 | 441 |
| 439 int add_types = first_tab ? TabStripModel::ADD_ACTIVE : | 442 int add_types = first_tab ? TabStripModel::ADD_ACTIVE : |
| 440 TabStripModel::ADD_NONE; | 443 TabStripModel::ADD_NONE; |
| 441 add_types |= TabStripModel::ADD_FORCE_INDEX; | 444 add_types |= TabStripModel::ADD_FORCE_INDEX; |
| 442 if (tabs[i].is_pinned) | 445 if (tabs[i].is_pinned) |
| 443 add_types |= TabStripModel::ADD_PINNED; | 446 add_types |= TabStripModel::ADD_PINNED; |
| 444 | 447 |
| 445 chrome::NavigateParams params(browser, tabs[i].url, | 448 chrome::NavigateParams params(browser, tabs[i].url, |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 #if defined(OS_WIN) | 1085 #if defined(OS_WIN) |
| 1083 TriggeredProfileResetter* triggered_profile_resetter = | 1086 TriggeredProfileResetter* triggered_profile_resetter = |
| 1084 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1087 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
| 1085 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1088 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
| 1086 if (triggered_profile_resetter) { | 1089 if (triggered_profile_resetter) { |
| 1087 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1090 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
| 1088 } | 1091 } |
| 1089 #endif // defined(OS_WIN) | 1092 #endif // defined(OS_WIN) |
| 1090 return has_reset_trigger; | 1093 return has_reset_trigger; |
| 1091 } | 1094 } |
| OLD | NEW |