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

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

Issue 2518423003: Combine shelf platform and windowed app types. (Closed)
Patch Set: Fix kInvalidShelfID typo. 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 (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/aura/wm_window_aura.h"
10 #include "ash/common/shelf/shelf_model.h" 10 #include "ash/common/shelf/shelf_model.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // aura::WindowObserver overrides: 93 // aura::WindowObserver overrides:
94 void WindowWatcher::OnWindowAdded(aura::Window* new_window) { 94 void WindowWatcher::OnWindowAdded(aura::Window* new_window) {
95 if (!wm::IsWindowUserPositionable(new_window)) 95 if (!wm::IsWindowUserPositionable(new_window))
96 return; 96 return;
97 97
98 static int image_count = 0; 98 static int image_count = 0;
99 ShelfModel* model = WmShell::Get()->shelf_model(); 99 ShelfModel* model = WmShell::Get()->shelf_model();
100 ShelfItem item; 100 ShelfItem item;
101 item.type = new_window->type() == ui::wm::WINDOW_TYPE_PANEL 101 item.type = new_window->type() == ui::wm::WINDOW_TYPE_PANEL
102 ? ash::TYPE_APP_PANEL 102 ? ash::TYPE_APP_PANEL
103 : ash::TYPE_PLATFORM_APP; 103 : ash::TYPE_APP;
104 ash::ShelfID id = model->next_id(); 104 ash::ShelfID id = model->next_id();
105 id_to_window_[id] = new_window; 105 id_to_window_[id] = new_window;
106 106
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 113
(...skipping 29 matching lines...) Expand all
143 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { 143 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) {
144 // 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
145 // remove observers. 145 // remove observers.
146 } 146 }
147 147
148 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { 148 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) {
149 } 149 }
150 150
151 } // namespace shell 151 } // namespace shell
152 } // namespace ash 152 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view_unittest.cc ('k') | chrome/browser/ui/ash/launcher/chrome_launcher_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698