OLD | NEW |
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 21 matching lines...) Expand all Loading... |
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 | 41 |
| 42 item->title = window->GetTitle(); |
| 43 |
42 // Do not show tooltips for visible attached app panel windows. | 44 // Do not show tooltips for visible attached app panel windows. |
43 item->shows_tooltip = | 45 item->shows_tooltip = |
44 item->type != TYPE_APP_PANEL || !window->IsVisible() || | 46 item->type != TYPE_APP_PANEL || !window->IsVisible() || |
45 !window->GetBoolProperty(WmWindowProperty::PANEL_ATTACHED); | 47 !window->GetBoolProperty(WmWindowProperty::PANEL_ATTACHED); |
46 } | 48 } |
47 | 49 |
48 } // namespace | 50 } // namespace |
49 | 51 |
50 ShelfWindowWatcher::ContainerWindowObserver::ContainerWindowObserver( | 52 ShelfWindowWatcher::ContainerWindowObserver::ContainerWindowObserver( |
51 ShelfWindowWatcher* window_watcher) | 53 ShelfWindowWatcher* window_watcher) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 bool visible) { | 104 bool visible) { |
103 // OnWindowVisibilityChanged() is called for descendants too. We only care | 105 // OnWindowVisibilityChanged() is called for descendants too. We only care |
104 // about changes to the visibility of windows we know about. | 106 // about changes to the visibility of windows we know about. |
105 if (!window_watcher_->observed_user_windows_.IsObserving(window)) | 107 if (!window_watcher_->observed_user_windows_.IsObserving(window)) |
106 return; | 108 return; |
107 | 109 |
108 // The tooltip behavior for panel windows depends on the panel visibility. | 110 // The tooltip behavior for panel windows depends on the panel visibility. |
109 window_watcher_->OnUserWindowPropertyChanged(window); | 111 window_watcher_->OnUserWindowPropertyChanged(window); |
110 } | 112 } |
111 | 113 |
| 114 void ShelfWindowWatcher::UserWindowObserver::OnWindowTitleChanged( |
| 115 WmWindow* window) { |
| 116 window_watcher_->OnUserWindowPropertyChanged(window); |
| 117 } |
| 118 |
112 //////////////////////////////////////////////////////////////////////////////// | 119 //////////////////////////////////////////////////////////////////////////////// |
113 | 120 |
114 ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model) | 121 ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model) |
115 : model_(model), | 122 : model_(model), |
116 container_window_observer_(this), | 123 container_window_observer_(this), |
117 user_window_observer_(this), | 124 user_window_observer_(this), |
118 observed_container_windows_(&container_window_observer_), | 125 observed_container_windows_(&container_window_observer_), |
119 observed_user_windows_(&user_window_observer_) { | 126 observed_user_windows_(&user_window_observer_) { |
120 WmShell::Get()->AddActivationObserver(this); | 127 WmShell::Get()->AddActivationObserver(this); |
121 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { | 128 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 observed_container_windows_.Add(panel_container); | 237 observed_container_windows_.Add(panel_container); |
231 } | 238 } |
232 | 239 |
233 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 240 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |
234 } | 241 } |
235 | 242 |
236 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, | 243 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, |
237 uint32_t) {} | 244 uint32_t) {} |
238 | 245 |
239 } // namespace ash | 246 } // namespace ash |
OLD | NEW |