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

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

Issue 1954853002: When user presses Ctrl-N, we should use the current active window's profile to determine on which p… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test. Created 4 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ash/chrome_new_window_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_new_window_delegate.h"
6 6
7 #include "ash/wm/window_util.h" 7 #include "ash/wm/window_util.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/sessions/tab_restore_service_factory.h" 10 #include "chrome/browser/sessions/tab_restore_service_factory.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 chrome::ScopedTabbedBrowserDisplayer displayer( 90 chrome::ScopedTabbedBrowserDisplayer displayer(
91 ProfileManager::GetActiveUserProfile()); 91 ProfileManager::GetActiveUserProfile());
92 browser = displayer.browser(); 92 browser = displayer.browser();
93 chrome::NewTab(browser); 93 chrome::NewTab(browser);
94 } 94 }
95 95
96 browser->SetFocusToLocationBar(false); 96 browser->SetFocusToLocationBar(false);
97 } 97 }
98 98
99 void ChromeNewWindowDelegate::NewWindow(bool is_incognito) { 99 void ChromeNewWindowDelegate::NewWindow(bool is_incognito) {
100 Profile* profile = ProfileManager::GetActiveUserProfile(); 100 Profile* profile;
101 Browser* browser = GetBrowserForActiveWindow();
102 if (browser && browser->profile())
103 profile = browser->profile();
104 else
105 profile = ProfileManager::GetActiveUserProfile();
oshima 2016/05/06 18:44:14 optional: conditional operator?
xdai1 2016/05/06 20:25:32 Done.
101 chrome::NewEmptyWindow(is_incognito ? profile->GetOffTheRecordProfile() 106 chrome::NewEmptyWindow(is_incognito ? profile->GetOffTheRecordProfile()
102 : profile); 107 : profile);
103 } 108 }
104 109
105 void ChromeNewWindowDelegate::RestoreTab() { 110 void ChromeNewWindowDelegate::RestoreTab() {
106 if (tab_restore_helper_.get()) { 111 if (tab_restore_helper_.get()) {
107 DCHECK(!tab_restore_helper_->tab_restore_service()->IsLoaded()); 112 DCHECK(!tab_restore_helper_->tab_restore_service()->IsLoaded());
108 return; 113 return;
109 } 114 }
110 115
(...skipping 16 matching lines...) Expand all
127 } 132 }
128 } 133 }
129 134
130 void ChromeNewWindowDelegate::ShowTaskManager() { 135 void ChromeNewWindowDelegate::ShowTaskManager() {
131 chrome::OpenTaskManager(NULL); 136 chrome::OpenTaskManager(NULL);
132 } 137 }
133 138
134 void ChromeNewWindowDelegate::OpenFeedbackPage() { 139 void ChromeNewWindowDelegate::OpenFeedbackPage() {
135 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow()); 140 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow());
136 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698