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

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

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Address comments. Created 3 years, 9 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
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/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/common/shelf/shelf_widget.h" 10 #include "ash/common/shelf/shelf_widget.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 SkBitmap icon_bitmap; 107 SkBitmap icon_bitmap;
108 icon_bitmap.allocN32Pixels(16, 16); 108 icon_bitmap.allocN32Pixels(16, 16);
109 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0, 109 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0,
110 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0); 110 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0);
111 image_count = (image_count + 1) % 3; 111 image_count = (image_count + 1) % 3;
112 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); 112 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f));
113 item.title = new_window->GetTitle(); 113 item.title = new_window->GetTitle();
114 114
115 model->Add(item); 115 model->Add(item);
116 116
117 std::unique_ptr<ShelfItemDelegate> delegate( 117 model->SetShelfItemDelegate(
118 new WindowWatcherShelfItemDelegate(id, this)); 118 id, base::MakeUnique<WindowWatcherShelfItemDelegate>(id, this));
119 model->SetShelfItemDelegate(id, std::move(delegate));
120 new_window->SetProperty(kShelfIDKey, id); 119 new_window->SetProperty(kShelfIDKey, id);
121 } 120 }
122 121
123 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { 122 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) {
124 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();
125 ++i) { 124 ++i) {
126 if (i->second == window) { 125 if (i->second == window) {
127 ShelfModel* model = WmShell::Get()->shelf_model(); 126 ShelfModel* model = WmShell::Get()->shelf_model();
128 int index = model->ItemIndexByID(i->first); 127 int index = model->ItemIndexByID(i->first);
129 DCHECK_NE(-1, index); 128 DCHECK_NE(-1, index);
(...skipping 14 matching lines...) Expand all
144 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { 143 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) {
145 // 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
146 // remove observers. 145 // remove observers.
147 } 146 }
148 147
149 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { 148 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) {
150 } 149 }
151 150
152 } // namespace shell 151 } // namespace shell
153 } // namespace ash 152 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698