| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |