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

Side by Side Diff: examples/recipes/window_manager/window_manager.cc

Issue 818583002: Moves Create() off of View and onto ViewManager (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: merge 2 trunk Created 6 years 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
« no previous file with comments | « examples/nesting_app/nesting_app.cc ('k') | examples/window_manager/window_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "examples/recipes/window_manager/window_manager.h" 5 #include "examples/recipes/window_manager/window_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "examples/recipes/window_manager/constants.h" 9 #include "examples/recipes/window_manager/constants.h"
10 #include "mojo/services/view_manager/public/cpp/view_manager.h"
10 #include "mojo/services/view_manager/public/cpp/view_property.h" 11 #include "mojo/services/view_manager/public/cpp/view_property.h"
11 12
12 using mojo::View; 13 using mojo::View;
13 14
14 namespace recipes { 15 namespace recipes {
15 namespace window_manager { 16 namespace window_manager {
16 namespace { 17 namespace {
17 18
18 enum WindowType { 19 enum WindowType {
19 WINDOW_TYPE_IMMERSIVE, 20 WINDOW_TYPE_IMMERSIVE,
(...skipping 14 matching lines...) Expand all
34 active_immersive_view_(nullptr), 35 active_immersive_view_(nullptr),
35 active_transient_view_(nullptr) { 36 active_transient_view_(nullptr) {
36 } 37 }
37 38
38 WindowManager::~WindowManager() { 39 WindowManager::~WindowManager() {
39 for (View* view : views_) 40 for (View* view : views_)
40 view->RemoveObserver(this); 41 view->RemoveObserver(this);
41 } 42 }
42 43
43 View* WindowManager::Create() { 44 View* WindowManager::Create() {
44 View* view = View::Create(root_->view_manager()); 45 View* view = root_->view_manager()->CreateView();
45 UpdateBounds(view); 46 UpdateBounds(view);
46 view->AddObserver(this); 47 view->AddObserver(this);
47 views_.insert(view); 48 views_.insert(view);
48 return view; 49 return view;
49 } 50 }
50 51
51 void WindowManager::UpdateBounds(View* view) { 52 void WindowManager::UpdateBounds(View* view) {
52 mojo::Rect bounds(root_->bounds()); 53 mojo::Rect bounds(root_->bounds());
53 bounds.x = bounds.y = 0; 54 bounds.x = bounds.y = 0;
54 if (view->GetLocalProperty(kWindowTypeLocalKey) == WINDOW_TYPE_TRANSIENT) { 55 if (view->GetLocalProperty(kWindowTypeLocalKey) == WINDOW_TYPE_TRANSIENT) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 189 }
189 } 190 }
190 191
191 void WindowManager::OnViewEmbeddedAppDisconnected(View* view) { 192 void WindowManager::OnViewEmbeddedAppDisconnected(View* view) {
192 ProcessViewShouldNoLongerBeActive(view); 193 ProcessViewShouldNoLongerBeActive(view);
193 view->Destroy(); 194 view->Destroy();
194 } 195 }
195 196
196 } // window_manager 197 } // window_manager
197 } // recipes 198 } // recipes
OLDNEW
« no previous file with comments | « examples/nesting_app/nesting_app.cc ('k') | examples/window_manager/window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698