| 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/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 "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 14 | 14 |
| 15 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
| 16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 18 #include "components/signin/core/account_id/account_id.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 using content::WebContents; | 21 using content::WebContents; |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 | 25 |
| 25 // Type used to indicate to match anything. | 26 // Type used to indicate to match anything. |
| 26 const int kMatchAny = 0; | 27 const int kMatchAny = 0; |
| 27 | 28 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 47 return false; | 48 return false; |
| 48 } | 49 } |
| 49 | 50 |
| 50 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
| 51 // Get the profile on which the window is currently shown. | 52 // Get the profile on which the window is currently shown. |
| 52 // MultiUserWindowManager might be NULL under test scenario. | 53 // MultiUserWindowManager might be NULL under test scenario. |
| 53 chrome::MultiUserWindowManager* const window_manager = | 54 chrome::MultiUserWindowManager* const window_manager = |
| 54 chrome::MultiUserWindowManager::GetInstance(); | 55 chrome::MultiUserWindowManager::GetInstance(); |
| 55 Profile* shown_profile = nullptr; | 56 Profile* shown_profile = nullptr; |
| 56 if (window_manager) { | 57 if (window_manager) { |
| 57 const std::string& shown_user_id = window_manager->GetUserPresentingWindow( | 58 const AccountId& shown_account_id = window_manager->GetUserPresentingWindow( |
| 58 browser->window()->GetNativeWindow()); | 59 browser->window()->GetNativeWindow()); |
| 59 shown_profile = shown_user_id.empty() | 60 shown_profile = |
| 60 ? nullptr | 61 shown_account_id.is_valid() |
| 61 : multi_user_util::GetProfileFromUserID(shown_user_id); | 62 ? multi_user_util::GetProfileFromAccountId(shown_account_id) |
| 63 : nullptr; |
| 62 } | 64 } |
| 63 #endif | 65 #endif |
| 64 | 66 |
| 65 if (match_types & kMatchOriginalProfile) { | 67 if (match_types & kMatchOriginalProfile) { |
| 66 if (browser->profile()->GetOriginalProfile() != | 68 if (browser->profile()->GetOriginalProfile() != |
| 67 profile->GetOriginalProfile()) | 69 profile->GetOriginalProfile()) |
| 68 return false; | 70 return false; |
| 69 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
| 70 if (shown_profile && | 72 if (shown_profile && |
| 71 shown_profile->GetOriginalProfile() != profile->GetOriginalProfile()) { | 73 shown_profile->GetOriginalProfile() != profile->GetOriginalProfile()) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 235 |
| 234 size_t GetBrowserCount(Profile* profile, HostDesktopType type) { | 236 size_t GetBrowserCount(Profile* profile, HostDesktopType type) { |
| 235 return GetBrowserCountImpl(profile, type, kMatchAny); | 237 return GetBrowserCountImpl(profile, type, kMatchAny); |
| 236 } | 238 } |
| 237 | 239 |
| 238 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type) { | 240 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type) { |
| 239 return GetBrowserCountImpl(profile, type, kMatchTabbed); | 241 return GetBrowserCountImpl(profile, type, kMatchTabbed); |
| 240 } | 242 } |
| 241 | 243 |
| 242 } // namespace chrome | 244 } // namespace chrome |
| OLD | NEW |