Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: ash/mus/bridge/wm_window_mus.cc

Issue 2357143004: mash: Support ShelfWindowWatcher via ShelfItem properties. (Closed)
Patch Set: Address comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/bridge/wm_window_mus.h ('k') | ash/mus/property_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ae121ab05cd5abfe5bdc46ef38c3d3ca1b26638f..553dca55a9b8e92bb545b140ba2dfa91ebbdb133 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) {}
@@ -195,6 +196,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_);
}
@@ -373,9 +378,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_RESOURCE_ID) {
+ if (window_->HasSharedProperty(
+ ui::mojom::WindowManager::kShelfIconResourceId_Property)) {
+ return window_->GetSharedProperty<int>(
+ ui::mojom::WindowManager::kShelfIconResourceId_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;
+ }
+
+ 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) {
@@ -384,23 +419,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_RESOURCE_ID) {
+ window_->SetSharedProperty<int>(
+ ui::mojom::WindowManager::kShelfIconResourceId_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();
@@ -410,19 +450,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();
}
« no previous file with comments | « ash/mus/bridge/wm_window_mus.h ('k') | ash/mus/property_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698