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

Unified Diff: chrome/browser/ui/app_list/app_list_service_selector.cc

Issue 12207104: Refactor app_list_util.h into AppListService abstract base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: alternative to intermediate class Created 7 years, 10 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/app_list/app_list_service_selector.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_selector.cc b/chrome/browser/ui/app_list/app_list_service_selector.cc
new file mode 100644
index 0000000000000000000000000000000000000000..98213d8ffa135ddb03b95c3eadeee939e3d66abf
--- /dev/null
+++ b/chrome/browser/ui/app_list/app_list_service_selector.cc
@@ -0,0 +1,46 @@
+// 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/ui/app_list/app_list_service.h"
+#include "chrome/browser/ui/host_desktop.h"
+
+#if defined(USE_ASH)
+#include "chrome/browser/ui/app_list/app_list_service_ash.h"
+#endif
+
+#if defined(OS_WIN)
+#include "chrome/browser/ui/app_list/app_list_service_win.h"
+#endif
+
+#if defined(OS_MACOSX)
+#include "chrome/browser/ui/app_list/app_list_service_cocoa.h"
+#endif
+
+// static
+AppListService* AppListService::Get() {
+#if defined(USE_ASH) && defined(OS_WIN)
+ if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
+ return chrome::GetAppListServiceAsh();
+#endif
+
+#if defined(OS_WIN)
+ return chrome::GetAppListServiceWin();
+#elif defined(OS_MACOSX)
+ return chrome::GetAppListServiceCocoa();
+#elif defined(OS_CHROMEOS)
+ return chrome::GetAppListServiceAsh();
+#else
+#error "ENABLE_APP_LIST defined, but no controller available"
+#endif
+}
+
+// static
+void AppListService::InitAll(Profile* initial_profile) {
+#if defined(USE_ASH) && defined(OS_WIN)
+ chrome::GetAppListServiceAsh()->Init(initial_profile);
+ chrome::GetAppListServiceWin()->Init(initial_profile);
+#else
+ Get()->Init(initial_profile);
+#endif
+}

Powered by Google App Engine
This is Rietveld 408576698