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/html_viewer/html_frame.h" | 5 #include "components/html_viewer/html_frame.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "components/html_viewer/ax_provider_impl.h" | 15 #include "components/html_viewer/ax_provider_impl.h" |
16 #include "components/html_viewer/blink_basic_type_converters.h" | 16 #include "components/html_viewer/blink_basic_type_converters.h" |
17 #include "components/html_viewer/blink_input_events_type_converters.h" | 17 #include "components/html_viewer/blink_input_events_type_converters.h" |
18 #include "components/html_viewer/blink_text_input_type_converters.h" | 18 #include "components/html_viewer/blink_text_input_type_converters.h" |
19 #include "components/html_viewer/blink_url_request_type_converters.h" | 19 #include "components/html_viewer/blink_url_request_type_converters.h" |
20 #include "components/html_viewer/geolocation_client_impl.h" | 20 #include "components/html_viewer/geolocation_client_impl.h" |
21 #include "components/html_viewer/global_state.h" | 21 #include "components/html_viewer/global_state.h" |
22 #include "components/html_viewer/html_frame_delegate.h" | 22 #include "components/html_viewer/html_frame_delegate.h" |
23 #include "components/html_viewer/html_frame_properties.h" | 23 #include "components/html_viewer/html_frame_properties.h" |
24 #include "components/html_viewer/html_frame_tree_manager.h" | 24 #include "components/html_viewer/html_frame_tree_manager.h" |
25 #include "components/html_viewer/media_factory.h" | 25 #include "components/html_viewer/media_factory.h" |
26 #include "components/html_viewer/stats_collection_controller.h" | |
26 #include "components/html_viewer/touch_handler.h" | 27 #include "components/html_viewer/touch_handler.h" |
27 #include "components/html_viewer/web_layer_impl.h" | 28 #include "components/html_viewer/web_layer_impl.h" |
28 #include "components/html_viewer/web_layer_tree_view_impl.h" | 29 #include "components/html_viewer/web_layer_tree_view_impl.h" |
29 #include "components/html_viewer/web_storage_namespace_impl.h" | 30 #include "components/html_viewer/web_storage_namespace_impl.h" |
30 #include "components/html_viewer/web_url_loader_impl.h" | 31 #include "components/html_viewer/web_url_loader_impl.h" |
31 #include "components/view_manager/ids.h" | 32 #include "components/view_manager/ids.h" |
32 #include "components/view_manager/public/cpp/scoped_view_ptr.h" | 33 #include "components/view_manager/public/cpp/scoped_view_ptr.h" |
33 #include "components/view_manager/public/cpp/view.h" | 34 #include "components/view_manager/public/cpp/view.h" |
34 #include "components/view_manager/public/cpp/view_manager.h" | 35 #include "components/view_manager/public/cpp/view_manager.h" |
35 #include "components/view_manager/public/interfaces/surfaces.mojom.h" | 36 #include "components/view_manager/public/interfaces/surfaces.mojom.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 NOTREACHED(); | 189 NOTREACHED(); |
189 } | 190 } |
190 | 191 |
191 if (!IsLocal()) { | 192 if (!IsLocal()) { |
192 blink::WebRemoteFrame* remote_web_frame = web_frame_->toWebRemoteFrame(); | 193 blink::WebRemoteFrame* remote_web_frame = web_frame_->toWebRemoteFrame(); |
193 if (remote_web_frame) { | 194 if (remote_web_frame) { |
194 remote_web_frame->setReplicatedOrigin(state_.origin); | 195 remote_web_frame->setReplicatedOrigin(state_.origin); |
195 remote_web_frame->setReplicatedName(state_.name); | 196 remote_web_frame->setReplicatedName(state_.name); |
196 } | 197 } |
197 } | 198 } |
199 | |
200 startup_performance_data_collector_ = | |
sky
2015/08/17 20:09:30
Do we really need this for all frames? Should it o
msw
2015/08/17 21:25:50
Done; thanks for the advice!
| |
201 StatsCollectionController::Install(web_frame_, GetLocalRootApp()); | |
198 } | 202 } |
199 | 203 |
200 void HTMLFrame::OnViewUnembed() { | 204 void HTMLFrame::OnViewUnembed() { |
201 // The view we're associated with is being unembedded (the view on the server | 205 // The view we're associated with is being unembedded (the view on the server |
202 // side still exists, but we're no longer responsible for rendering to it). | 206 // side still exists, but we're no longer responsible for rendering to it). |
203 // If we're local, we need to swap the frame to remote, unless we're at the | 207 // If we're local, we need to swap the frame to remote, unless we're at the |
204 // top of the hierarchy, in which case someone else is going to render the | 208 // top of the hierarchy, in which case someone else is going to render the |
205 // tree. | 209 // tree. |
206 if (!IsLocal() || frame_tree_manager_->local_root_ == this) | 210 if (!IsLocal() || frame_tree_manager_->local_root_ == this) |
207 return; | 211 return; |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 } | 748 } |
745 | 749 |
746 void HTMLFrame::didAddMessageToConsole(const blink::WebConsoleMessage& message, | 750 void HTMLFrame::didAddMessageToConsole(const blink::WebConsoleMessage& message, |
747 const blink::WebString& source_name, | 751 const blink::WebString& source_name, |
748 unsigned source_line, | 752 unsigned source_line, |
749 const blink::WebString& stack_trace) { | 753 const blink::WebString& stack_trace) { |
750 VLOG(1) << "[" << source_name.utf8() << "(" << source_line << ")] " | 754 VLOG(1) << "[" << source_name.utf8() << "(" << source_line << ")] " |
751 << message.text.utf8(); | 755 << message.text.utf8(); |
752 } | 756 } |
753 | 757 |
758 void HTMLFrame::didHandleOnloadEvents(blink::WebLocalFrame* frame) { | |
759 if (startup_performance_data_collector_.get()) { | |
yzshen1
2015/08/17 05:46:38
nit: .get() is not necessary.
msw
2015/08/17 21:25:50
Done.
| |
760 startup_performance_data_collector_->SetFirstWebContentsMainFrameLoadTime( | |
761 base::Time::Now().ToInternalValue()); | |
762 } | |
763 } | |
764 | |
754 void HTMLFrame::didFinishLoad(blink::WebLocalFrame* frame) { | 765 void HTMLFrame::didFinishLoad(blink::WebLocalFrame* frame) { |
755 if (GetLocalRoot() == this) | 766 if (GetLocalRoot() == this) |
756 delegate_->OnFrameDidFinishLoad(); | 767 delegate_->OnFrameDidFinishLoad(); |
757 } | 768 } |
758 | 769 |
759 void HTMLFrame::didNavigateWithinPage(blink::WebLocalFrame* frame, | 770 void HTMLFrame::didNavigateWithinPage(blink::WebLocalFrame* frame, |
760 const blink::WebHistoryItem& history_item, | 771 const blink::WebHistoryItem& history_item, |
761 blink::WebHistoryCommitType commit_type) { | 772 blink::WebHistoryCommitType commit_type) { |
762 GetLocalRoot()->server_->DidNavigateLocally(id_, | 773 GetLocalRoot()->server_->DidNavigateLocally(id_, |
763 history_item.urlString().utf8()); | 774 history_item.urlString().utf8()); |
764 } | 775 } |
765 | 776 |
777 void HTMLFrame::didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame) { | |
778 if (startup_performance_data_collector_) { | |
779 startup_performance_data_collector_->SetFirstVisuallyNonEmptyLayoutTime( | |
780 base::Time::Now().ToInternalValue()); | |
781 } | |
782 } | |
783 | |
766 blink::WebGeolocationClient* HTMLFrame::geolocationClient() { | 784 blink::WebGeolocationClient* HTMLFrame::geolocationClient() { |
767 if (!geolocation_client_impl_) | 785 if (!geolocation_client_impl_) |
768 geolocation_client_impl_.reset(new GeolocationClientImpl); | 786 geolocation_client_impl_.reset(new GeolocationClientImpl); |
769 return geolocation_client_impl_.get(); | 787 return geolocation_client_impl_.get(); |
770 } | 788 } |
771 | 789 |
772 blink::WebEncryptedMediaClient* HTMLFrame::encryptedMediaClient() { | 790 blink::WebEncryptedMediaClient* HTMLFrame::encryptedMediaClient() { |
773 return global_state()->media_factory()->GetEncryptedMediaClient(); | 791 return global_state()->media_factory()->GetEncryptedMediaClient(); |
774 } | 792 } |
775 | 793 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 | 896 |
879 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { | 897 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { |
880 NOTIMPLEMENTED(); | 898 NOTIMPLEMENTED(); |
881 } | 899 } |
882 | 900 |
883 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) { | 901 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) { |
884 NOTIMPLEMENTED(); | 902 NOTIMPLEMENTED(); |
885 } | 903 } |
886 | 904 |
887 } // namespace mojo | 905 } // namespace mojo |
OLD | NEW |