forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow_watcher_shelf_item_delegate.cc
48 lines (38 loc) · 1.46 KB
/
window_watcher_shelf_item_delegate.cc
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
// 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_shelf_item_delegate.h"
#include <utility>
#include "ash/shell/window_watcher.h"
#include "ash/wm/window_util.h"
#include "ui/aura/window.h"
namespace ash {
namespace shell {
WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate(
ShelfID id,
WindowWatcher* watcher)
: ShelfItemDelegate(id), watcher_(watcher) {
DCHECK(!id.IsNull());
DCHECK(watcher_);
}
WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() = default;
void WindowWatcherShelfItemDelegate::ItemSelected(
std::unique_ptr<ui::Event> event,
int64_t display_id,
ShelfLaunchSource source,
ItemSelectedCallback callback) {
aura::Window* window = watcher_->GetWindowByID(shelf_id());
window->Show();
wm::ActivateWindow(window);
std::move(callback).Run(SHELF_ACTION_WINDOW_ACTIVATED, {});
}
void WindowWatcherShelfItemDelegate::ExecuteCommand(bool from_context_menu,
int64_t command_id,
int32_t event_flags,
int64_t display_id) {
// This delegate does not show custom context or application menu items.
NOTIMPLEMENTED();
}
void WindowWatcherShelfItemDelegate::Close() {}
} // namespace shell
} // namespace ash