| 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 <utility> |    7 #include <utility> | 
|    8  |    8  | 
|    9 #include "ash/aura/wm_window_aura.h" |  | 
|   10 #include "ash/common/shelf/shelf_model.h" |    9 #include "ash/common/shelf/shelf_model.h" | 
|   11 #include "ash/common/shelf/shelf_widget.h" |   10 #include "ash/common/shelf/shelf_widget.h" | 
|   12 #include "ash/common/wm_shell.h" |   11 #include "ash/common/wm_shell.h" | 
 |   12 #include "ash/common/wm_window.h" | 
|   13 #include "ash/common/wm_window_property.h" |   13 #include "ash/common/wm_window_property.h" | 
|   14 #include "ash/display/window_tree_host_manager.h" |   14 #include "ash/display/window_tree_host_manager.h" | 
|   15 #include "ash/public/cpp/shell_window_ids.h" |   15 #include "ash/public/cpp/shell_window_ids.h" | 
|   16 #include "ash/shell.h" |   16 #include "ash/shell.h" | 
|   17 #include "ash/shell/window_watcher_shelf_item_delegate.h" |   17 #include "ash/shell/window_watcher_shelf_item_delegate.h" | 
|   18 #include "ash/wm/window_util.h" |   18 #include "ash/wm/window_util.h" | 
|   19 #include "ui/aura/window.h" |   19 #include "ui/aura/window.h" | 
|   20 #include "ui/aura/window_event_dispatcher.h" |   20 #include "ui/aura/window_event_dispatcher.h" | 
|   21 #include "ui/display/display.h" |   21 #include "ui/display/display.h" | 
|   22  |   22  | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  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   std::unique_ptr<ShelfItemDelegate> delegate( | 
|  118       new WindowWatcherShelfItemDelegate(id, this)); |  118       new WindowWatcherShelfItemDelegate(id, this)); | 
|  119   model->SetShelfItemDelegate(id, std::move(delegate)); |  119   model->SetShelfItemDelegate(id, std::move(delegate)); | 
|  120   WmWindowAura::Get(new_window)->SetIntProperty(WmWindowProperty::SHELF_ID, id); |  120   WmWindow::Get(new_window)->SetIntProperty(WmWindowProperty::SHELF_ID, id); | 
|  121 } |  121 } | 
|  122  |  122  | 
|  123 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { |  123 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { | 
|  124   for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end(); |  124   for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end(); | 
|  125        ++i) { |  125        ++i) { | 
|  126     if (i->second == window) { |  126     if (i->second == window) { | 
|  127       ShelfModel* model = WmShell::Get()->shelf_model(); |  127       ShelfModel* model = WmShell::Get()->shelf_model(); | 
|  128       int index = model->ItemIndexByID(i->first); |  128       int index = model->ItemIndexByID(i->first); | 
|  129       DCHECK_NE(-1, index); |  129       DCHECK_NE(-1, index); | 
|  130       model->RemoveItemAt(index); |  130       model->RemoveItemAt(index); | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|  144 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |  144 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 
|  145   // All windows in the display has already been removed, so no need to |  145   // All windows in the display has already been removed, so no need to | 
|  146   // remove observers. |  146   // remove observers. | 
|  147 } |  147 } | 
|  148  |  148  | 
|  149 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { |  149 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { | 
|  150 } |  150 } | 
|  151  |  151  | 
|  152 }  // namespace shell |  152 }  // namespace shell | 
|  153 }  // namespace ash |  153 }  // namespace ash | 
| OLD | NEW |