Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf_window_watcher.h" | 5 #include "ash/shelf/shelf_window_watcher.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/shelf/shelf_model.h" | 8 #include "ash/shelf/shelf_model.h" |
| 9 #include "ash/shelf/shelf_util.h" | 9 #include "ash/shelf/shelf_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 observed_windows_.Add(window); | 139 observed_windows_.Add(window); |
| 140 // Add LauncherItem if |window| already has a LauncherItemDetails when it is | 140 // Add LauncherItem if |window| already has a LauncherItemDetails when it is |
| 141 // created. Don't make a new LauncherItem for the re-parented |window| that | 141 // created. Don't make a new LauncherItem for the re-parented |window| that |
| 142 // already has a LauncherItem. | 142 // already has a LauncherItem. |
| 143 if (GetLauncherIDForWindow(window) == ash::kInvalidLauncherID && | 143 if (GetLauncherIDForWindow(window) == ash::kInvalidLauncherID && |
| 144 GetLauncherItemDetailsForWindow(window)) | 144 GetLauncherItemDetailsForWindow(window)) |
| 145 AddLauncherItem(window); | 145 AddLauncherItem(window); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ShelfWindowWatcher::OnWillRemoveWindow(aura::Window* window) { | 148 void ShelfWindowWatcher::OnWillRemoveWindow(aura::Window* window) { |
| 149 // Remove a child window of default container and its item if it has. | 149 // Remove a child window of default container. |
| 150 if (observed_windows_.IsObserving(window)) | |
|
sky
2013/12/12 16:41:43
If you do this, it means you need to better track
simonhong
2013/12/13 02:03:45
Checked window's dragging state and if so, an item
| |
| 151 observed_windows_.Remove(window); | |
| 152 } | |
| 153 | |
| 154 void ShelfWindowWatcher::OnWindowDestroying(aura::Window* window) { | |
| 155 // Remove the default container. | |
| 150 if (observed_windows_.IsObserving(window)) | 156 if (observed_windows_.IsObserving(window)) |
| 151 observed_windows_.Remove(window); | 157 observed_windows_.Remove(window); |
| 152 | 158 |
| 153 if (HasLauncherItemForWindow(window)) | 159 if (HasLauncherItemForWindow(window)) |
| 154 RemoveLauncherItem(window); | 160 RemoveLauncherItem(window); |
| 155 } | 161 } |
| 156 | 162 |
| 157 void ShelfWindowWatcher::OnWindowDestroying(aura::Window* window) { | |
| 158 // Remove the default container. | |
| 159 if (observed_windows_.IsObserving(window)) | |
| 160 observed_windows_.Remove(window); | |
| 161 } | |
| 162 | |
| 163 void ShelfWindowWatcher::OnWindowPropertyChanged(aura::Window* window, | 163 void ShelfWindowWatcher::OnWindowPropertyChanged(aura::Window* window, |
| 164 const void* key, | 164 const void* key, |
| 165 intptr_t old) { | 165 intptr_t old) { |
| 166 if (key != kLauncherItemDetailsKey) | 166 if (key != kLauncherItemDetailsKey) |
| 167 return; | 167 return; |
| 168 | 168 |
| 169 if (GetLauncherItemDetailsForWindow(window) == NULL) { | 169 if (GetLauncherItemDetailsForWindow(window) == NULL) { |
| 170 // Removes LauncherItem for |window| when it has a LauncherItem. | 170 // Removes LauncherItem for |window| when it has a LauncherItem. |
| 171 if (reinterpret_cast<LauncherItemDetails*>(old) != NULL) | 171 if (reinterpret_cast<LauncherItemDetails*>(old) != NULL) |
| 172 RemoveLauncherItem(window); | 172 RemoveLauncherItem(window); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 | 205 |
| 206 void ShelfWindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 206 void ShelfWindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
| 207 // When this is called, RootWindow of |old_display| is already removed. | 207 // When this is called, RootWindow of |old_display| is already removed. |
| 208 // Instead, we remove an observer from RootWindow and ActivationClient in the | 208 // Instead, we remove an observer from RootWindow and ActivationClient in the |
| 209 // OnRootWindowDestroyed(). | 209 // OnRootWindowDestroyed(). |
| 210 // Do nothing here. | 210 // Do nothing here. |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace internal | 213 } // namespace internal |
| 214 } // namespace ash | 214 } // namespace ash |
| OLD | NEW |