| 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 "components/web_view/web_view_impl.h" | 5 #include "components/web_view/web_view_impl.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 content_ = root_->connection()->CreateWindow(); | 77 content_ = root_->connection()->CreateWindow(); |
| 78 content_->SetBounds(*mojo::Rect::From( | 78 content_->SetBounds(*mojo::Rect::From( |
| 79 gfx::Rect(0, 0, root_->bounds().width, root_->bounds().height))); | 79 gfx::Rect(0, 0, root_->bounds().width, root_->bounds().height))); |
| 80 root_->AddChild(content_); | 80 root_->AddChild(content_); |
| 81 content_->SetVisible(true); | 81 content_->SetVisible(true); |
| 82 content_->AddObserver(this); | 82 content_->AddObserver(this); |
| 83 | 83 |
| 84 scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass()); | 84 scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass()); |
| 85 scoped_ptr<FrameConnection> frame_connection( | 85 scoped_ptr<FrameConnection> frame_connection( |
| 86 pending_load->frame_connection()); | 86 pending_load->frame_connection()); |
| 87 mojo::ViewTreeClientPtr view_tree_client = | 87 mus::mojom::WindowTreeClientPtr window_tree_client = |
| 88 frame_connection->GetViewTreeClient(); | 88 frame_connection->GetWindowTreeClient(); |
| 89 | 89 |
| 90 Frame::ClientPropertyMap client_properties; | 90 Frame::ClientPropertyMap client_properties; |
| 91 if (devtools_agent_) { | 91 if (devtools_agent_) { |
| 92 devtools_service::DevToolsAgentPtr forward_agent; | 92 devtools_service::DevToolsAgentPtr forward_agent; |
| 93 frame_connection->application_connection()->ConnectToService( | 93 frame_connection->application_connection()->ConnectToService( |
| 94 &forward_agent); | 94 &forward_agent); |
| 95 devtools_agent_->AttachFrame(forward_agent.Pass(), &client_properties); | 95 devtools_agent_->AttachFrame(forward_agent.Pass(), &client_properties); |
| 96 } | 96 } |
| 97 | 97 |
| 98 mojom::FrameClient* frame_client = frame_connection->frame_client(); | 98 mojom::FrameClient* frame_client = frame_connection->frame_client(); |
| 99 const uint32_t content_handler_id = frame_connection->GetContentHandlerID(); | 99 const uint32_t content_handler_id = frame_connection->GetContentHandlerID(); |
| 100 frame_tree_.reset(new FrameTree(content_handler_id, content_, | 100 frame_tree_.reset(new FrameTree(content_handler_id, content_, |
| 101 view_tree_client.Pass(), this, frame_client, | 101 window_tree_client.Pass(), this, frame_client, |
| 102 frame_connection.Pass(), client_properties, | 102 frame_connection.Pass(), client_properties, |
| 103 pending_load->navigation_start_time())); | 103 pending_load->navigation_start_time())); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void WebViewImpl::PreOrderDepthFirstTraverseTree(Frame* node, | 106 void WebViewImpl::PreOrderDepthFirstTraverseTree(Frame* node, |
| 107 std::vector<Frame*>* output) { | 107 std::vector<Frame*>* output) { |
| 108 output->push_back(node); | 108 output->push_back(node); |
| 109 for (Frame* child : node->children()) | 109 for (Frame* child : node->children()) |
| 110 PreOrderDepthFirstTraverseTree(child, output); | 110 PreOrderDepthFirstTraverseTree(child, output); |
| 111 } | 111 } |
| 112 | 112 |
| 113 //////////////////////////////////////////////////////////////////////////////// | 113 //////////////////////////////////////////////////////////////////////////////// |
| 114 // WebViewImpl, WebView implementation: | 114 // WebViewImpl, WebView implementation: |
| 115 | 115 |
| 116 void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { | 116 void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { |
| 117 navigation_controller_.LoadURL(request.Pass()); | 117 navigation_controller_.LoadURL(request.Pass()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void WebViewImpl::GetViewTreeClient( | 120 void WebViewImpl::GetWindowTreeClient( |
| 121 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) { | 121 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> window_tree_client) { |
| 122 mus::WindowTreeConnection::Create( | 122 mus::WindowTreeConnection::Create( |
| 123 this, view_tree_client.Pass(), | 123 this, window_tree_client.Pass(), |
| 124 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); | 124 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void WebViewImpl::Find(const mojo::String& search_text, | 127 void WebViewImpl::Find(const mojo::String& search_text, |
| 128 bool forward_direction) { | 128 bool forward_direction) { |
| 129 find_controller_.Find(search_text.To<std::string>(), forward_direction); | 129 find_controller_.Find(search_text.To<std::string>(), forward_direction); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void WebViewImpl::StopFinding() { | 132 void WebViewImpl::StopFinding() { |
| 133 find_controller_.StopFinding(); | 133 find_controller_.StopFinding(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 std::vector<Frame*> all_frames; | 285 std::vector<Frame*> all_frames; |
| 286 PreOrderDepthFirstTraverseTree(frame_tree_->root(), &all_frames); | 286 PreOrderDepthFirstTraverseTree(frame_tree_->root(), &all_frames); |
| 287 return all_frames; | 287 return all_frames; |
| 288 } | 288 } |
| 289 | 289 |
| 290 mojom::WebViewClient* WebViewImpl::GetWebViewClient() { | 290 mojom::WebViewClient* WebViewImpl::GetWebViewClient() { |
| 291 return client_.get(); | 291 return client_.get(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace web_view | 294 } // namespace web_view |
| OLD | NEW |