OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
31 #include "base/time/time.h" | 31 #include "base/time/time.h" |
32 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
33 #include "content/child/appcache/appcache_dispatcher.h" | 33 #include "content/child/appcache/appcache_dispatcher.h" |
34 #include "content/child/appcache/web_application_cache_host_impl.h" | 34 #include "content/child/appcache/web_application_cache_host_impl.h" |
35 #include "content/child/child_shared_bitmap_manager.h" | 35 #include "content/child/child_shared_bitmap_manager.h" |
36 #include "content/child/npapi/webplugin_delegate_impl.h" | 36 #include "content/child/npapi/webplugin_delegate_impl.h" |
37 #include "content/child/request_extra_data.h" | 37 #include "content/child/request_extra_data.h" |
38 #include "content/child/v8_value_converter_impl.h" | 38 #include "content/child/v8_value_converter_impl.h" |
39 #include "content/child/webmessageportchannel_impl.h" | 39 #include "content/child/webmessageportchannel_impl.h" |
| 40 #include "content/child/weburlresponse_extradata_impl.h" |
40 #include "content/common/content_constants_internal.h" | 41 #include "content/common/content_constants_internal.h" |
41 #include "content/common/database_messages.h" | 42 #include "content/common/database_messages.h" |
42 #include "content/common/dom_storage/dom_storage_types.h" | 43 #include "content/common/dom_storage/dom_storage_types.h" |
43 #include "content/common/drag_messages.h" | 44 #include "content/common/drag_messages.h" |
44 #include "content/common/frame_messages.h" | 45 #include "content/common/frame_messages.h" |
45 #include "content/common/frame_replication_state.h" | 46 #include "content/common/frame_replication_state.h" |
46 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 47 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
47 #include "content/common/input_messages.h" | 48 #include "content/common/input_messages.h" |
| 49 #include "content/common/navigation_params.h" |
48 #include "content/common/pepper_messages.h" | 50 #include "content/common/pepper_messages.h" |
49 #include "content/common/site_isolation_policy.h" | 51 #include "content/common/site_isolation_policy.h" |
50 #include "content/common/ssl_status_serialization.h" | 52 #include "content/common/ssl_status_serialization.h" |
51 #include "content/common/view_messages.h" | 53 #include "content/common/view_messages.h" |
52 #include "content/public/common/bindings_policy.h" | 54 #include "content/public/common/bindings_policy.h" |
53 #include "content/public/common/content_client.h" | 55 #include "content/public/common/content_client.h" |
54 #include "content/public/common/content_constants.h" | 56 #include "content/public/common/content_constants.h" |
55 #include "content/public/common/content_switches.h" | 57 #include "content/public/common/content_switches.h" |
56 #include "content/public/common/drop_data.h" | 58 #include "content/public/common/drop_data.h" |
57 #include "content/public/common/favicon_url.h" | 59 #include "content/public/common/favicon_url.h" |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 main_render_frame_->set_render_frame_proxy(proxy); | 707 main_render_frame_->set_render_frame_proxy(proxy); |
706 } else { | 708 } else { |
707 DCHECK(SiteIsolationPolicy::IsSwappedOutStateForbidden()); | 709 DCHECK(SiteIsolationPolicy::IsSwappedOutStateForbidden()); |
708 RenderFrameProxy::CreateFrameProxy(params.proxy_routing_id, | 710 RenderFrameProxy::CreateFrameProxy(params.proxy_routing_id, |
709 MSG_ROUTING_NONE, routing_id_, | 711 MSG_ROUTING_NONE, routing_id_, |
710 params.replicated_frame_state); | 712 params.replicated_frame_state); |
711 } | 713 } |
712 } | 714 } |
713 | 715 |
714 if (main_render_frame_) | 716 if (main_render_frame_) |
715 main_render_frame_->Initialize(); | 717 main_render_frame_->Initialize(LOFI_DEFAULT); |
716 | 718 |
717 #if defined(OS_ANDROID) | 719 #if defined(OS_ANDROID) |
718 content_detectors_.push_back(linked_ptr<ContentDetector>( | 720 content_detectors_.push_back(linked_ptr<ContentDetector>( |
719 new AddressDetector())); | 721 new AddressDetector())); |
720 const std::string& contry_iso = | 722 const std::string& contry_iso = |
721 params.renderer_preferences.network_contry_iso; | 723 params.renderer_preferences.network_contry_iso; |
722 if (!contry_iso.empty()) { | 724 if (!contry_iso.empty()) { |
723 content_detectors_.push_back(linked_ptr<ContentDetector>( | 725 content_detectors_.push_back(linked_ptr<ContentDetector>( |
724 new PhoneNumberDetector(contry_iso))); | 726 new PhoneNumberDetector(contry_iso))); |
725 } | 727 } |
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2862 webstring_paths, | 2864 webstring_paths, |
2863 local_directory_name.AsUTF16Unsafe()); | 2865 local_directory_name.AsUTF16Unsafe()); |
2864 } | 2866 } |
2865 | 2867 |
2866 void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { | 2868 void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { |
2867 // Don't show any more dialogs until we finish OnSwapOut. | 2869 // Don't show any more dialogs until we finish OnSwapOut. |
2868 suppress_dialogs_until_swap_out_ = true; | 2870 suppress_dialogs_until_swap_out_ = true; |
2869 } | 2871 } |
2870 | 2872 |
2871 void RenderViewImpl::OnClosePage() { | 2873 void RenderViewImpl::OnClosePage() { |
2872 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); | 2874 WebURLResponseExtraDataImpl* extra_data = |
| 2875 static_cast<WebURLResponseExtraDataImpl*>( |
| 2876 webview()->mainFrame()->dataSource()->response().extraData()); |
| 2877 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2878 ClosePage(extra_data ? extra_data->is_lofi() : false)); |
2873 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 2879 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
2874 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 2880 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
2875 // in the onunload handler from appearing. For now, we're bypassing that and | 2881 // in the onunload handler from appearing. For now, we're bypassing that and |
2876 // calling the FrameLoader's CloseURL method directly. This should be | 2882 // calling the FrameLoader's CloseURL method directly. This should be |
2877 // revisited to avoid having two ways to close a page. Having a single way | 2883 // revisited to avoid having two ways to close a page. Having a single way |
2878 // to close that can run onunload is also useful for fixing | 2884 // to close that can run onunload is also useful for fixing |
2879 // http://b/issue?id=753080. | 2885 // http://b/issue?id=753080. |
2880 webview()->mainFrame()->dispatchUnloadEvent(); | 2886 webview()->mainFrame()->dispatchUnloadEvent(); |
2881 | 2887 |
2882 Send(new ViewHostMsg_ClosePage_ACK(routing_id_)); | 2888 Send(new ViewHostMsg_ClosePage_ACK(routing_id_)); |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3781 std::vector<gfx::Size> sizes; | 3787 std::vector<gfx::Size> sizes; |
3782 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3788 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3783 if (!url.isEmpty()) | 3789 if (!url.isEmpty()) |
3784 urls.push_back( | 3790 urls.push_back( |
3785 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3791 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3786 } | 3792 } |
3787 SendUpdateFaviconURL(urls); | 3793 SendUpdateFaviconURL(urls); |
3788 } | 3794 } |
3789 | 3795 |
3790 } // namespace content | 3796 } // namespace content |
OLD | NEW |