OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_shell_content_state.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_content_state.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "components/user_manager/user_manager.h" | 9 #include "components/user_manager/user_manager.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
11 | 11 |
12 ChromeShellContentState::ChromeShellContentState() {} | 12 namespace { |
13 ChromeShellContentState::~ChromeShellContentState() {} | 13 |
| 14 ChromeShellContentState* g_instance = nullptr; |
| 15 |
| 16 } // namespace |
| 17 |
| 18 // static |
| 19 ChromeShellContentState* ChromeShellContentState::GetInstance() { |
| 20 DCHECK(g_instance); |
| 21 return g_instance; |
| 22 } |
| 23 |
| 24 ChromeShellContentState::ChromeShellContentState() { |
| 25 DCHECK(!g_instance); |
| 26 g_instance = this; |
| 27 } |
| 28 |
| 29 ChromeShellContentState::~ChromeShellContentState() { |
| 30 DCHECK_EQ(this, g_instance); |
| 31 g_instance = nullptr; |
| 32 } |
14 | 33 |
15 content::BrowserContext* ChromeShellContentState::GetActiveBrowserContext() { | 34 content::BrowserContext* ChromeShellContentState::GetActiveBrowserContext() { |
16 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size()); | 35 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size()); |
17 return ProfileManager::GetActiveUserProfile(); | 36 return ProfileManager::GetActiveUserProfile(); |
18 } | 37 } |
OLD | NEW |