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

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

Issue 331563003: Launching + Views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/examples/image_viewer/image_viewer.cc ('k') | mojo/mojo.gyp » ('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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "mojo/examples/window_manager/window_manager.mojom.h" 8 #include "mojo/examples/window_manager/window_manager.mojom.h"
9 #include "mojo/public/cpp/application/application.h" 9 #include "mojo/public/cpp/application/application.h"
10 #include "mojo/services/navigation/navigation.mojom.h" 10 #include "mojo/services/navigation/navigation.mojom.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 View* view = View::Create(view_manager); 106 View* view = View::Create(view_manager);
107 node->SetActiveView(view); 107 node->SetActiveView(view);
108 view->SetColor(SK_ColorBLUE); 108 view->SetColor(SK_ColorBLUE);
109 view->AddObserver(this); 109 view->AddObserver(this);
110 } 110 }
111 111
112 void CreateWindow(const std::string& url) { 112 void CreateWindow(const std::string& url) {
113 ViewTreeNode* node = view_manager_->GetNodeById(parent_node_id_); 113 ViewTreeNode* node = view_manager_->GetNodeById(parent_node_id_);
114 114
115 gfx::Rect bounds(50, 50, 200, 200); 115 gfx::Rect bounds(50, 50, 400, 400);
116 if (!node->children().empty()) { 116 if (!node->children().empty()) {
117 gfx::Point position = node->children().back()->bounds().origin(); 117 gfx::Point position = node->children().back()->bounds().origin();
118 position.Offset(50, 50); 118 position.Offset(50, 50);
119 bounds.set_origin(position); 119 bounds.set_origin(position);
120 } 120 }
121 121
122 ViewTreeNode* embedded = ViewTreeNode::Create(view_manager_); 122 ViewTreeNode* embedded = ViewTreeNode::Create(view_manager_);
123 node->AddChild(embedded); 123 node->AddChild(embedded);
124 embedded->SetBounds(bounds); 124 embedded->SetBounds(bounds);
125 embedded->Embed(url); 125 embedded->Embed(url);
(...skipping 27 matching lines...) Expand all
153 } 153 }
154 154
155 } // namespace examples 155 } // namespace examples
156 156
157 // static 157 // static
158 Application* Application::Create() { 158 Application* Application::Create() {
159 return new examples::WindowManager; 159 return new examples::WindowManager;
160 } 160 }
161 161
162 } // namespace mojo 162 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/image_viewer/image_viewer.cc ('k') | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698