| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "components/devtools_service/public/cpp/switches.h" | 8 #include "components/devtools_service/public/cpp/switches.h" |
| 9 #include "components/mus/public/cpp/scoped_view_ptr.h" | 9 #include "components/mus/public/cpp/scoped_view_ptr.h" |
| 10 #include "components/mus/public/cpp/view.h" | 10 #include "components/mus/public/cpp/view.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 frame_connection->GetViewTreeClient(); | 67 frame_connection->GetViewTreeClient(); |
| 68 | 68 |
| 69 Frame::ClientPropertyMap client_properties; | 69 Frame::ClientPropertyMap client_properties; |
| 70 if (devtools_agent_) { | 70 if (devtools_agent_) { |
| 71 devtools_service::DevToolsAgentPtr forward_agent; | 71 devtools_service::DevToolsAgentPtr forward_agent; |
| 72 frame_connection->application_connection()->ConnectToService( | 72 frame_connection->application_connection()->ConnectToService( |
| 73 &forward_agent); | 73 &forward_agent); |
| 74 devtools_agent_->AttachFrame(forward_agent.Pass(), &client_properties); | 74 devtools_agent_->AttachFrame(forward_agent.Pass(), &client_properties); |
| 75 } | 75 } |
| 76 | 76 |
| 77 FrameTreeClient* frame_tree_client = frame_connection->frame_tree_client(); | 77 mojom::FrameClient* frame_client = frame_connection->frame_client(); |
| 78 const uint32_t content_handler_id = frame_connection->GetContentHandlerID(); | 78 const uint32_t content_handler_id = frame_connection->GetContentHandlerID(); |
| 79 frame_tree_.reset(new FrameTree( | 79 frame_tree_.reset(new FrameTree(content_handler_id, content_, |
| 80 content_handler_id, content_, view_tree_client.Pass(), this, | 80 view_tree_client.Pass(), this, frame_client, |
| 81 frame_tree_client, frame_connection.Pass(), client_properties)); | 81 frame_connection.Pass(), client_properties)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 //////////////////////////////////////////////////////////////////////////////// | 84 //////////////////////////////////////////////////////////////////////////////// |
| 85 // WebViewImpl, WebView implementation: | 85 // WebViewImpl, WebView implementation: |
| 86 | 86 |
| 87 void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { | 87 void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { |
| 88 navigation_controller_.LoadURL(request.Pass()); | 88 navigation_controller_.LoadURL(request.Pass()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void WebViewImpl::GetViewTreeClient( | 91 void WebViewImpl::GetViewTreeClient( |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if (view == content_) { | 148 if (view == content_) { |
| 149 frame_tree_.reset(); | 149 frame_tree_.reset(); |
| 150 content_ = nullptr; | 150 content_ = nullptr; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 //////////////////////////////////////////////////////////////////////////////// | 154 //////////////////////////////////////////////////////////////////////////////// |
| 155 // WebViewImpl, FrameTreeDelegate implementation: | 155 // WebViewImpl, FrameTreeDelegate implementation: |
| 156 | 156 |
| 157 scoped_ptr<FrameUserData> WebViewImpl::CreateUserDataForNewFrame( | 157 scoped_ptr<FrameUserData> WebViewImpl::CreateUserDataForNewFrame( |
| 158 FrameTreeClientPtr frame_tree_client) { | 158 mojom::FrameClientPtr frame_client) { |
| 159 return make_scoped_ptr( | 159 return make_scoped_ptr( |
| 160 new ClientInitiatedFrameConnection(frame_tree_client.Pass())); | 160 new ClientInitiatedFrameConnection(frame_client.Pass())); |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool WebViewImpl::CanPostMessageEventToFrame(const Frame* source, | 163 bool WebViewImpl::CanPostMessageEventToFrame(const Frame* source, |
| 164 const Frame* target, | 164 const Frame* target, |
| 165 HTMLMessageEvent* event) { | 165 mojom::HTMLMessageEvent* event) { |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void WebViewImpl::LoadingStateChanged(bool loading, double progress) { | 169 void WebViewImpl::LoadingStateChanged(bool loading, double progress) { |
| 170 client_->LoadingStateChanged(loading, progress); | 170 client_->LoadingStateChanged(loading, progress); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void WebViewImpl::TitleChanged(const mojo::String& title) { | 173 void WebViewImpl::TitleChanged(const mojo::String& title) { |
| 174 client_->TitleChanged(title); | 174 client_->TitleChanged(title); |
| 175 } | 175 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void WebViewImpl::OnDidNavigate() { | 211 void WebViewImpl::OnDidNavigate() { |
| 212 client_->BackForwardChanged(navigation_controller_.CanGoBack() | 212 client_->BackForwardChanged(navigation_controller_.CanGoBack() |
| 213 ? ButtonState::BUTTON_STATE_ENABLED | 213 ? ButtonState::BUTTON_STATE_ENABLED |
| 214 : ButtonState::BUTTON_STATE_DISABLED, | 214 : ButtonState::BUTTON_STATE_DISABLED, |
| 215 navigation_controller_.CanGoForward() | 215 navigation_controller_.CanGoForward() |
| 216 ? ButtonState::BUTTON_STATE_ENABLED | 216 ? ButtonState::BUTTON_STATE_ENABLED |
| 217 : ButtonState::BUTTON_STATE_DISABLED); | 217 : ButtonState::BUTTON_STATE_DISABLED); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace web_view | 220 } // namespace web_view |
| OLD | NEW |