| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 bool process_startup, | 440 bool process_startup, |
| 441 const StartupTabs& tabs) { | 441 const StartupTabs& tabs) { |
| 442 DCHECK(!tabs.empty()); | 442 DCHECK(!tabs.empty()); |
| 443 | 443 |
| 444 // If we don't yet have a profile, try to use the one we're given from | 444 // If we don't yet have a profile, try to use the one we're given from |
| 445 // |browser|. While we may not end up actually using |browser| (since it | 445 // |browser|. While we may not end up actually using |browser| (since it |
| 446 // could be a popup window), we can at least use the profile. | 446 // could be a popup window), we can at least use the profile. |
| 447 if (!profile_ && browser) | 447 if (!profile_ && browser) |
| 448 profile_ = browser->profile(); | 448 profile_ = browser->profile(); |
| 449 | 449 |
| 450 if (!browser || !browser->is_type_tabbed()) | 450 if (!browser || !browser->is_type_tabbed()) { |
| 451 browser = new Browser(Browser::CreateParams(profile_)); | 451 // Startup browsers are not counted as being created by a user_gesture |
| 452 // because of historical accident, even though the startup browser was |
| 453 // created in response to the user clicking on chrome. There was an |
| 454 // incomplete check on whether a user gesture created a window which looked |
| 455 // at the state of the MessageLoop. |
| 456 Browser::CreateParams params = Browser::CreateParams(profile_); |
| 457 params.user_gesture = false; |
| 458 browser = new Browser(params); |
| 459 } |
| 452 | 460 |
| 453 bool first_tab = true; | 461 bool first_tab = true; |
| 454 ProtocolHandlerRegistry* registry = profile_ ? | 462 ProtocolHandlerRegistry* registry = profile_ ? |
| 455 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) : NULL; | 463 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) : NULL; |
| 456 for (size_t i = 0; i < tabs.size(); ++i) { | 464 for (size_t i = 0; i < tabs.size(); ++i) { |
| 457 // We skip URLs that we'd have to launch an external protocol handler for. | 465 // We skip URLs that we'd have to launch an external protocol handler for. |
| 458 // This avoids us getting into an infinite loop asking ourselves to open | 466 // This avoids us getting into an infinite loop asking ourselves to open |
| 459 // a URL, should the handler be (incorrectly) configured to be us. Anyone | 467 // a URL, should the handler be (incorrectly) configured to be us. Anyone |
| 460 // asking us to open such a URL should really ask the handler directly. | 468 // asking us to open such a URL should really ask the handler directly. |
| 461 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || | 469 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 #if defined(OS_WIN) | 1242 #if defined(OS_WIN) |
| 1235 TriggeredProfileResetter* triggered_profile_resetter = | 1243 TriggeredProfileResetter* triggered_profile_resetter = |
| 1236 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); | 1244 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); |
| 1237 // TriggeredProfileResetter instance will be nullptr for incognito profiles. | 1245 // TriggeredProfileResetter instance will be nullptr for incognito profiles. |
| 1238 if (triggered_profile_resetter) { | 1246 if (triggered_profile_resetter) { |
| 1239 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); | 1247 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); |
| 1240 } | 1248 } |
| 1241 #endif // defined(OS_WIN) | 1249 #endif // defined(OS_WIN) |
| 1242 return has_reset_trigger; | 1250 return has_reset_trigger; |
| 1243 } | 1251 } |
| OLD | NEW |