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

Unified Diff: ash/shell/launcher_item_delegate_impl.cc

Issue 23606016: Refactor LauncherItemController and LauncherItemDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for LauncherTest and observing LauncherModel in DelegateManager 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: ash/shell/launcher_item_delegate_impl.cc
diff --git a/ash/shell/launcher_item_delegate_impl.cc b/ash/shell/launcher_item_delegate_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..61be3d6676b5609abd129a8db3b6fe332421ac99
--- /dev/null
+++ b/ash/shell/launcher_item_delegate_impl.cc
@@ -0,0 +1,56 @@
+// 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/shell/launcher_item_delegate_impl.h"
+
+#include "ash/shell/window_watcher.h"
+#include "ash/wm/window_util.h"
+#include "ui/aura/window.h"
+
+namespace ash {
+namespace shell {
+
+LauncherItemDelegateImpl::LauncherItemDelegateImpl(
+ ash::LauncherID id,
+ ash::shell::WindowWatcher* watcher)
+ : id_(id),
+ watcher_(watcher) {
+ DCHECK(watcher_);
+}
+
+LauncherItemDelegateImpl::~LauncherItemDelegateImpl() {
+}
+
+void LauncherItemDelegateImpl::ItemSelected(const ui::Event& event) {
+ aura::Window* window = watcher_->GetWindowByID(id_);
+ if (window->type() == aura::client::WINDOW_TYPE_PANEL)
+ ash::wm::MoveWindowToEventRoot(window, event);
+ window->Show();
+ ash::wm::ActivateWindow(window);
+}
+
+base::string16 LauncherItemDelegateImpl::GetTitle() {
+ return watcher_->GetWindowByID(id_)->title();
+}
+
+ui::MenuModel* LauncherItemDelegateImpl::CreateContextMenu(
+ aura::RootWindow* root_window) {
+ return NULL;
+}
+
+ash::LauncherMenuModel* LauncherItemDelegateImpl::CreateApplicationMenu(
+ int event_flags) {
+ return NULL;
+}
+
+bool LauncherItemDelegateImpl::IsDraggable() {
+ return true;
+}
+
+bool LauncherItemDelegateImpl::ShouldShowTooltip() {
+ return true;
+}
+
+} // namespace shell
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698