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

Side by Side Diff: ash/shell/window_watcher.cc

Issue 2332393003: mash: Remove shelf util functions; use WmWindow properties. (Closed)
Patch Set: Address comments. Created 4 years, 3 months 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
« no previous file with comments | « ash/shelf/shelf_util.cc ('k') | ash/test/test_shelf_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/shell/window_watcher.h" 5 #include "ash/shell/window_watcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/shelf/shelf_model.h" 10 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/common/shelf/shelf_widget.h" 11 #include "ash/common/shelf/shelf_widget.h"
11 #include "ash/common/shell_window_ids.h" 12 #include "ash/common/shell_window_ids.h"
12 #include "ash/common/wm_shell.h" 13 #include "ash/common/wm_shell.h"
14 #include "ash/common/wm_window_property.h"
13 #include "ash/display/window_tree_host_manager.h" 15 #include "ash/display/window_tree_host_manager.h"
14 #include "ash/shelf/shelf_util.h"
15 #include "ash/shell.h" 16 #include "ash/shell.h"
16 #include "ash/shell/window_watcher_shelf_item_delegate.h" 17 #include "ash/shell/window_watcher_shelf_item_delegate.h"
17 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
19 #include "ui/aura/window_event_dispatcher.h" 20 #include "ui/aura/window_event_dispatcher.h"
20 #include "ui/display/display.h" 21 #include "ui/display/display.h"
21 22
22 namespace ash { 23 namespace ash {
23 namespace shell { 24 namespace shell {
24 25
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0, 109 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0,
109 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0); 110 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0);
110 image_count = (image_count + 1) % 3; 111 image_count = (image_count + 1) % 3;
111 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); 112 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f));
112 113
113 model->Add(item); 114 model->Add(item);
114 115
115 std::unique_ptr<ShelfItemDelegate> delegate( 116 std::unique_ptr<ShelfItemDelegate> delegate(
116 new WindowWatcherShelfItemDelegate(id, this)); 117 new WindowWatcherShelfItemDelegate(id, this));
117 model->SetShelfItemDelegate(id, std::move(delegate)); 118 model->SetShelfItemDelegate(id, std::move(delegate));
118 SetShelfIDForWindow(id, new_window); 119 WmWindowAura::Get(new_window)->SetIntProperty(WmWindowProperty::SHELF_ID, id);
119 } 120 }
120 121
121 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { 122 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) {
122 for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end(); 123 for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end();
123 ++i) { 124 ++i) {
124 if (i->second == window) { 125 if (i->second == window) {
125 ShelfModel* model = WmShell::Get()->shelf_model(); 126 ShelfModel* model = WmShell::Get()->shelf_model();
126 int index = model->ItemIndexByID(i->first); 127 int index = model->ItemIndexByID(i->first);
127 DCHECK_NE(-1, index); 128 DCHECK_NE(-1, index);
128 model->RemoveItemAt(index); 129 model->RemoveItemAt(index);
(...skipping 13 matching lines...) Expand all
142 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { 143 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) {
143 // All windows in the display has already been removed, so no need to 144 // All windows in the display has already been removed, so no need to
144 // remove observers. 145 // remove observers.
145 } 146 }
146 147
147 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { 148 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) {
148 } 149 }
149 150
150 } // namespace shell 151 } // namespace shell
151 } // namespace ash 152 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_util.cc ('k') | ash/test/test_shelf_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698