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

Unified Diff: chrome/browser/apps/chrome_apps_client.cc

Issue 23524005: Introduce AppsClient and use it in apps to get the loaded profiles list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile, self nits Created 7 years, 3 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/apps/chrome_apps_client.cc
diff --git a/chrome/browser/apps/chrome_apps_client.cc b/chrome/browser/apps/chrome_apps_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..766a4dbfb25c6120304bfe9e6521f8fd110c6b31
--- /dev/null
+++ b/chrome/browser/apps/chrome_apps_client.cc
@@ -0,0 +1,28 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/apps/chrome_apps_client.h"
+
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile_manager.h"
+
+static base::LazyInstance<ChromeAppsClient> g_client =
tapted 2013/09/04 01:17:53 BTW, I think you can use leaky traits (singleton o
benwells 2013/09/10 16:48:50 Done.
+ LAZY_INSTANCE_INITIALIZER;
+
+ChromeAppsClient::ChromeAppsClient() {}
+
+ChromeAppsClient::~ChromeAppsClient() {}
+
+std::vector<content::BrowserContext*>
+ ChromeAppsClient::GetLoadedBrowserContexts() {
+ std::vector<Profile*> profiles =
+ g_browser_process->profile_manager()->GetLoadedProfiles();
+ return std::vector<content::BrowserContext*>(profiles.begin(),
+ profiles.end());
+}
+
+// static
+ChromeAppsClient* ChromeAppsClient::GetInstance() {
+ return g_client.Pointer();
+}

Powered by Google App Engine
This is Rietveld 408576698