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

Unified Diff: ash/aura/wm_window_aura.cc

Issue 2357143004: mash: Support ShelfWindowWatcher via ShelfItem properties. (Closed)
Patch Set: Set Settings WmWindow title with a WmWindowObserver. 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
Index: ash/aura/wm_window_aura.cc
diff --git a/ash/aura/wm_window_aura.cc b/ash/aura/wm_window_aura.cc
index 089424ae8d42c7dbf580dc1b704295f98aa53d2b..838aa5f4d231abee976fe6a266bbed687d309bf3 100644
--- a/ash/aura/wm_window_aura.cc
+++ b/ash/aura/wm_window_aura.cc
@@ -45,16 +45,14 @@
#include "ui/wm/core/visibility_controller.h"
#include "ui/wm/core/window_util.h"
-DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*);
DECLARE_WINDOW_PROPERTY_TYPE(ash::WmWindowAura*);
namespace ash {
DEFINE_WINDOW_PROPERTY_KEY(ShelfID, kShelfIDKey, kInvalidShelfID);
+DEFINE_WINDOW_PROPERTY_KEY(int, kShelfItemTypeKey, TYPE_UNDEFINED);
+DEFINE_WINDOW_PROPERTY_KEY(int, kShelfIconIdKey, kInvalidImageResourceID);
James Cook 2016/09/28 20:41:03 So on aura, GetWindowProperty(kShelfIconIdKey) for
msw 2016/09/28 23:27:46 Yes, for now mash relies on ShelfWindowWatcher for
-DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails,
- kShelfItemDetailsKey,
- nullptr);
DEFINE_OWNED_WINDOW_PROPERTY_KEY(WmWindowAura, kWmWindowKey, nullptr);
static_assert(aura::Window::kInitialId == kShellWindowId_Invalid,
@@ -168,6 +166,10 @@ std::string WmWindowAura::GetName() const {
return window_->name();
}
+void WmWindowAura::SetTitle(const base::string16& title) {
+ window_->SetTitle(title);
+}
+
base::string16 WmWindowAura::GetTitle() const {
return window_->title();
}
@@ -316,9 +318,15 @@ int WmWindowAura::GetIntProperty(WmWindowProperty key) {
if (key == WmWindowProperty::MODAL_TYPE)
return window_->GetProperty(aura::client::kModalKey);
+ if (key == WmWindowProperty::SHELF_ICON_ID)
+ return window_->GetProperty(kShelfIconIdKey);
+
if (key == WmWindowProperty::SHELF_ID)
return window_->GetProperty(kShelfIDKey);
+ if (key == WmWindowProperty::SHELF_ITEM_TYPE)
+ return window_->GetProperty(kShelfItemTypeKey);
+
if (key == WmWindowProperty::TOP_VIEW_INSET)
return window_->GetProperty(aura::client::kTopViewInset);
@@ -327,10 +335,18 @@ int WmWindowAura::GetIntProperty(WmWindowProperty key) {
}
void WmWindowAura::SetIntProperty(WmWindowProperty key, int value) {
+ if (key == WmWindowProperty::SHELF_ICON_ID) {
+ window_->SetProperty(kShelfIconIdKey, value);
+ return;
+ }
if (key == WmWindowProperty::SHELF_ID) {
window_->SetProperty(kShelfIDKey, value);
return;
}
+ if (key == WmWindowProperty::SHELF_ITEM_TYPE) {
+ window_->SetProperty(kShelfItemTypeKey, value);
+ return;
+ }
if (key == WmWindowProperty::TOP_VIEW_INSET) {
window_->SetProperty(aura::client::kTopViewInset, value);
return;
@@ -339,20 +355,6 @@ void WmWindowAura::SetIntProperty(WmWindowProperty key, int value) {
NOTREACHED();
}
-ShelfItemDetails* WmWindowAura::GetShelfItemDetails() {
- return window_->GetProperty(kShelfItemDetailsKey);
-}
-
-void WmWindowAura::SetShelfItemDetails(const ShelfItemDetails& details) {
- // |item_details| is owned by |window_|.
- ShelfItemDetails* item_details = new ShelfItemDetails(details);
- window_->SetProperty(kShelfItemDetailsKey, item_details);
-}
-
-void WmWindowAura::ClearShelfItemDetails() {
- window_->ClearProperty(kShelfItemDetailsKey);
-}
-
const wm::WindowState* WmWindowAura::GetWindowState() const {
return ash::wm::GetWindowState(window_);
}
@@ -818,10 +820,12 @@ void WmWindowAura::OnWindowPropertyChanged(aura::Window* window,
wm_property = WmWindowProperty::EXCLUDE_FROM_MRU;
} else if (key == aura::client::kModalKey) {
wm_property = WmWindowProperty::MODAL_TYPE;
+ } else if (key == kShelfIconIdKey) {
+ wm_property = WmWindowProperty::SHELF_ICON_ID;
} else if (key == kShelfIDKey) {
wm_property = WmWindowProperty::SHELF_ID;
- } else if (key == kShelfItemDetailsKey) {
- wm_property = WmWindowProperty::SHELF_ITEM_DETAILS;
+ } else if (key == kShelfItemTypeKey) {
+ wm_property = WmWindowProperty::SHELF_ITEM_TYPE;
} else if (key == kSnapChildrenToPixelBoundary) {
wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY;
} else if (key == aura::client::kTopViewInset) {

Powered by Google App Engine
This is Rietveld 408576698