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

Unified Diff: ash/wm/aura/wm_window_aura.cc

Issue 2012343002: Converts overview to use common ash types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 4 years, 7 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/wm/aura/wm_window_aura.cc
diff --git a/ash/wm/aura/wm_window_aura.cc b/ash/wm/aura/wm_window_aura.cc
index 53afa3a0e9203f12537297c669b14fb29d35104a..405cd684aeaa1f58899b43c13f98097fdad7515e 100644
--- a/ash/wm/aura/wm_window_aura.cc
+++ b/ash/wm/aura/wm_window_aura.cc
@@ -29,6 +29,7 @@
#include "ui/compositor/layer_tree_owner.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/screen.h"
+#include "ui/views/widget/widget.h"
#include "ui/wm/core/coordinate_conversion.h"
#include "ui/wm/core/window_util.h"
@@ -78,15 +79,16 @@ WmWindowAura::WmWindowAura(aura::Window* window)
}
// static
-WmWindow* WmWindowAura::Get(aura::Window* window) {
+const WmWindow* WmWindowAura::Get(const aura::Window* window) {
if (!window)
return nullptr;
- WmWindow* wm_window = window->GetProperty(kWmWindowKey);
+ const WmWindow* wm_window = window->GetProperty(kWmWindowKey);
if (wm_window)
return wm_window;
// WmWindowAura is owned by the aura::Window.
- return new WmWindowAura(window);
+ // TODO(sky): fix constness.
+ return new WmWindowAura(const_cast<aura::Window*>(window));
}
// static
@@ -117,6 +119,10 @@ WmGlobals* WmWindowAura::GetGlobals() const {
return WmGlobals::Get();
}
+base::string16 WmWindowAura::GetTitle() const {
+ return window_->title();
+}
+
void WmWindowAura::SetShellWindowId(int id) {
window_->set_id(id);
}
@@ -192,6 +198,22 @@ bool WmWindowAura::IsVisible() const {
return window_->IsVisible();
}
+void WmWindowAura::SetOpacity(float opacity) {
+ window_->layer()->SetOpacity(opacity);
+}
+
+float WmWindowAura::GetTargetOpacity() const {
+ return window_->layer()->GetTargetOpacity();
+}
+
+void WmWindowAura::SetTransform(const gfx::Transform& transform) {
+ window_->SetTransform(transform);
+}
+
+gfx::Transform WmWindowAura::GetTargetTransform() const {
+ return window_->layer()->GetTargetTransform();
+}
+
bool WmWindowAura::IsSystemModal() const {
return window_->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM;
}
@@ -216,6 +238,9 @@ int WmWindowAura::GetIntProperty(WmWindowProperty key) {
if (key == WmWindowProperty::SHELF_ID)
return GetShelfIDForWindow(window_);
+ if (key == WmWindowProperty::TOP_VIEW_INSET)
+ return window_->GetProperty(aura::client::kTopViewInset);
+
NOTREACHED();
return 0;
}
@@ -270,10 +295,20 @@ void WmWindowAura::SetVisibilityAnimationDuration(base::TimeDelta delta) {
::wm::SetWindowVisibilityAnimationDuration(window_, delta);
}
+void WmWindowAura::SetVisibilityAnimationTransition(
+ ::wm::WindowVisibilityAnimationTransition transition) {
+ ::wm::SetWindowVisibilityAnimationTransition(window_, transition);
+}
+
void WmWindowAura::Animate(::wm::WindowAnimationType type) {
::wm::AnimateWindow(window_, type);
}
+void WmWindowAura::StopAnimatingProperty(
+ ui::LayerAnimationElement::AnimatableProperty property) {
+ window_->layer()->GetAnimator()->StopAnimatingProperty(property);
+}
+
void WmWindowAura::SetBounds(const gfx::Rect& bounds) {
window_->SetBounds(bounds);
}
@@ -450,6 +485,10 @@ void WmWindowAura::Show() {
window_->Show();
}
+void WmWindowAura::Close() {
+ views::Widget::GetWidgetForNativeView(window_)->Close();
James Cook 2016/05/27 00:02:51 This seems a little dangerous to me, since not eve
sky 2016/05/27 03:18:03 Both it is.
+}
+
bool WmWindowAura::IsFocused() const {
return window_->HasFocus();
}
@@ -553,6 +592,8 @@ void WmWindowAura::OnWindowPropertyChanged(aura::Window* window,
wm_property = WmWindowProperty::ALWAYS_ON_TOP;
} else if (key == kShelfID) {
wm_property = WmWindowProperty::SHELF_ID;
+ } else if (key == aura::client::kTopViewInset) {
+ wm_property = WmWindowProperty::TOP_VIEW_INSET;
} else {
return;
}
@@ -577,5 +618,9 @@ void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window,
OnWindowVisibilityChanging(this, visible));
}
+void WmWindowAura::OnWindowTitleChanged(aura::Window* window) {
+ FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowTitleChanged(this));
+}
+
} // namespace wm
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698