| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mandoline/ui/phone_ui/phone_browser_application_delegate.h" | 5 #include "mandoline/ui/phone_ui/phone_browser_application_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "components/view_manager/public/cpp/view.h" | 8 #include "components/view_manager/public/cpp/view.h" |
| 9 #include "components/view_manager/public/cpp/view_tree_connection.h" | 9 #include "components/view_manager/public/cpp/view_tree_connection.h" |
| 10 #include "components/view_manager/public/cpp/view_tree_host_factory.h" | 10 #include "components/view_manager/public/cpp/view_tree_host_factory.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 request->url = url; | 64 request->url = url; |
| 65 web_view_.web_view()->LoadRequest(request.Pass()); | 65 web_view_.web_view()->LoadRequest(request.Pass()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 //////////////////////////////////////////////////////////////////////////////// | 68 //////////////////////////////////////////////////////////////////////////////// |
| 69 // PhoneBrowserApplicationDelegate, mojo::ViewTreeDelegate implementation: | 69 // PhoneBrowserApplicationDelegate, mojo::ViewTreeDelegate implementation: |
| 70 | 70 |
| 71 void PhoneBrowserApplicationDelegate::OnEmbed(mojo::View* root) { | 71 void PhoneBrowserApplicationDelegate::OnEmbed(mojo::View* root) { |
| 72 CHECK(!root_); | 72 CHECK(!root_); |
| 73 root_ = root; | 73 root_ = root; |
| 74 root->connection()->SetEmbedRoot(); | |
| 75 content_ = root->connection()->CreateView(); | 74 content_ = root->connection()->CreateView(); |
| 76 root->AddChild(content_); | 75 root->AddChild(content_); |
| 77 content_->SetBounds(root->bounds()); | 76 content_->SetBounds(root->bounds()); |
| 78 content_->SetVisible(true); | 77 content_->SetVisible(true); |
| 79 root->AddObserver(this); | 78 root->AddObserver(this); |
| 80 | 79 |
| 81 host_->SetSize(mojo::Size::From(gfx::Size(320, 640))); | 80 host_->SetSize(mojo::Size::From(gfx::Size(320, 640))); |
| 81 content_->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT); |
| 82 web_view_.Init(app_, content_); | 82 web_view_.Init(app_, content_); |
| 83 LaunchURL(default_url_); | 83 LaunchURL(default_url_); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void PhoneBrowserApplicationDelegate::OnConnectionLost( | 86 void PhoneBrowserApplicationDelegate::OnConnectionLost( |
| 87 mojo::ViewTreeConnection* connection) { | 87 mojo::ViewTreeConnection* connection) { |
| 88 } | 88 } |
| 89 | 89 |
| 90 //////////////////////////////////////////////////////////////////////////////// | 90 //////////////////////////////////////////////////////////////////////////////// |
| 91 // PhoneBrowserApplicationDelegate, mojo::ViewObserver implementation: | 91 // PhoneBrowserApplicationDelegate, mojo::ViewObserver implementation: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // PhoneBrowserApplicationDelegate, | 124 // PhoneBrowserApplicationDelegate, |
| 125 // mojo::InterfaceFactory<LaunchHandler> implementation: | 125 // mojo::InterfaceFactory<LaunchHandler> implementation: |
| 126 | 126 |
| 127 void PhoneBrowserApplicationDelegate::Create( | 127 void PhoneBrowserApplicationDelegate::Create( |
| 128 mojo::ApplicationConnection* connection, | 128 mojo::ApplicationConnection* connection, |
| 129 mojo::InterfaceRequest<LaunchHandler> request) { | 129 mojo::InterfaceRequest<LaunchHandler> request) { |
| 130 launch_handler_bindings_.AddBinding(this, request.Pass()); | 130 launch_handler_bindings_.AddBinding(this, request.Pass()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace mandoline | 133 } // namespace mandoline |
| OLD | NEW |