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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
| 10 #include "ash/public/cpp/config.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
11 #include "ash/public/cpp/window_properties.h" | 12 #include "ash/public/cpp/window_properties.h" |
12 #include "ash/shelf/shelf_constants.h" | 13 #include "ash/shelf/shelf_constants.h" |
13 #include "ash/shelf/shelf_model.h" | 14 #include "ash/shelf/shelf_model.h" |
14 #include "ash/shelf/shelf_window_watcher_item_delegate.h" | 15 #include "ash/shelf/shelf_window_watcher_item_delegate.h" |
15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
16 #include "ash/shell_port.h" | 17 #include "ash/shell_port.h" |
17 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
18 #include "ash/wm/window_state.h" | 19 #include "ash/wm/window_state.h" |
19 #include "ash/wm/window_state_aura.h" | 20 #include "ash/wm/window_state_aura.h" |
20 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
21 #include "ash/wm_window.h" | 22 #include "ash/wm_window.h" |
22 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
23 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/display/display.h" | 26 #include "ui/display/display.h" |
26 #include "ui/display/screen.h" | 27 #include "ui/display/screen.h" |
27 #include "ui/resources/grit/ui_resources.h" | 28 #include "ui/resources/grit/ui_resources.h" |
28 #include "ui/wm/public/activation_client.h" | 29 #include "ui/wm/public/activation_client.h" |
29 | 30 |
30 namespace ash { | 31 namespace ash { |
31 namespace { | 32 namespace { |
32 | 33 |
33 // Returns the shelf item type, with special temporary behavior for Mash: | 34 // Returns the shelf item type, with special temporary behavior for Mash: |
34 // Mash provides a default shelf item type (TYPE_APP) for non-ignored windows. | 35 // Mash provides a default shelf item type (TYPE_APP) for non-ignored windows. |
35 ShelfItemType GetShelfItemType(aura::Window* window) { | 36 ShelfItemType GetShelfItemType(aura::Window* window) { |
36 if (!ShellPort::Get()->IsRunningInMash() || | 37 if (Shell::GetAshConfig() != Config::MASH || |
37 window->GetProperty(kShelfItemTypeKey) != TYPE_UNDEFINED) { | 38 window->GetProperty(kShelfItemTypeKey) != TYPE_UNDEFINED) { |
38 return static_cast<ShelfItemType>(window->GetProperty(kShelfItemTypeKey)); | 39 return static_cast<ShelfItemType>(window->GetProperty(kShelfItemTypeKey)); |
39 } | 40 } |
40 return wm::GetWindowState(window)->ignored_by_shelf() ? TYPE_UNDEFINED | 41 return wm::GetWindowState(window)->ignored_by_shelf() ? TYPE_UNDEFINED |
41 : TYPE_APP; | 42 : TYPE_APP; |
42 } | 43 } |
43 | 44 |
44 // Update the ShelfItem from relevant window properties. | 45 // Update the ShelfItem from relevant window properties. |
45 void UpdateShelfItemForWindow(ShelfItem* item, aura::Window* window) { | 46 void UpdateShelfItemForWindow(ShelfItem* item, aura::Window* window) { |
46 item->type = GetShelfItemType(window); | 47 item->type = GetShelfItemType(window); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 261 } |
261 } | 262 } |
262 | 263 |
263 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 264 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |
264 } | 265 } |
265 | 266 |
266 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, | 267 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, |
267 uint32_t) {} | 268 uint32_t) {} |
268 | 269 |
269 } // namespace ash | 270 } // namespace ash |
OLD | NEW |