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

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

Issue 2685333005: ash: fix regression where ctrl+n put new window on wrong desktop (Closed)
Patch Set: rebase to tot Created 3 years, 10 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 using web_modal::WebContentsModalDialogManager; 243 using web_modal::WebContentsModalDialogManager;
244 using blink::WebWindowFeatures; 244 using blink::WebWindowFeatures;
245 245
246 /////////////////////////////////////////////////////////////////////////////// 246 ///////////////////////////////////////////////////////////////////////////////
247 247
248 namespace { 248 namespace {
249 249
250 // How long we wait before updating the browser chrome while loading a page. 250 // How long we wait before updating the browser chrome while loading a page.
251 const int kUIUpdateCoalescingTimeMS = 200; 251 const int kUIUpdateCoalescingTimeMS = 200;
252 252
253 BrowserWindow* CreateBrowserWindow(Browser* browser) { 253 BrowserWindow* CreateBrowserWindow(Browser* browser, bool user_gesture) {
254 return BrowserWindow::CreateBrowserWindow(browser); 254 return BrowserWindow::CreateBrowserWindow(browser, user_gesture);
255 } 255 }
256 256
257 // Is the fast tab unload experiment enabled? 257 // Is the fast tab unload experiment enabled?
258 bool IsFastTabUnloadEnabled() { 258 bool IsFastTabUnloadEnabled() {
259 return base::CommandLine::ForCurrentProcess()->HasSwitch( 259 return base::CommandLine::ForCurrentProcess()->HasSwitch(
260 switches::kEnableFastUnload); 260 switches::kEnableFastUnload);
261 } 261 }
262 262
263 const extensions::Extension* GetExtensionForOrigin( 263 const extensions::Extension* GetExtensionForOrigin(
264 Profile* profile, 264 Profile* profile,
(...skipping 16 matching lines...) Expand all
281 281
282 //////////////////////////////////////////////////////////////////////////////// 282 ////////////////////////////////////////////////////////////////////////////////
283 // Browser, CreateParams: 283 // Browser, CreateParams:
284 284
285 Browser::CreateParams::CreateParams(Profile* profile) 285 Browser::CreateParams::CreateParams(Profile* profile)
286 : type(TYPE_TABBED), 286 : type(TYPE_TABBED),
287 profile(profile), 287 profile(profile),
288 trusted_source(false), 288 trusted_source(false),
289 initial_show_state(ui::SHOW_STATE_DEFAULT), 289 initial_show_state(ui::SHOW_STATE_DEFAULT),
290 is_session_restore(false), 290 is_session_restore(false),
291 user_gesture(true),
291 window(NULL) {} 292 window(NULL) {}
292 293
293 Browser::CreateParams::CreateParams(Type type, Profile* profile) 294 Browser::CreateParams::CreateParams(Type type, Profile* profile)
294 : type(type), 295 : type(type),
295 profile(profile), 296 profile(profile),
296 trusted_source(false), 297 trusted_source(false),
297 initial_show_state(ui::SHOW_STATE_DEFAULT), 298 initial_show_state(ui::SHOW_STATE_DEFAULT),
298 is_session_restore(false), 299 is_session_restore(false),
300 user_gesture(true),
299 window(NULL) {} 301 window(NULL) {}
300 302
301 Browser::CreateParams::CreateParams(const CreateParams& other) = default; 303 Browser::CreateParams::CreateParams(const CreateParams& other) = default;
302 304
303 // static 305 // static
304 Browser::CreateParams Browser::CreateParams::CreateForApp( 306 Browser::CreateParams Browser::CreateParams::CreateForApp(
305 const std::string& app_name, 307 const std::string& app_name,
306 bool trusted_source, 308 bool trusted_source,
307 const gfx::Rect& window_bounds, 309 const gfx::Rect& window_bounds,
308 Profile* profile) { 310 Profile* profile) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 433
432 if (extensions::HostedAppBrowserController::IsForHostedApp(this)) { 434 if (extensions::HostedAppBrowserController::IsForHostedApp(this)) {
433 hosted_app_controller_.reset( 435 hosted_app_controller_.reset(
434 new extensions::HostedAppBrowserController(this)); 436 new extensions::HostedAppBrowserController(this));
435 } 437 }
436 438
437 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT); 439 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT);
438 440
439 ProfileMetrics::LogProfileLaunch(profile_); 441 ProfileMetrics::LogProfileLaunch(profile_);
440 442
441 window_ = params.window ? params.window : CreateBrowserWindow(this); 443 window_ = params.window ? params.window
444 : CreateBrowserWindow(this, params.user_gesture);
442 445
443 if (hosted_app_controller_) 446 if (hosted_app_controller_)
444 hosted_app_controller_->UpdateLocationBarVisibility(false); 447 hosted_app_controller_->UpdateLocationBarVisibility(false);
445 448
446 // Create the extension window controller before sending notifications. 449 // Create the extension window controller before sending notifications.
447 extension_window_controller_.reset( 450 extension_window_controller_.reset(
448 new BrowserExtensionWindowController(this)); 451 new BrowserExtensionWindowController(this));
449 452
450 SessionService* session_service = 453 SessionService* session_service =
451 SessionServiceFactory::GetForProfileForSessionRestore(profile_); 454 SessionServiceFactory::GetForProfileForSessionRestore(profile_);
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 // new window later, thus we need to navigate the window now. 2623 // new window later, thus we need to navigate the window now.
2621 if (contents) { 2624 if (contents) {
2622 contents->web_contents()->GetController().LoadURL( 2625 contents->web_contents()->GetController().LoadURL(
2623 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, 2626 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
2624 std::string()); // No extra headers. 2627 std::string()); // No extra headers.
2625 } 2628 }
2626 } 2629 }
2627 2630
2628 return contents != NULL; 2631 return contents != NULL;
2629 } 2632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698