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

Side by Side Diff: services/view_manager/connection_manager.cc

Issue 1375313006: For c++, Generate enum classes instead of enum from mojom. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 "services/view_manager/connection_manager.h" 5 #include "services/view_manager/connection_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "mojo/converters/geometry/geometry_type_converters.h" 9 #include "mojo/converters/geometry/geometry_type_converters.h"
10 #include "mojo/converters/input_events/input_events_type_converters.h" 10 #include "mojo/converters/input_events/input_events_type_converters.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Recurses through all the children of |view| moving any cloned views to 50 // Recurses through all the children of |view| moving any cloned views to
51 // |new_parent| stacked above |stack_above|. |stack_above| is updated as views 51 // |new_parent| stacked above |stack_above|. |stack_above| is updated as views
52 // are moved. 52 // are moved.
53 void ReparentClonedViews(ServerView* new_parent, 53 void ReparentClonedViews(ServerView* new_parent,
54 ServerView** stack_above, 54 ServerView** stack_above,
55 ServerView* view) { 55 ServerView* view) {
56 if (view->id() == ClonedViewId()) { 56 if (view->id() == ClonedViewId()) {
57 const gfx::Rect new_bounds(ConvertRectBetweenViews( 57 const gfx::Rect new_bounds(ConvertRectBetweenViews(
58 view, new_parent, gfx::Rect(view->bounds().size()))); 58 view, new_parent, gfx::Rect(view->bounds().size())));
59 new_parent->Add(view); 59 new_parent->Add(view);
60 new_parent->Reorder(view, *stack_above, mojo::ORDER_DIRECTION_ABOVE); 60 new_parent->Reorder(view, *stack_above, mojo::OrderDirection::ABOVE);
61 view->SetBounds(new_bounds); 61 view->SetBounds(new_bounds);
62 *stack_above = view; 62 *stack_above = view;
63 return; 63 return;
64 } 64 }
65 65
66 for (ServerView* child : view->GetChildren()) 66 for (ServerView* child : view->GetChildren())
67 ReparentClonedViews(new_parent, stack_above, child); 67 ReparentClonedViews(new_parent, stack_above, child);
68 } 68 }
69 69
70 // Deletes |view| and all its descendants. 70 // Deletes |view| and all its descendants.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 ServerView* view = GetView(view_id); 258 ServerView* view = GetView(view_id);
259 if (!view || !view->IsDrawn(root_.get()) || view == root_.get()) 259 if (!view || !view->IsDrawn(root_.get()) || view == root_.get())
260 return false; 260 return false;
261 if (!animation_timer_.IsRunning()) { 261 if (!animation_timer_.IsRunning()) {
262 animation_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(100), 262 animation_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(100),
263 this, &ConnectionManager::DoAnimation); 263 this, &ConnectionManager::DoAnimation);
264 } 264 }
265 ServerView* clone = CloneView(view, this); 265 ServerView* clone = CloneView(view, this);
266 CloneViewTree(view, clone, this); 266 CloneViewTree(view, clone, this);
267 view->parent()->Add(clone); 267 view->parent()->Add(clone);
268 view->parent()->Reorder(clone, view, mojo::ORDER_DIRECTION_ABOVE); 268 view->parent()->Reorder(clone, view, mojo::OrderDirection::ABOVE);
269 return true; 269 return true;
270 } 270 }
271 271
272 void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view, 272 void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view,
273 const gfx::Rect& old_bounds, 273 const gfx::Rect& old_bounds,
274 const gfx::Rect& new_bounds) { 274 const gfx::Rect& new_bounds) {
275 for (auto& pair : connection_map_) { 275 for (auto& pair : connection_map_) {
276 pair.second->service()->ProcessViewBoundsChanged( 276 pair.second->service()->ProcessViewBoundsChanged(
277 view, old_bounds, new_bounds, IsChangeSource(pair.first)); 277 view, old_bounds, new_bounds, IsChangeSource(pair.first));
278 } 278 }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { 498 void ConnectionManager::SetViewportSize(mojo::SizePtr size) {
499 gfx::Size new_size = size.To<gfx::Size>(); 499 gfx::Size new_size = size.To<gfx::Size>();
500 display_manager_->SetViewportSize(new_size); 500 display_manager_->SetViewportSize(new_size);
501 } 501 }
502 502
503 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { 503 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) {
504 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); 504 CloneAndAnimate(ViewIdFromTransportId(transport_view_id));
505 } 505 }
506 506
507 } // namespace view_manager 507 } // namespace view_manager
OLDNEW
« no previous file with comments | « services/view_manager/animation_runner_unittest.cc ('k') | services/view_manager/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698