| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void PhoneBrowserApplicationDelegate::LaunchURL(const mojo::String& url) { | 59 void PhoneBrowserApplicationDelegate::LaunchURL(const mojo::String& url) { |
| 60 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 60 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 61 request->url = url; | 61 request->url = url; |
| 62 web_view_.web_view()->LoadRequest(request.Pass()); | 62 web_view_.web_view()->LoadRequest(request.Pass()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 //////////////////////////////////////////////////////////////////////////////// | 65 //////////////////////////////////////////////////////////////////////////////// |
| 66 // PhoneBrowserApplicationDelegate, mojo::ViewTreeDelegate implementation: | 66 // PhoneBrowserApplicationDelegate, mojo::ViewTreeDelegate implementation: |
| 67 | 67 |
| 68 void PhoneBrowserApplicationDelegate::OnEmbed(mojo::View* root) { | 68 void PhoneBrowserApplicationDelegate::OnEmbed(mojo::View* root) { |
| 69 root->connection()->SetEmbedRoot(); | |
| 70 content_ = root->connection()->CreateView(); | 69 content_ = root->connection()->CreateView(); |
| 71 root->AddChild(content_); | 70 root->AddChild(content_); |
| 72 content_->SetBounds(root->bounds()); | 71 content_->SetBounds(root->bounds()); |
| 73 content_->SetVisible(true); | 72 content_->SetVisible(true); |
| 74 | 73 |
| 75 host_->SetSize(mojo::Size::From(gfx::Size(320, 640))); | 74 host_->SetSize(mojo::Size::From(gfx::Size(320, 640))); |
| 75 content_->SetAccessPolicy(mojo::ViewTree::kAccessPolicyEmbedRoot); |
| 76 web_view_.Init(app_, content_); | 76 web_view_.Init(app_, content_); |
| 77 LaunchURL(default_url_); | 77 LaunchURL(default_url_); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void PhoneBrowserApplicationDelegate::OnConnectionLost( | 80 void PhoneBrowserApplicationDelegate::OnConnectionLost( |
| 81 mojo::ViewTreeConnection* connection) { | 81 mojo::ViewTreeConnection* connection) { |
| 82 } | 82 } |
| 83 | 83 |
| 84 //////////////////////////////////////////////////////////////////////////////// | 84 //////////////////////////////////////////////////////////////////////////////// |
| 85 // PhoneBrowserApplicationDelegate, mojo::ViewObserver implementation: | 85 // PhoneBrowserApplicationDelegate, mojo::ViewObserver implementation: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // PhoneBrowserApplicationDelegate, | 117 // PhoneBrowserApplicationDelegate, |
| 118 // mojo::InterfaceFactory<LaunchHandler> implementation: | 118 // mojo::InterfaceFactory<LaunchHandler> implementation: |
| 119 | 119 |
| 120 void PhoneBrowserApplicationDelegate::Create( | 120 void PhoneBrowserApplicationDelegate::Create( |
| 121 mojo::ApplicationConnection* connection, | 121 mojo::ApplicationConnection* connection, |
| 122 mojo::InterfaceRequest<LaunchHandler> request) { | 122 mojo::InterfaceRequest<LaunchHandler> request) { |
| 123 launch_handler_bindings_.AddBinding(this, request.Pass()); | 123 launch_handler_bindings_.AddBinding(this, request.Pass()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace mandoline | 126 } // namespace mandoline |
| OLD | NEW |