Chromium Code Reviews| Index: ash/mus/bridge/wm_window_mus.cc |
| diff --git a/ash/mus/bridge/wm_window_mus.cc b/ash/mus/bridge/wm_window_mus.cc |
| index d3fc487382eb1c649522c705c776f28c6317c001..1a582ede4fb6307c74bd44c40d99298f7439a9f1 100644 |
| --- a/ash/mus/bridge/wm_window_mus.cc |
| +++ b/ash/mus/bridge/wm_window_mus.cc |
| @@ -4,6 +4,7 @@ |
| #include "ash/mus/bridge/wm_window_mus.h" |
| +#include "ash/common/shelf/shelf_item_types.h" |
| #include "ash/common/wm/container_finder.h" |
| #include "ash/common/wm/window_positioning_utils.h" |
| #include "ash/common/wm/window_state.h" |
| @@ -24,6 +25,7 @@ |
| #include "ui/aura/window.h" |
| #include "ui/base/hit_test.h" |
| #include "ui/display/display.h" |
| +#include "ui/resources/grit/ui_resources.h" |
| #include "ui/views/view.h" |
| #include "ui/views/widget/widget.h" |
| #include "ui/views/widget/widget_delegate.h" |
| @@ -43,9 +45,8 @@ namespace mus { |
| namespace { |
| -// This classes is used so that the WindowState constructor can be made |
| -// protected. GetWindowState() is the only place that should be creating |
| -// WindowState. |
| +// This class is used so that the WindowState constructor can be made protected. |
| +// GetWindowState() is the only place that should be creating WindowState. |
| class WindowStateMus : public wm::WindowState { |
| public: |
| explicit WindowStateMus(WmWindow* window) : wm::WindowState(window) {} |
| @@ -193,6 +194,10 @@ std::string WmWindowMus::GetName() const { |
| : std::string(); |
| } |
| +void WmWindowMus::SetTitle(const base::string16& title) { |
| + SetWindowTitle(window_, title); |
| +} |
| + |
| base::string16 WmWindowMus::GetTitle() const { |
| return GetWindowTitle(window_); |
| } |
| @@ -371,9 +376,39 @@ void WmWindowMus::SetColorProperty(WmWindowProperty key, SkColor value) { |
| } |
| int WmWindowMus::GetIntProperty(WmWindowProperty key) { |
| + if (key == WmWindowProperty::MODAL_TYPE) { |
| + // TODO: WindowTree::SetModalWindow() needs to route through WindowManager |
| + // so wm can position. http://crbug.com/645996. |
| + NOTIMPLEMENTED(); |
| + return static_cast<int>(ui::MODAL_TYPE_NONE); |
| + } |
| + |
| + if (key == WmWindowProperty::SHELF_ICON_ID) { |
| + if (window_->HasSharedProperty( |
| + ui::mojom::WindowManager::kShelfIconId_Property)) { |
| + return window_->GetSharedProperty<int>( |
| + ui::mojom::WindowManager::kShelfIconId_Property); |
| + } |
| + // Mash provides a default shelf icon image. |
| + // TODO(msw): Support icon resource ids and bitmaps: |
| + // mojo::Array<uint8_t> app_icon = GetWindowAppIcon(window_); |
| + return IDR_DEFAULT_FAVICON; |
| + } |
| + |
| if (key == WmWindowProperty::SHELF_ID) { |
| NOTIMPLEMENTED(); |
| - return 0; |
| + return kInvalidShelfID; |
|
James Cook
2016/09/28 20:41:03
Good catch.
msw
2016/09/28 23:27:46
Acknowledged.
|
| + } |
| + |
| + if (key == WmWindowProperty::SHELF_ITEM_TYPE) { |
| + if (window_->HasSharedProperty( |
| + ui::mojom::WindowManager::kShelfItemType_Property)) { |
| + return window_->GetSharedProperty<int>( |
| + ui::mojom::WindowManager::kShelfItemType_Property); |
| + } |
| + // Mash provides a default shelf item type for non-ignored windows. |
| + return GetWindowIgnoredByShelf(window_) ? TYPE_UNDEFINED |
| + : TYPE_PLATFORM_APP; |
| } |
| if (key == WmWindowProperty::TOP_VIEW_INSET) { |
| @@ -382,23 +417,28 @@ int WmWindowMus::GetIntProperty(WmWindowProperty key) { |
| return 0; |
| } |
| - if (key == WmWindowProperty::MODAL_TYPE) { |
| - // TODO: WindowTree::SetModalWindow() needs to route through WindowManager |
| - // so wm can position. http://crbug.com/645996. |
| - NOTIMPLEMENTED(); |
| - return static_cast<int>(ui::MODAL_TYPE_NONE); |
| - } |
| - |
| NOTREACHED(); |
| return 0; |
| } |
| void WmWindowMus::SetIntProperty(WmWindowProperty key, int value) { |
| + if (key == WmWindowProperty::SHELF_ICON_ID) { |
| + window_->SetSharedProperty<int>( |
| + ui::mojom::WindowManager::kShelfIconId_Property, value); |
| + return; |
| + } |
| + |
| if (key == WmWindowProperty::SHELF_ID) { |
| NOTIMPLEMENTED(); |
| return; |
| } |
| + if (key == WmWindowProperty::SHELF_ITEM_TYPE) { |
| + window_->SetSharedProperty<int>( |
| + ui::mojom::WindowManager::kShelfItemType_Property, value); |
| + return; |
| + } |
| + |
| if (key == WmWindowProperty::TOP_VIEW_INSET) { |
| // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100. |
| NOTIMPLEMENTED(); |
| @@ -408,19 +448,6 @@ void WmWindowMus::SetIntProperty(WmWindowProperty key, int value) { |
| NOTREACHED(); |
| } |
| -ShelfItemDetails* WmWindowMus::GetShelfItemDetails() { |
| - NOTIMPLEMENTED(); // TODO: Add support; see crbug.com/634150 |
| - return nullptr; |
| -} |
| - |
| -void WmWindowMus::SetShelfItemDetails(const ShelfItemDetails& details) { |
| - NOTIMPLEMENTED(); // TODO: Add support; see crbug.com/634150 |
| -} |
| - |
| -void WmWindowMus::ClearShelfItemDetails() { |
| - NOTIMPLEMENTED(); // TODO: Add support; see crbug.com/634150 |
| -} |
| - |
| const wm::WindowState* WmWindowMus::GetWindowState() const { |
| return window_state_.get(); |
| } |