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

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

Issue 2685333005: ash: fix regression where ctrl+n put new window on wrong desktop (Closed)
Patch Set: Rebase to ToT Created 3 years, 9 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_, false);
457 browser = new Browser(params);
458 }
452 459
453 bool first_tab = true; 460 bool first_tab = true;
454 ProtocolHandlerRegistry* registry = profile_ ? 461 ProtocolHandlerRegistry* registry = profile_ ?
455 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) : NULL; 462 ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_) : NULL;
456 for (size_t i = 0; i < tabs.size(); ++i) { 463 for (size_t i = 0; i < tabs.size(); ++i) {
457 // We skip URLs that we'd have to launch an external protocol handler for. 464 // 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 465 // 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 466 // 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. 467 // asking us to open such a URL should really ask the handler directly.
461 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || 468 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) ||
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 #if defined(OS_WIN) 1249 #if defined(OS_WIN)
1243 TriggeredProfileResetter* triggered_profile_resetter = 1250 TriggeredProfileResetter* triggered_profile_resetter =
1244 TriggeredProfileResetterFactory::GetForBrowserContext(profile_); 1251 TriggeredProfileResetterFactory::GetForBrowserContext(profile_);
1245 // TriggeredProfileResetter instance will be nullptr for incognito profiles. 1252 // TriggeredProfileResetter instance will be nullptr for incognito profiles.
1246 if (triggered_profile_resetter) { 1253 if (triggered_profile_resetter) {
1247 has_reset_trigger = triggered_profile_resetter->HasResetTrigger(); 1254 has_reset_trigger = triggered_profile_resetter->HasResetTrigger();
1248 } 1255 }
1249 #endif // defined(OS_WIN) 1256 #endif // defined(OS_WIN)
1250 return has_reset_trigger; 1257 return has_reset_trigger;
1251 } 1258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698