| 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..ae6880375071a1549f709b35c65603833c9bac35
|
| --- /dev/null
|
| +++ b/ash/launcher/launcher_delegate_proxy.cc
|
| @@ -0,0 +1,82 @@
|
| +// 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/ash_launcher_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()));
|
| +
|
| + ash_launcher_delegate_.reset(new AshLauncherDelegate);
|
| +}
|
| +
|
| +LauncherDelegateProxy::~LauncherDelegateProxy() {
|
| +}
|
| +
|
| +ash::LauncherID LauncherDelegateProxy::GetIDByWindow(aura::Window* window) {
|
| + ash::LauncherID id = chrome_launcher_delegate_->GetIDByWindow(window);
|
| + return id ? id : ash_launcher_delegate_->GetIDByWindow(window);
|
| +}
|
| +
|
| +void LauncherDelegateProxy::OnLauncherCreated(Launcher* launcher) {
|
| + chrome_launcher_delegate_->OnLauncherCreated(launcher);
|
| + ash_launcher_delegate_->OnLauncherCreated(launcher);
|
| +}
|
| +
|
| +void LauncherDelegateProxy::OnLauncherDestroyed(Launcher* launcher) {
|
| + chrome_launcher_delegate_->OnLauncherDestroyed(launcher);
|
| + ash_launcher_delegate_->OnLauncherDestroyed(launcher);
|
| +}
|
| +
|
| +LauncherID LauncherDelegateProxy::GetLauncherIDForAppID(
|
| + const std::string& app_id) {
|
| + // Only ChromeLauncherDelegate can pin apps.
|
| + return chrome_launcher_delegate_->GetLauncherIDForAppID(app_id);
|
| +}
|
| +
|
| +void LauncherDelegateProxy::PinAppWithID(const std::string& app_id) {
|
| + // Only ChromeLauncherDelegate can pin apps.
|
| + chrome_launcher_delegate_->PinAppWithID(app_id);
|
| +}
|
| +
|
| +bool LauncherDelegateProxy::IsAppPinned(const std::string& app_id) {
|
| + // Only ChromeLauncherDelegate can pin apps.
|
| + return chrome_launcher_delegate_->IsAppPinned(app_id);
|
| +}
|
| +
|
| +void LauncherDelegateProxy::UnpinAppsWithID(const std::string& app_id) {
|
| + // Only ChromeLauncherDelegate can pin apps.
|
| + 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 ash_launcher_delegate_->GetLauncherItemDelegate(item);
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| + return NULL;
|
| +}
|
| +
|
| +} // namespace internal
|
| +} // namespace ash
|
|
|