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

Unified Diff: chrome/browser/ui/ash/chrome_shell_content_state.cc

Issue 2615663002: Fix MediaClient::RequestCaptureState(). (Closed)
Patch Set: ash Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/chrome_shell_content_state.cc
diff --git a/chrome/browser/ui/ash/chrome_shell_content_state.cc b/chrome/browser/ui/ash/chrome_shell_content_state.cc
index 4de2fe820ffdc90203871ca1d4423510ff36cd99..1900dc243ed805f8c49adbac0d741c6c775106ef 100644
--- a/chrome/browser/ui/ash/chrome_shell_content_state.cc
+++ b/chrome/browser/ui/ash/chrome_shell_content_state.cc
@@ -9,8 +9,35 @@
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_context.h"
-ChromeShellContentState::ChromeShellContentState() {}
-ChromeShellContentState::~ChromeShellContentState() {}
+// static
+ChromeShellContentState* ChromeShellContentState::instance_ = nullptr;
+
+// static
+void ChromeShellContentState::SetInstance(ChromeShellContentState* instance) {
+ DCHECK(!instance_);
+ instance_ = instance;
+}
+
+// static
+ChromeShellContentState* ChromeShellContentState::GetInstance() {
+ DCHECK(instance_);
+ return instance_;
+}
+
+// static
+void ChromeShellContentState::DestroyInstance() {
+ DCHECK(instance_);
+ delete instance_;
+ instance_ = nullptr;
+}
+
+ChromeShellContentState::ChromeShellContentState() {
+ SetInstance(this);
+}
+
+ChromeShellContentState::~ChromeShellContentState() {
+ DestroyInstance();
James Cook 2017/01/09 21:07:19 optional: I like to do this: DCHECK_EQ(this, g_in
riajiang 2017/01/09 23:46:51 Done.
+}
content::BrowserContext* ChromeShellContentState::GetActiveBrowserContext() {
DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size());

Powered by Google App Engine
This is Rietveld 408576698