OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mus/bridge/wm_window_mus.h" | 5 #include "ash/mus/bridge/wm_window_mus.h" |
6 | 6 |
7 #include "ash/common/shelf/shelf_item_types.h" | 7 #include "ash/common/shelf/shelf_item_types.h" |
8 #include "ash/common/wm/container_finder.h" | 8 #include "ash/common/wm/container_finder.h" |
9 #include "ash/common/wm/window_positioning_utils.h" | 9 #include "ash/common/wm/window_positioning_utils.h" |
10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 return ui::mojom::ShowState::DEFAULT; | 101 return ui::mojom::ShowState::DEFAULT; |
102 } | 102 } |
103 | 103 |
104 // Returns the WmWindowProperty enum value for the given ui::Window key name. | 104 // Returns the WmWindowProperty enum value for the given ui::Window key name. |
105 WmWindowProperty WmWindowPropertyFromUI(const std::string& ui_window_key) { | 105 WmWindowProperty WmWindowPropertyFromUI(const std::string& ui_window_key) { |
106 if (ui_window_key == ui::mojom::WindowManager::kAlwaysOnTop_Property) | 106 if (ui_window_key == ui::mojom::WindowManager::kAlwaysOnTop_Property) |
107 return WmWindowProperty::ALWAYS_ON_TOP; | 107 return WmWindowProperty::ALWAYS_ON_TOP; |
108 if (ui_window_key == ui::mojom::WindowManager::kExcludeFromMru_Property) | 108 if (ui_window_key == ui::mojom::WindowManager::kExcludeFromMru_Property) |
109 return WmWindowProperty::EXCLUDE_FROM_MRU; | 109 return WmWindowProperty::EXCLUDE_FROM_MRU; |
110 if (ui_window_key == ui::mojom::WindowManager::kShelfIconResourceId_Property) | |
111 return WmWindowProperty::SHELF_ICON_RESOURCE_ID; | |
112 if (ui_window_key == ui::mojom::WindowManager::kShelfItemType_Property) | 110 if (ui_window_key == ui::mojom::WindowManager::kShelfItemType_Property) |
113 return WmWindowProperty::SHELF_ITEM_TYPE; | 111 return WmWindowProperty::SHELF_ITEM_TYPE; |
114 return WmWindowProperty::INVALID_PROPERTY; | 112 return WmWindowProperty::INVALID_PROPERTY; |
115 } | 113 } |
116 | 114 |
117 } // namespace | 115 } // namespace |
118 | 116 |
119 WmWindowMus::WmWindowMus(ui::Window* window) | 117 WmWindowMus::WmWindowMus(ui::Window* window) |
120 : window_(window), | 118 : window_(window), |
121 // Matches aura, see aura::Window for details. | 119 // Matches aura, see aura::Window for details. |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } | 416 } |
419 | 417 |
420 int WmWindowMus::GetIntProperty(WmWindowProperty key) { | 418 int WmWindowMus::GetIntProperty(WmWindowProperty key) { |
421 if (key == WmWindowProperty::MODAL_TYPE) { | 419 if (key == WmWindowProperty::MODAL_TYPE) { |
422 // TODO: WindowTree::SetModalWindow() needs to route through WindowManager | 420 // TODO: WindowTree::SetModalWindow() needs to route through WindowManager |
423 // so wm can position. http://crbug.com/645996. | 421 // so wm can position. http://crbug.com/645996. |
424 NOTIMPLEMENTED(); | 422 NOTIMPLEMENTED(); |
425 return static_cast<int>(ui::MODAL_TYPE_NONE); | 423 return static_cast<int>(ui::MODAL_TYPE_NONE); |
426 } | 424 } |
427 | 425 |
428 if (key == WmWindowProperty::SHELF_ICON_RESOURCE_ID) { | |
429 if (window_->HasSharedProperty( | |
430 ui::mojom::WindowManager::kShelfIconResourceId_Property)) { | |
431 return window_->GetSharedProperty<int>( | |
432 ui::mojom::WindowManager::kShelfIconResourceId_Property); | |
433 } | |
434 // Mash provides a default shelf icon image. | |
435 // TODO(msw): Support icon resource ids and bitmaps: | |
436 // mojo::Array<uint8_t> app_icon = GetWindowAppIcon(window_); | |
437 return IDR_DEFAULT_FAVICON; | |
438 } | |
439 | |
440 if (key == WmWindowProperty::SHELF_ID) { | 426 if (key == WmWindowProperty::SHELF_ID) { |
441 if (window_->HasSharedProperty( | 427 if (window_->HasSharedProperty( |
442 ui::mojom::WindowManager::kShelfId_Property)) { | 428 ui::mojom::WindowManager::kShelfId_Property)) { |
443 return window_->GetSharedProperty<int>( | 429 return window_->GetSharedProperty<int>( |
444 ui::mojom::WindowManager::kShelfId_Property); | 430 ui::mojom::WindowManager::kShelfId_Property); |
445 } | 431 } |
446 | 432 |
447 return kInvalidShelfID; | 433 return kInvalidShelfID; |
448 } | 434 } |
449 | 435 |
(...skipping 12 matching lines...) Expand all Loading... |
462 // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100. | 448 // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100. |
463 NOTIMPLEMENTED(); | 449 NOTIMPLEMENTED(); |
464 return 0; | 450 return 0; |
465 } | 451 } |
466 | 452 |
467 NOTREACHED(); | 453 NOTREACHED(); |
468 return 0; | 454 return 0; |
469 } | 455 } |
470 | 456 |
471 void WmWindowMus::SetIntProperty(WmWindowProperty key, int value) { | 457 void WmWindowMus::SetIntProperty(WmWindowProperty key, int value) { |
472 if (key == WmWindowProperty::SHELF_ICON_RESOURCE_ID) { | |
473 window_->SetSharedProperty<int>( | |
474 ui::mojom::WindowManager::kShelfIconResourceId_Property, value); | |
475 return; | |
476 } | |
477 | |
478 if (key == WmWindowProperty::SHELF_ID) { | 458 if (key == WmWindowProperty::SHELF_ID) { |
479 window_->SetSharedProperty<int>(ui::mojom::WindowManager::kShelfId_Property, | 459 window_->SetSharedProperty<int>(ui::mojom::WindowManager::kShelfId_Property, |
480 value); | 460 value); |
481 return; | 461 return; |
482 } | 462 } |
483 | 463 |
484 if (key == WmWindowProperty::SHELF_ITEM_TYPE) { | 464 if (key == WmWindowProperty::SHELF_ITEM_TYPE) { |
485 window_->SetSharedProperty<int>( | 465 window_->SetSharedProperty<int>( |
486 ui::mojom::WindowManager::kShelfItemType_Property, value); | 466 ui::mojom::WindowManager::kShelfItemType_Property, value); |
487 return; | 467 return; |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 } | 1043 } |
1064 | 1044 |
1065 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, | 1045 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, |
1066 ui::Window* transient) { | 1046 ui::Window* transient) { |
1067 for (auto& observer : transient_observers_) | 1047 for (auto& observer : transient_observers_) |
1068 observer.OnTransientChildRemoved(this, Get(transient)); | 1048 observer.OnTransientChildRemoved(this, Get(transient)); |
1069 } | 1049 } |
1070 | 1050 |
1071 } // namespace mus | 1051 } // namespace mus |
1072 } // namespace ash | 1052 } // namespace ash |
OLD | NEW |