Don't preload rarely seen large images
[chromium-blink-merge.git] / ash / shell / window_watcher_shelf_item_delegate.cc
blob6e3f2a15d49fdde90fe53f6f5251435d28bc0fd0
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/shell/window_watcher_shelf_item_delegate.h"
7 #include "ash/shell/window_watcher.h"
8 #include "ash/wm/window_util.h"
9 #include "ui/aura/window.h"
11 namespace ash {
12 namespace shell {
14 WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate(
15 ShelfID id,
16 WindowWatcher* watcher)
17 : id_(id), watcher_(watcher) {
18 DCHECK_GT(id_, 0);
19 DCHECK(watcher_);
22 WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() {
25 ShelfItemDelegate::PerformedAction WindowWatcherShelfItemDelegate::ItemSelected(
26 const ui::Event& event) {
27 aura::Window* window = watcher_->GetWindowByID(id_);
28 if (window->type() == ui::wm::WINDOW_TYPE_PANEL)
29 wm::MoveWindowToEventRoot(window, event);
30 window->Show();
31 wm::ActivateWindow(window);
32 return kExistingWindowActivated;
35 base::string16 WindowWatcherShelfItemDelegate::GetTitle() {
36 return watcher_->GetWindowByID(id_)->title();
39 ui::MenuModel* WindowWatcherShelfItemDelegate::CreateContextMenu(
40 aura::Window* root_window) {
41 return NULL;
44 ShelfMenuModel* WindowWatcherShelfItemDelegate::CreateApplicationMenu(
45 int event_flags) {
46 return NULL;
49 bool WindowWatcherShelfItemDelegate::IsDraggable() {
50 return true;
53 bool WindowWatcherShelfItemDelegate::ShouldShowTooltip() {
54 return true;
57 void WindowWatcherShelfItemDelegate::Close() {
60 } // namespace shell
61 } // namespace ash