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

Unified Diff: ash/launcher/launcher_delegate_proxy.cc

Issue 22429004: Refactor LauncherDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 4 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: ash/launcher/launcher_delegate_proxy.cc
diff --git a/ash/launcher/launcher_delegate_proxy.cc b/ash/launcher/launcher_delegate_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1f6ac84a92f27471d653a3c76e89d7ea8975298e
--- /dev/null
+++ b/ash/launcher/launcher_delegate_proxy.cc
@@ -0,0 +1,74 @@
+// 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 "ash/launcher/launcher_delegate_proxy.h"
+
+#include "ash/launcher/app_list_launcher_item_delegate.h"
+#include "ash/shell.h"
+#include "ash/shell_delegate.h"
+#include "ui/aura/window.h"
+
+namespace ash {
+namespace internal {
+
+LauncherDelegateProxy::LauncherDelegateProxy() {
+ DCHECK(Shell::GetInstance()->launcher_model());
+ chrome_launcher_delegate_.reset(
+ Shell::GetInstance()->delegate()->CreateLauncherDelegate(
+ Shell::GetInstance()->launcher_model()));
+
+ app_list_launcher_item_delegate_.reset(new AppListLauncherItemDelegate);
+}
+
+LauncherDelegateProxy::~LauncherDelegateProxy() {
+}
+
+ash::LauncherID LauncherDelegateProxy::GetIDByWindow(aura::Window* window) {
+ return chrome_launcher_delegate_->GetIDByWindow(window);
+}
+
+void LauncherDelegateProxy::OnLauncherCreated(Launcher* launcher) {
+ chrome_launcher_delegate_->OnLauncherCreated(launcher);
+}
+
+void LauncherDelegateProxy::OnLauncherDestroyed(Launcher* launcher) {
+ chrome_launcher_delegate_->OnLauncherDestroyed(launcher);
+}
+
+LauncherID LauncherDelegateProxy::GetLauncherIDForAppID(
+ const std::string& app_id) {
+ return chrome_launcher_delegate_->GetLauncherIDForAppID(app_id);
+}
+
+void LauncherDelegateProxy::PinAppWithID(const std::string& app_id) {
+ chrome_launcher_delegate_->PinAppWithID(app_id);
+}
+
+bool LauncherDelegateProxy::IsAppPinned(const std::string& app_id) {
+ return chrome_launcher_delegate_->IsAppPinned(app_id);
+}
+
+void LauncherDelegateProxy::UnpinAppsWithID(const std::string& app_id) {
+ chrome_launcher_delegate_->UnpinAppsWithID(app_id);
+}
+
+LauncherItemDelegate* LauncherDelegateProxy::GetLauncherItemDelegate(
+ const LauncherItem& item) {
+ switch(item.type) {
+ case TYPE_TABBED:
+ case TYPE_APP_PANEL:
+ case TYPE_APP_SHORTCUT:
+ case TYPE_BROWSER_SHORTCUT:
+ case TYPE_PLATFORM_APP:
+ case TYPE_WINDOWED_APP:
+ return chrome_launcher_delegate_->GetLauncherItemDelegate(item);
+ case TYPE_APP_LIST:
+ return app_list_launcher_item_delegate_.get();
+ }
+ NOTREACHED();
+ return NULL;
+}
+
+} // namespace internal
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698