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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "mojo/application/application_runner_chromium.h" | 9 #include "mojo/application/application_runner_chromium.h" |
10 #include "mojo/examples/bitmap_uploader/bitmap_uploader.h" | 10 #include "mojo/examples/bitmap_uploader/bitmap_uploader.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 View* root, | 62 View* root, |
63 ServiceProviderImpl* exported_services, | 63 ServiceProviderImpl* exported_services, |
64 scoped_ptr<ServiceProvider> imported_services) override { | 64 scoped_ptr<ServiceProvider> imported_services) override { |
65 root->AddObserver(this); | 65 root->AddObserver(this); |
66 bitmap_uploader_.reset(new BitmapUploader(root)); | 66 bitmap_uploader_.reset(new BitmapUploader(root)); |
67 bitmap_uploader_->Init(shell_); | 67 bitmap_uploader_->Init(shell_); |
68 bitmap_uploader_->SetColor(SK_ColorCYAN); | 68 bitmap_uploader_->SetColor(SK_ColorCYAN); |
69 | 69 |
70 nested_ = View::Create(view_manager); | 70 nested_ = View::Create(view_manager); |
71 root->AddChild(nested_); | 71 root->AddChild(nested_); |
72 nested_->SetBounds(gfx::Rect(20, 20, 50, 50)); | 72 Rect rect; |
| 73 rect.x = rect.y = 20; |
| 74 rect.width = rect.height = 50; |
| 75 nested_->SetBounds(rect); |
73 nested_->Embed(kEmbeddedAppURL); | 76 nested_->Embed(kEmbeddedAppURL); |
74 } | 77 } |
75 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override { | 78 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override { |
76 base::MessageLoop::current()->Quit(); | 79 base::MessageLoop::current()->Quit(); |
77 } | 80 } |
78 | 81 |
79 // Overridden from ViewObserver: | 82 // Overridden from ViewObserver: |
80 virtual void OnViewDestroyed(View* view) override { | 83 virtual void OnViewDestroyed(View* view) override { |
81 // TODO(beng): reap views & child Views. | 84 // TODO(beng): reap views & child Views. |
82 nested_ = NULL; | 85 nested_ = NULL; |
(...skipping 13 matching lines...) Expand all Loading... |
96 DISALLOW_COPY_AND_ASSIGN(NestingApp); | 99 DISALLOW_COPY_AND_ASSIGN(NestingApp); |
97 }; | 100 }; |
98 | 101 |
99 } // namespace examples | 102 } // namespace examples |
100 } // namespace mojo | 103 } // namespace mojo |
101 | 104 |
102 MojoResult MojoMain(MojoHandle shell_handle) { | 105 MojoResult MojoMain(MojoHandle shell_handle) { |
103 mojo::ApplicationRunnerChromium runner(new mojo::examples::NestingApp); | 106 mojo::ApplicationRunnerChromium runner(new mojo::examples::NestingApp); |
104 return runner.Run(shell_handle); | 107 return runner.Run(shell_handle); |
105 } | 108 } |
OLD | NEW |