| 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/tab/web_view_impl.h" | 5 #include "mandoline/tab/web_view_impl.h" |
| 6 | 6 |
| 7 #include "components/view_manager/public/cpp/view.h" | 7 #include "components/view_manager/public/cpp/view.h" |
| 8 #include "components/view_manager/public/cpp/view_manager.h" | 8 #include "components/view_manager/public/cpp/view_manager.h" |
| 9 #include "mandoline/tab/frame.h" | 9 #include "mandoline/tab/frame.h" |
| 10 #include "mandoline/tab/frame_connection.h" | 10 #include "mandoline/tab/frame_connection.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 void WebViewImpl::ProgressChanged(double progress) { | 131 void WebViewImpl::ProgressChanged(double progress) { |
| 132 client_->ProgressChanged(progress); | 132 client_->ProgressChanged(progress); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void WebViewImpl::RequestNavigate(Frame* source, | 135 void WebViewImpl::RequestNavigate(Frame* source, |
| 136 mandoline::NavigationTargetType target_type, | 136 mandoline::NavigationTargetType target_type, |
| 137 Frame* target_frame, | 137 Frame* target_frame, |
| 138 mojo::URLRequestPtr request) { | 138 mojo::URLRequestPtr request) { |
| 139 // TODO: this needs security checks. | 139 // TODO: this needs security checks. |
| 140 if (target_type == mandoline::NAVIGATION_TARGET_TYPE_EXISTING_FRAME) { | 140 if (target_type == mandoline::NAVIGATION_TARGET_TYPE_EXISTING_FRAME && |
| 141 if (target_frame && target_frame != frame_tree_->root() && | 141 target_frame != frame_tree_->root()) { |
| 142 target_frame->view()) { | 142 if (target_frame && target_frame->view()) { |
| 143 NavigateExistingFrame(target_frame, request.Pass()); | 143 NavigateExistingFrame(target_frame, request.Pass()); |
| 144 return; | 144 return; |
| 145 } | 145 } |
| 146 DVLOG(1) << "RequestNavigate() targeted existing frame that doesn't exist."; | 146 DVLOG(1) << "RequestNavigate() targeted existing frame that doesn't exist."; |
| 147 return; | 147 return; |
| 148 } | 148 } |
| 149 client_->TopLevelNavigate(request.Pass()); | 149 client_->TopLevelNavigate(request.Pass()); |
| 150 } | 150 } |
| 151 | 151 |
| 152 //////////////////////////////////////////////////////////////////////////////// | 152 //////////////////////////////////////////////////////////////////////////////// |
| 153 // WebViewImpl, private: | 153 // WebViewImpl, private: |
| 154 | 154 |
| 155 void WebViewImpl::NavigateExistingFrame(Frame* frame, | 155 void WebViewImpl::NavigateExistingFrame(Frame* frame, |
| 156 mojo::URLRequestPtr request) { | 156 mojo::URLRequestPtr request) { |
| 157 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); | 157 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); |
| 158 mojo::ViewManagerClientPtr view_manager_client; | 158 mojo::ViewManagerClientPtr view_manager_client; |
| 159 frame_connection->Init(app_, request.Pass(), &view_manager_client); | 159 frame_connection->Init(app_, request.Pass(), &view_manager_client); |
| 160 frame->view()->Embed(view_manager_client.Pass()); | 160 frame->view()->Embed(view_manager_client.Pass()); |
| 161 FrameTreeClient* frame_tree_client = frame_connection->frame_tree_client(); | 161 FrameTreeClient* frame_tree_client = frame_connection->frame_tree_client(); |
| 162 frame_tree_->CreateOrReplaceFrame(frame, frame->view(), frame_tree_client, | 162 frame_tree_->CreateOrReplaceFrame(frame, frame->view(), frame_tree_client, |
| 163 frame_connection.Pass()); | 163 frame_connection.Pass()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace web_view | 166 } // namespace web_view |
| OLD | NEW |