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

Unified Diff: ash/shell/window_watcher_launcher_item_delegate.cc

Issue 23606016: Refactor LauncherItemController and LauncherItemDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for unittest.. Created 7 years, 2 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/window_watcher_launcher_item_delegate.cc
diff --git a/ash/shell/window_watcher_launcher_item_delegate.cc b/ash/shell/window_watcher_launcher_item_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..553b9fcfa81a025bbcda7e7ecd504c89f6f660ec
--- /dev/null
+++ b/ash/shell/window_watcher_launcher_item_delegate.cc
@@ -0,0 +1,58 @@
+// 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/window_watcher_launcher_item_delegate.h"
+
+#include "ash/shell/window_watcher.h"
+#include "ash/wm/window_util.h"
+#include "ui/aura/window.h"
+
+namespace ash {
+namespace shell {
+
+WindowWatcherLauncherItemDelegate::WindowWatcherLauncherItemDelegate(
+ ash::LauncherID id,
+ ash::shell::WindowWatcher* watcher)
+ : id_(id),
+ watcher_(watcher) {
+ DCHECK_GT(id_, 0);
+ DCHECK(watcher_);
+}
+
+WindowWatcherLauncherItemDelegate::~WindowWatcherLauncherItemDelegate() {
+}
+
+void WindowWatcherLauncherItemDelegate::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 WindowWatcherLauncherItemDelegate::GetTitle() {
+ return watcher_->GetWindowByID(id_)->title();
+}
+
+ui::MenuModel* WindowWatcherLauncherItemDelegate::CreateContextMenu(
+ aura::RootWindow* root_window) {
+ return NULL;
+}
+
+ash::LauncherMenuModel*
+WindowWatcherLauncherItemDelegate::CreateApplicationMenu(
+ int event_flags) {
+ return NULL;
+}
+
+bool WindowWatcherLauncherItemDelegate::IsDraggable() {
+ return true;
+}
+
+bool WindowWatcherLauncherItemDelegate::ShouldShowTooltip() {
+ return true;
+}
+
+} // namespace shell
+} // namespace ash
« no previous file with comments | « ash/shell/window_watcher_launcher_item_delegate.h ('k') | ash/test/launcher_item_delegate_manager_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698