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

Side by Side Diff: components/mus/ws/server_window.cc

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/mus/ws/server_window.h" 5 #include "components/mus/ws/server_window.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 12 matching lines...) Expand all
23 23
24 ServerWindow::ServerWindow(ServerWindowDelegate* delegate, 24 ServerWindow::ServerWindow(ServerWindowDelegate* delegate,
25 const WindowId& id, 25 const WindowId& id,
26 const Properties& properties) 26 const Properties& properties)
27 : delegate_(delegate), 27 : delegate_(delegate),
28 id_(id), 28 id_(id),
29 parent_(nullptr), 29 parent_(nullptr),
30 stacking_target_(nullptr), 30 stacking_target_(nullptr),
31 transient_parent_(nullptr), 31 transient_parent_(nullptr),
32 visible_(false), 32 visible_(false),
33 cursor_id_(mojom::CURSOR_NULL), 33 cursor_id_(mojom::Cursor::CURSOR_NULL),
34 opacity_(1), 34 opacity_(1),
35 can_focus_(true), 35 can_focus_(true),
36 properties_(properties), 36 properties_(properties),
37 // Don't notify newly added observers during notification. This causes 37 // Don't notify newly added observers during notification. This causes
38 // problems for code that adds an observer as part of an observer 38 // problems for code that adds an observer as part of an observer
39 // notification (such as ServerWindowDrawTracker). 39 // notification (such as ServerWindowDrawTracker).
40 observers_( 40 observers_(
41 base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) { 41 base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) {
42 DCHECK(delegate); // Must provide a delegate. 42 DCHECK(delegate); // Must provide a delegate.
43 } 43 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 void ServerWindow::Add(ServerWindow* child) { 83 void ServerWindow::Add(ServerWindow* child) {
84 // We assume validation checks happened already. 84 // We assume validation checks happened already.
85 DCHECK(child); 85 DCHECK(child);
86 DCHECK(child != this); 86 DCHECK(child != this);
87 DCHECK(!child->Contains(this)); 87 DCHECK(!child->Contains(this));
88 if (child->parent() == this) { 88 if (child->parent() == this) {
89 if (children_.size() == 1) 89 if (children_.size() == 1)
90 return; // Already in the right position. 90 return; // Already in the right position.
91 child->Reorder(children_.back(), mojom::ORDER_DIRECTION_ABOVE); 91 child->Reorder(children_.back(), mojom::OrderDirection::ABOVE);
92 return; 92 return;
93 } 93 }
94 94
95 ServerWindow* old_parent = child->parent(); 95 ServerWindow* old_parent = child->parent();
96 FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_, 96 FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_,
97 OnWillChangeWindowHierarchy(child, this, old_parent)); 97 OnWillChangeWindowHierarchy(child, this, old_parent));
98 98
99 if (child->parent()) 99 if (child->parent())
100 child->parent()->RemoveImpl(child); 100 child->parent()->RemoveImpl(child);
101 101
(...skipping 30 matching lines...) Expand all
132 132
133 void ServerWindow::Reorder(ServerWindow* relative, 133 void ServerWindow::Reorder(ServerWindow* relative,
134 mojom::OrderDirection direction) { 134 mojom::OrderDirection direction) {
135 ReorderImpl(this, relative, direction); 135 ReorderImpl(this, relative, direction);
136 } 136 }
137 137
138 void ServerWindow::StackChildAtBottom(ServerWindow* child) { 138 void ServerWindow::StackChildAtBottom(ServerWindow* child) {
139 // There's nothing to do if the child is already at the bottom. 139 // There's nothing to do if the child is already at the bottom.
140 if (children_.size() <= 1 || child == children_.front()) 140 if (children_.size() <= 1 || child == children_.front())
141 return; 141 return;
142 child->Reorder(children_.front(), mojom::ORDER_DIRECTION_BELOW); 142 child->Reorder(children_.front(), mojom::OrderDirection::BELOW);
143 } 143 }
144 144
145 void ServerWindow::StackChildAtTop(ServerWindow* child) { 145 void ServerWindow::StackChildAtTop(ServerWindow* child) {
146 // There's nothing to do if the child is already at the top. 146 // There's nothing to do if the child is already at the top.
147 if (children_.size() <= 1 || child == children_.back()) 147 if (children_.size() <= 1 || child == children_.back())
148 return; 148 return;
149 child->Reorder(children_.back(), mojom::ORDER_DIRECTION_ABOVE); 149 child->Reorder(children_.back(), mojom::OrderDirection::ABOVE);
150 } 150 }
151 151
152 void ServerWindow::SetBounds(const gfx::Rect& bounds) { 152 void ServerWindow::SetBounds(const gfx::Rect& bounds) {
153 if (bounds_ == bounds) 153 if (bounds_ == bounds)
154 return; 154 return;
155 155
156 // TODO(fsamuel): figure out how will this work with CompositorFrames. 156 // TODO(fsamuel): figure out how will this work with CompositorFrames.
157 157
158 const gfx::Rect old_bounds = bounds_; 158 const gfx::Rect old_bounds = bounds_;
159 bounds_ = bounds; 159 bounds_ = bounds;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 if (!AdjustStackingForTransientWindows(&window, &relative, &direction, 403 if (!AdjustStackingForTransientWindows(&window, &relative, &direction,
404 window->stacking_target_)) 404 window->stacking_target_))
405 return; 405 return;
406 406
407 window->parent_->children_.erase(std::find(window->parent_->children_.begin(), 407 window->parent_->children_.erase(std::find(window->parent_->children_.begin(),
408 window->parent_->children_.end(), 408 window->parent_->children_.end(),
409 window)); 409 window));
410 Windows::iterator i = std::find(window->parent_->children_.begin(), 410 Windows::iterator i = std::find(window->parent_->children_.begin(),
411 window->parent_->children_.end(), relative); 411 window->parent_->children_.end(), relative);
412 if (direction == mojom::ORDER_DIRECTION_ABOVE) { 412 if (direction == mojom::OrderDirection::ABOVE) {
413 DCHECK(i != window->parent_->children_.end()); 413 DCHECK(i != window->parent_->children_.end());
414 window->parent_->children_.insert(++i, window); 414 window->parent_->children_.insert(++i, window);
415 } else if (direction == mojom::ORDER_DIRECTION_BELOW) { 415 } else if (direction == mojom::OrderDirection::BELOW) {
416 DCHECK(i != window->parent_->children_.end()); 416 DCHECK(i != window->parent_->children_.end());
417 window->parent_->children_.insert(i, window); 417 window->parent_->children_.insert(i, window);
418 } 418 }
419 FOR_EACH_OBSERVER(ServerWindowObserver, window->observers_, 419 FOR_EACH_OBSERVER(ServerWindowObserver, window->observers_,
420 OnWindowReordered(window, relative, direction)); 420 OnWindowReordered(window, relative, direction));
421 window->OnStackingChanged(); 421 window->OnStackingChanged();
422 } 422 }
423 423
424 // static 424 // static
425 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { 425 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) {
426 return &window->stacking_target_; 426 return &window->stacking_target_;
427 } 427 }
428 428
429 } // namespace ws 429 } // namespace ws
430 430
431 } // namespace mus 431 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698