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

Unified Diff: chrome/browser/ui/ash/app_list/app_list_service_ash.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: stray newline 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/ash/app_list/app_list_service_ash.cc
diff --git a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6307b401aba25062602c9e9802960bdcb5ae9ea2
--- /dev/null
+++ b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc
@@ -0,0 +1,53 @@
+// 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_ash.h"
+
+#include "ash/shell.h"
+#include "base/memory/singleton.h"
+#include "chrome/browser/ui/app_list/app_list_service_ash.h"
tapted 2013/02/20 04:15:07 oops - just noticed this is a dupe - removed.
+
+namespace {
+
+class AppListServiceAshImpl : public AppListServiceAsh {
benwells 2013/02/19 07:34:28 Why have the impl class? It would be more transpar
tapted 2013/02/20 04:15:07 I went this route to minimise the cross-directory
+ public:
+ static AppListServiceAshImpl* GetInstance() {
+ return Singleton<AppListServiceAshImpl>::get();
+ }
+
+ // AppListService overrides:
+ virtual void ShowAppList(Profile* default_profile) OVERRIDE;
+ virtual bool IsAppListVisible() const OVERRIDE;
+ virtual void DismissAppList() OVERRIDE;
+
+ private:
+ AppListServiceAshImpl() {}
+
+ friend struct DefaultSingletonTraits<AppListServiceAshImpl>;
+
+ DISALLOW_COPY_AND_ASSIGN(AppListServiceAshImpl);
+};
+
+void AppListServiceAshImpl::ShowAppList(Profile* default_profile) {
+ // This may not work correctly if the profile passed in is different from the
+ // one the ash Shell is currently using.
+ // TODO(ananta): Handle profile changes correctly when !defined(OS_CHROMEOS).
+ if (!IsAppListVisible())
+ ash::Shell::GetInstance()->ToggleAppList(NULL);
+}
+
+bool AppListServiceAshImpl::IsAppListVisible() const {
+ return ash::Shell::GetInstance()->GetAppListTargetVisibility();
+}
+
+void AppListServiceAshImpl::DismissAppList() {
+ if (IsAppListVisible())
+ ash::Shell::GetInstance()->ToggleAppList(NULL);
+}
+
+} // namespace
+
+AppListServiceAsh* AppListServiceAsh::GetInstance() {
+ return AppListServiceAshImpl::GetInstance();
+}

Powered by Google App Engine
This is Rietveld 408576698