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

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

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/browser_finder.h" 5 #include "chrome/browser/ui/browser_finder.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser_iterator.h" 8 #include "chrome/browser/ui/browser_iterator.h"
9 #include "chrome/browser/ui/browser_list.h" 9 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "components/user_manager/user_id.h"
13 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
14 15
15 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 17 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 18 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
18 #endif 19 #endif
19 20
20 using content::WebContents; 21 using content::WebContents;
21 22
22 namespace { 23 namespace {
(...skipping 24 matching lines...) Expand all
47 return false; 48 return false;
48 } 49 }
49 50
50 bool matches_profile = browser->profile() == profile; 51 bool matches_profile = browser->profile() == profile;
51 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
52 // Get the profile on which the window is currently shown. 53 // Get the profile on which the window is currently shown.
53 // MultiUserWindowManager might be NULL under test scenario. 54 // MultiUserWindowManager might be NULL under test scenario.
54 chrome::MultiUserWindowManager* const window_manager = 55 chrome::MultiUserWindowManager* const window_manager =
55 chrome::MultiUserWindowManager::GetInstance(); 56 chrome::MultiUserWindowManager::GetInstance();
56 if (window_manager) { 57 if (window_manager) {
57 const std::string& shown_user_id = window_manager->GetUserPresentingWindow( 58 const user_manager::UserID& shown_user_id = window_manager->GetUserPresentin gWindow(
58 browser->window()->GetNativeWindow()); 59 browser->window()->GetNativeWindow());
59 Profile* shown_profile = 60 Profile* shown_profile =
60 shown_user_id.empty() 61 shown_user_id.empty()
61 ? nullptr 62 ? nullptr
62 : multi_user_util::GetProfileFromUserID(shown_user_id); 63 : multi_user_util::GetProfileFromUserID(shown_user_id);
63 matches_profile &= !shown_profile || shown_profile == profile; 64 matches_profile &= !shown_profile || shown_profile == profile;
64 } 65 }
65 #endif 66 #endif
66 67
67 if (match_types & kMatchOriginalProfile) { 68 if (match_types & kMatchOriginalProfile) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 225
225 size_t GetBrowserCount(Profile* profile, HostDesktopType type) { 226 size_t GetBrowserCount(Profile* profile, HostDesktopType type) {
226 return GetBrowserCountImpl(profile, type, kMatchAny); 227 return GetBrowserCountImpl(profile, type, kMatchAny);
227 } 228 }
228 229
229 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type) { 230 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type) {
230 return GetBrowserCountImpl(profile, type, kMatchTabbed); 231 return GetBrowserCountImpl(profile, type, kMatchTabbed);
231 } 232 }
232 233
233 } // namespace chrome 234 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698