| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "examples/bitmap_uploader/bitmap_uploader.h" | 10 #include "examples/bitmap_uploader/bitmap_uploader.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 uploader->Init(shell_); | 92 uploader->Init(shell_); |
| 93 uploader->SetColor(kColors[embed_count_++ % arraysize(kColors)]); | 93 uploader->SetColor(kColors[embed_count_++ % arraysize(kColors)]); |
| 94 | 94 |
| 95 mojo::View* embed = mojo::View::Create(view_manager); | 95 mojo::View* embed = mojo::View::Create(view_manager); |
| 96 root->AddChild(embed); | 96 root->AddChild(embed); |
| 97 mojo::Rect bounds; | 97 mojo::Rect bounds; |
| 98 bounds.x = bounds.y = 25; | 98 bounds.x = bounds.y = 25; |
| 99 bounds.width = root->bounds().width - 50; | 99 bounds.width = root->bounds().width - 50; |
| 100 bounds.height = root->bounds().height - 50; | 100 bounds.height = root->bounds().height - 50; |
| 101 embed->SetBounds(bounds); | 101 embed->SetBounds(bounds); |
| 102 embed->SetVisible(true); |
| 102 | 103 |
| 103 scoped_ptr<mojo::ServiceProviderImpl> registry( | 104 scoped_ptr<mojo::ServiceProviderImpl> registry( |
| 104 new mojo::ServiceProviderImpl); | 105 new mojo::ServiceProviderImpl); |
| 105 // Expose some services to the embeddee... | 106 // Expose some services to the embeddee... |
| 106 registry->AddService(&embedder_factory_); | 107 registry->AddService(&embedder_factory_); |
| 107 scoped_ptr<mojo::ServiceProvider> imported = | 108 scoped_ptr<mojo::ServiceProvider> imported = |
| 108 embed->Embed("mojo:wm_flow_embedded", registry.Pass()); | 109 embed->Embed("mojo:wm_flow_embedded", registry.Pass()); |
| 109 mojo::ConnectToService(imported.get(), &embeddee_); | 110 mojo::ConnectToService(imported.get(), &embeddee_); |
| 110 embeddee_->HelloBack(base::Bind(&WMFlowApp::HelloBackAck, | 111 embeddee_->HelloBack(base::Bind(&WMFlowApp::HelloBackAck, |
| 111 base::Unretained(this))); | 112 base::Unretained(this))); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 149 |
| 149 DISALLOW_COPY_AND_ASSIGN(WMFlowApp); | 150 DISALLOW_COPY_AND_ASSIGN(WMFlowApp); |
| 150 }; | 151 }; |
| 151 | 152 |
| 152 } // namespace examples | 153 } // namespace examples |
| 153 | 154 |
| 154 MojoResult MojoMain(MojoHandle shell_handle) { | 155 MojoResult MojoMain(MojoHandle shell_handle) { |
| 155 mojo::ApplicationRunnerChromium runner(new examples::WMFlowApp); | 156 mojo::ApplicationRunnerChromium runner(new examples::WMFlowApp); |
| 156 return runner.Run(shell_handle); | 157 return runner.Run(shell_handle); |
| 157 } | 158 } |
| OLD | NEW |