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

Side by Side Diff: ash/common/shelf/shelf_window_watcher.cc

Issue 2558963002: Move shelf item tooltip flag from delegate to item. (Closed)
Patch Set: Remove WmWindowMus::SetBoolProperty override. Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/shelf/shelf_window_watcher.h" 5 #include "ash/common/shelf/shelf_window_watcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/shelf/shelf_constants.h" 10 #include "ash/common/shelf/shelf_constants.h"
(...skipping 20 matching lines...) Expand all
31 item->status = STATUS_ACTIVE; 31 item->status = STATUS_ACTIVE;
32 else if (window->GetBoolProperty(WmWindowProperty::DRAW_ATTENTION)) 32 else if (window->GetBoolProperty(WmWindowProperty::DRAW_ATTENTION))
33 item->status = STATUS_ATTENTION; 33 item->status = STATUS_ATTENTION;
34 34
35 item->app_id = window->GetStringProperty(WmWindowProperty::APP_ID); 35 item->app_id = window->GetStringProperty(WmWindowProperty::APP_ID);
36 36
37 // Prefer app icons over window icons, they're typically larger. 37 // Prefer app icons over window icons, they're typically larger.
38 item->image = window->GetAppIcon(); 38 item->image = window->GetAppIcon();
39 if (item->image.isNull()) 39 if (item->image.isNull())
40 item->image = window->GetWindowIcon(); 40 item->image = window->GetWindowIcon();
41
42 // Do not show tooltips for visible attached app panel windows.
43 item->shows_tooltip =
44 item->type != TYPE_APP_PANEL || !window->IsVisible() ||
45 !window->GetBoolProperty(WmWindowProperty::PANEL_ATTACHED);
41 } 46 }
42 47
43 } // namespace 48 } // namespace
44 49
45 ShelfWindowWatcher::ContainerWindowObserver::ContainerWindowObserver( 50 ShelfWindowWatcher::ContainerWindowObserver::ContainerWindowObserver(
46 ShelfWindowWatcher* window_watcher) 51 ShelfWindowWatcher* window_watcher)
47 : window_watcher_(window_watcher) {} 52 : window_watcher_(window_watcher) {}
48 53
49 ShelfWindowWatcher::ContainerWindowObserver::~ContainerWindowObserver() {} 54 ShelfWindowWatcher::ContainerWindowObserver::~ContainerWindowObserver() {}
50 55
(...skipping 22 matching lines...) Expand all
73 : window_watcher_(window_watcher) {} 78 : window_watcher_(window_watcher) {}
74 79
75 ShelfWindowWatcher::UserWindowObserver::~UserWindowObserver() {} 80 ShelfWindowWatcher::UserWindowObserver::~UserWindowObserver() {}
76 81
77 void ShelfWindowWatcher::UserWindowObserver::OnWindowPropertyChanged( 82 void ShelfWindowWatcher::UserWindowObserver::OnWindowPropertyChanged(
78 WmWindow* window, 83 WmWindow* window,
79 WmWindowProperty property) { 84 WmWindowProperty property) {
80 if (property == WmWindowProperty::APP_ICON || 85 if (property == WmWindowProperty::APP_ICON ||
81 property == WmWindowProperty::APP_ID || 86 property == WmWindowProperty::APP_ID ||
82 property == WmWindowProperty::DRAW_ATTENTION || 87 property == WmWindowProperty::DRAW_ATTENTION ||
88 property == WmWindowProperty::PANEL_ATTACHED ||
83 property == WmWindowProperty::SHELF_ITEM_TYPE || 89 property == WmWindowProperty::SHELF_ITEM_TYPE ||
84 property == WmWindowProperty::WINDOW_ICON) { 90 property == WmWindowProperty::WINDOW_ICON) {
85 window_watcher_->OnUserWindowPropertyChanged(window); 91 window_watcher_->OnUserWindowPropertyChanged(window);
86 } 92 }
87 } 93 }
88 94
89 void ShelfWindowWatcher::UserWindowObserver::OnWindowDestroying( 95 void ShelfWindowWatcher::UserWindowObserver::OnWindowDestroying(
90 WmWindow* window) { 96 WmWindow* window) {
91 window_watcher_->OnUserWindowDestroying(window); 97 window_watcher_->OnUserWindowDestroying(window);
92 } 98 }
93 99
100 void ShelfWindowWatcher::UserWindowObserver::OnWindowVisibilityChanged(
101 WmWindow* window,
102 bool visible) {
103 // The tooltip behavior for panel windows depends on the panel visibility.
104 window_watcher_->OnUserWindowPropertyChanged(window);
105 }
106
94 //////////////////////////////////////////////////////////////////////////////// 107 ////////////////////////////////////////////////////////////////////////////////
95 108
96 ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model) 109 ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model)
97 : model_(model), 110 : model_(model),
98 container_window_observer_(this), 111 container_window_observer_(this),
99 user_window_observer_(this), 112 user_window_observer_(this),
100 observed_container_windows_(&container_window_observer_), 113 observed_container_windows_(&container_window_observer_),
101 observed_user_windows_(&user_window_observer_) { 114 observed_user_windows_(&user_window_observer_) {
102 WmShell::Get()->AddActivationObserver(this); 115 WmShell::Get()->AddActivationObserver(this);
103 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { 116 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 observed_container_windows_.Add(panel_container); 225 observed_container_windows_.Add(panel_container);
213 } 226 }
214 227
215 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { 228 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) {
216 } 229 }
217 230
218 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, 231 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&,
219 uint32_t) {} 232 uint32_t) {}
220 233
221 } // namespace ash 234 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_window_watcher.h ('k') | ash/common/shelf/shelf_window_watcher_item_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698