| OLD | NEW |
| 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 "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 aura::Window* WindowWatcher::GetWindowByID(ash::LauncherID id) { | 89 aura::Window* WindowWatcher::GetWindowByID(ash::LauncherID id) { |
| 90 IDToWindow::const_iterator i = id_to_window_.find(id); | 90 IDToWindow::const_iterator i = id_to_window_.find(id); |
| 91 return i != id_to_window_.end() ? i->second : NULL; | 91 return i != id_to_window_.end() ? i->second : NULL; |
| 92 } | 92 } |
| 93 | 93 |
| 94 // aura::WindowObserver overrides: | 94 // aura::WindowObserver overrides: |
| 95 void WindowWatcher::OnWindowAdded(aura::Window* new_window) { | 95 void WindowWatcher::OnWindowAdded(aura::Window* new_window) { |
| 96 if (new_window->type() != aura::client::WINDOW_TYPE_NORMAL && | 96 if (new_window->type() != ui::wm::WINDOW_TYPE_NORMAL && |
| 97 new_window->type() != aura::client::WINDOW_TYPE_PANEL) | 97 new_window->type() != ui::wm::WINDOW_TYPE_PANEL) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 static int image_count = 0; | 100 static int image_count = 0; |
| 101 ShelfModel* model = Shell::GetInstance()->shelf_model(); | 101 ShelfModel* model = Shell::GetInstance()->shelf_model(); |
| 102 LauncherItem item; | 102 LauncherItem item; |
| 103 item.type = new_window->type() == aura::client::WINDOW_TYPE_PANEL ? | 103 item.type = new_window->type() == ui::wm::WINDOW_TYPE_PANEL |
| 104 ash::TYPE_APP_PANEL : ash::TYPE_PLATFORM_APP; | 104 ? ash::TYPE_APP_PANEL |
| 105 : ash::TYPE_PLATFORM_APP; |
| 105 ash::LauncherID id = model->next_id(); | 106 ash::LauncherID id = model->next_id(); |
| 106 id_to_window_[id] = new_window; | 107 id_to_window_[id] = new_window; |
| 107 | 108 |
| 108 SkBitmap icon_bitmap; | 109 SkBitmap icon_bitmap; |
| 109 icon_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 110 icon_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); |
| 110 icon_bitmap.allocPixels(); | 111 icon_bitmap.allocPixels(); |
| 111 icon_bitmap.eraseARGB(255, | 112 icon_bitmap.eraseARGB(255, |
| 112 image_count == 0 ? 255 : 0, | 113 image_count == 0 ? 255 : 0, |
| 113 image_count == 1 ? 255 : 0, | 114 image_count == 1 ? 255 : 0, |
| 114 image_count == 2 ? 255 : 0); | 115 image_count == 2 ? 255 : 0); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 workspace_window_watcher_->RootWindowAdded(root); | 149 workspace_window_watcher_->RootWindowAdded(root); |
| 149 } | 150 } |
| 150 | 151 |
| 151 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 152 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
| 152 // All windows in the display has already been removed, so no need to | 153 // All windows in the display has already been removed, so no need to |
| 153 // remove observers. | 154 // remove observers. |
| 154 } | 155 } |
| 155 | 156 |
| 156 } // namespace shell | 157 } // namespace shell |
| 157 } // namespace ash | 158 } // namespace ash |
| OLD | NEW |