summaryrefslogtreecommitdiffstats
path: root/ash/test/test_launcher_item_delegate.cc
blob: 3913c6841c1f5b3ee2d1f2eb7d247b04c4e1e8fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// 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/test/test_launcher_item_delegate.h"

#include "ash/wm/window_util.h"
#include "ui/aura/window.h"

namespace ash {
namespace test {

TestLauncherItemDelegate::TestLauncherItemDelegate(aura::Window* window)
    : window_(window) {
}

TestLauncherItemDelegate::~TestLauncherItemDelegate() {
}

bool TestLauncherItemDelegate::ItemSelected(const ui::Event& event) {
  if (window_) {
    if (window_->type() == aura::client::WINDOW_TYPE_PANEL)
      ash::wm::MoveWindowToEventRoot(window_, event);
    window_->Show();
    ash::wm::ActivateWindow(window_);
  }
  return false;
}

base::string16 TestLauncherItemDelegate::GetTitle() {
  return window_ ? window_->title() : base::string16();
}

ui::MenuModel* TestLauncherItemDelegate::CreateContextMenu(
    aura::Window* root_window) {
  return NULL;
}

ash::LauncherMenuModel* TestLauncherItemDelegate::CreateApplicationMenu(
    int event_flags) {
  return NULL;
}

bool TestLauncherItemDelegate::IsDraggable() {
  return true;
}

bool TestLauncherItemDelegate::ShouldShowTooltip() {
  return true;
}

}  // namespace test
}  // namespace ash