Commit 7d441a0a authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: renames WindowMirrorView::target to source

When mirroring I think of the source as the source of the
mirror, and the target where the mirror is being displayed.
That isn't the case here.

BUG=none
TEST=none

Change-Id: Id55075cee0f96871bb6d8b6f47257a4cafad2d09
Reviewed-on: https://chromium-review.googlesource.com/c/1354576Reviewed-by: default avatarMalay Keshav <malaykeshav@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612037}
parent ff7b6c5e
...@@ -112,12 +112,12 @@ bool WindowPreview::OnMousePressed(const ui::MouseEvent& event) { ...@@ -112,12 +112,12 @@ bool WindowPreview::OnMousePressed(const ui::MouseEvent& event) {
if (!mirror_->bounds().Contains(event.location())) if (!mirror_->bounds().Contains(event.location()))
return false; return false;
aura::Window* target = mirror_->target(); aura::Window* source = mirror_->source();
if (target) { if (source) {
// The window might have been closed in the mean time. // The window might have been closed in the mean time.
// TODO: Use WindowObserver to listen to when previewed windows are // TODO: Use WindowObserver to listen to when previewed windows are
// being closed and remove this condition. // being closed and remove this condition.
wm::ActivateWindow(target); wm::ActivateWindow(source);
// This will have the effect of deleting this view. // This will have the effect of deleting this view.
delegate_->OnPreviewActivated(this); delegate_->OnPreviewActivated(this);
...@@ -128,14 +128,14 @@ bool WindowPreview::OnMousePressed(const ui::MouseEvent& event) { ...@@ -128,14 +128,14 @@ bool WindowPreview::OnMousePressed(const ui::MouseEvent& event) {
void WindowPreview::ButtonPressed(views::Button* sender, void WindowPreview::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
// The close button was pressed. // The close button was pressed.
aura::Window* target = mirror_->target(); aura::Window* source = mirror_->source();
// The window might have been closed in the mean time. // The window might have been closed in the mean time.
// TODO: Use WindowObserver to listen to when previewed windows are // TODO: Use WindowObserver to listen to when previewed windows are
// being closed and remove this condition. // being closed and remove this condition.
if (!target) if (!source)
return; return;
wm::CloseWidgetForWindow(target); wm::CloseWidgetForWindow(source);
// This will have the effect of deleting this view. // This will have the effect of deleting this view.
delegate_->OnPreviewDismissed(this); delegate_->OnPreviewDismissed(this);
......
...@@ -30,18 +30,18 @@ void EnsureAllChildrenAreVisible(ui::Layer* layer) { ...@@ -30,18 +30,18 @@ void EnsureAllChildrenAreVisible(ui::Layer* layer) {
} // namespace } // namespace
WindowMirrorView::WindowMirrorView(aura::Window* window, WindowMirrorView::WindowMirrorView(aura::Window* source,
bool trilinear_filtering_on_init) bool trilinear_filtering_on_init)
: target_(window), : source_(source),
trilinear_filtering_on_init_(trilinear_filtering_on_init) { trilinear_filtering_on_init_(trilinear_filtering_on_init) {
DCHECK(window); DCHECK(source);
} }
WindowMirrorView::~WindowMirrorView() { WindowMirrorView::~WindowMirrorView() {
// Make sure |target_| has outlived |this|. See crbug.com/681207 // Make sure |source_| has outlived |this|. See crbug.com/681207
DCHECK(target_->layer()); DCHECK(source_->layer());
if (layer_owner_) if (layer_owner_)
target_->ClearProperty(aura::client::kMirroringEnabledKey); source_->ClearProperty(aura::client::kMirroringEnabledKey);
} }
void WindowMirrorView::RecreateMirrorLayers() { void WindowMirrorView::RecreateMirrorLayers() {
...@@ -66,7 +66,7 @@ void WindowMirrorView::Layout() { ...@@ -66,7 +66,7 @@ void WindowMirrorView::Layout() {
gfx::Transform transform; gfx::Transform transform;
gfx::Rect client_area_bounds = GetClientAreaBounds(); gfx::Rect client_area_bounds = GetClientAreaBounds();
// Scale down if necessary. // Scale down if necessary.
if (size() != target_->bounds().size()) { if (size() != source_->bounds().size()) {
const float scale = const float scale =
width() / static_cast<float>(client_area_bounds.width()); width() / static_cast<float>(client_area_bounds.width());
transform.Scale(scale, scale); transform.Scale(scale, scale);
...@@ -87,9 +87,9 @@ void WindowMirrorView::OnVisibleBoundsChanged() { ...@@ -87,9 +87,9 @@ void WindowMirrorView::OnVisibleBoundsChanged() {
void WindowMirrorView::InitLayerOwner() { void WindowMirrorView::InitLayerOwner() {
if (!layer_owner_) if (!layer_owner_)
target_->SetProperty(aura::client::kMirroringEnabledKey, true); source_->SetProperty(aura::client::kMirroringEnabledKey, true);
layer_owner_ = ::wm::MirrorLayers(target_, false /* sync_bounds */); layer_owner_ = ::wm::MirrorLayers(source_, false /* sync_bounds */);
SetPaintToLayer(); SetPaintToLayer();
...@@ -98,8 +98,8 @@ void WindowMirrorView::InitLayerOwner() { ...@@ -98,8 +98,8 @@ void WindowMirrorView::InitLayerOwner() {
// This causes us to clip the non-client areas of the window. // This causes us to clip the non-client areas of the window.
layer()->SetMasksToBounds(true); layer()->SetMasksToBounds(true);
// Some extra work is needed when the target window is minimized. // Some extra work is needed when the source window is minimized.
if (wm::GetWindowState(target_)->IsMinimized()) { if (wm::GetWindowState(source_)->IsMinimized()) {
mirror_layer->SetOpacity(1); mirror_layer->SetOpacity(1);
EnsureAllChildrenAreVisible(mirror_layer); EnsureAllChildrenAreVisible(mirror_layer);
} }
...@@ -117,14 +117,14 @@ ui::Layer* WindowMirrorView::GetMirrorLayer() { ...@@ -117,14 +117,14 @@ ui::Layer* WindowMirrorView::GetMirrorLayer() {
} }
gfx::Rect WindowMirrorView::GetClientAreaBounds() const { gfx::Rect WindowMirrorView::GetClientAreaBounds() const {
int inset = target_->GetProperty(aura::client::kTopViewInset); int inset = source_->GetProperty(aura::client::kTopViewInset);
if (inset > 0) { if (inset > 0) {
gfx::Rect bounds(target_->bounds().size()); gfx::Rect bounds(source_->bounds().size());
bounds.Inset(0, inset, 0, 0); bounds.Inset(0, inset, 0, 0);
return bounds; return bounds;
} }
// The target window may not have a widget in unit tests. // The source window may not have a widget in unit tests.
views::Widget* widget = GetInternalWidgetForWindow(target_); views::Widget* widget = GetInternalWidgetForWindow(source_);
if (!widget) if (!widget)
return gfx::Rect(); return gfx::Rect();
views::View* client_view = widget->client_view(); views::View* client_view = widget->client_view();
......
...@@ -23,14 +23,14 @@ namespace ash { ...@@ -23,14 +23,14 @@ namespace ash {
namespace wm { namespace wm {
// A view that mirrors the client area of a single window. // A view that mirrors the client area of a single (source) window.
class WindowMirrorView : public views::View { class WindowMirrorView : public views::View {
public: public:
WindowMirrorView(aura::Window* window, bool trilinear_filtering_on_init); WindowMirrorView(aura::Window* source, bool trilinear_filtering_on_init);
~WindowMirrorView() override; ~WindowMirrorView() override;
// Returns the |target_| window. // Returns the source of the mirror.
aura::Window* target() { return target_; } aura::Window* source() { return source_; }
// Recreates |layer_owner_|. // Recreates |layer_owner_|.
void RecreateMirrorLayers(); void RecreateMirrorLayers();
...@@ -44,7 +44,7 @@ class WindowMirrorView : public views::View { ...@@ -44,7 +44,7 @@ class WindowMirrorView : public views::View {
private: private:
void InitLayerOwner(); void InitLayerOwner();
// Gets the root of the layer tree that was lifted from |target_| (and is now // Gets the root of the layer tree that was lifted from |source_| (and is now
// a child of |this->layer()|). // a child of |this->layer()|).
ui::Layer* GetMirrorLayer(); ui::Layer* GetMirrorLayer();
...@@ -53,7 +53,7 @@ class WindowMirrorView : public views::View { ...@@ -53,7 +53,7 @@ class WindowMirrorView : public views::View {
gfx::Rect GetClientAreaBounds() const; gfx::Rect GetClientAreaBounds() const;
// The original window that is being represented by |this|. // The original window that is being represented by |this|.
aura::Window* target_; aura::Window* source_;
// Retains ownership of the mirror layer tree. This is lazily initialized // Retains ownership of the mirror layer tree. This is lazily initialized
// the first time the view becomes visible. // the first time the view becomes visible.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment