Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2918903002: Move IconURLs method from WebFrame to WebLocalFrame (Closed)
Patch Set: Addressed CR feedback from avi@ Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "content/common/worker_url_loader_factory_provider.mojom.h" 73 #include "content/common/worker_url_loader_factory_provider.mojom.h"
74 #include "content/public/child/url_loader_throttle.h" 74 #include "content/public/child/url_loader_throttle.h"
75 #include "content/public/common/appcache_info.h" 75 #include "content/public/common/appcache_info.h"
76 #include "content/public/common/associated_interface_provider.h" 76 #include "content/public/common/associated_interface_provider.h"
77 #include "content/public/common/bindings_policy.h" 77 #include "content/public/common/bindings_policy.h"
78 #include "content/public/common/browser_side_navigation_policy.h" 78 #include "content/public/common/browser_side_navigation_policy.h"
79 #include "content/public/common/content_constants.h" 79 #include "content/public/common/content_constants.h"
80 #include "content/public/common/content_features.h" 80 #include "content/public/common/content_features.h"
81 #include "content/public/common/content_switches.h" 81 #include "content/public/common/content_switches.h"
82 #include "content/public/common/context_menu_params.h" 82 #include "content/public/common/context_menu_params.h"
83 #include "content/public/common/favicon_url.h"
83 #include "content/public/common/file_chooser_file_info.h" 84 #include "content/public/common/file_chooser_file_info.h"
84 #include "content/public/common/file_chooser_params.h" 85 #include "content/public/common/file_chooser_params.h"
85 #include "content/public/common/isolated_world_ids.h" 86 #include "content/public/common/isolated_world_ids.h"
86 #include "content/public/common/page_state.h" 87 #include "content/public/common/page_state.h"
87 #include "content/public/common/resource_response.h" 88 #include "content/public/common/resource_response.h"
88 #include "content/public/common/service_manager_connection.h" 89 #include "content/public/common/service_manager_connection.h"
89 #include "content/public/common/url_constants.h" 90 #include "content/public/common/url_constants.h"
90 #include "content/public/common/url_utils.h" 91 #include "content/public/common/url_utils.h"
91 #include "content/public/renderer/browser_plugin_delegate.h" 92 #include "content/public/renderer/browser_plugin_delegate.h"
92 #include "content/public/renderer/content_renderer_client.h" 93 #include "content/public/renderer/content_renderer_client.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // Explicitly close |file| here to make sure to include any flush operations 671 // Explicitly close |file| here to make sure to include any flush operations
671 // in the UMA metric. 672 // in the UMA metric.
672 file.Close(); 673 file.Close();
673 return save_status; 674 return save_status;
674 } 675 }
675 676
676 double ConvertToBlinkTime(const base::TimeTicks& time_ticks) { 677 double ConvertToBlinkTime(const base::TimeTicks& time_ticks) {
677 return (time_ticks - base::TimeTicks()).InSecondsF(); 678 return (time_ticks - base::TimeTicks()).InSecondsF();
678 } 679 }
679 680
681 FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) {
682 switch (type) {
683 case blink::WebIconURL::kTypeFavicon:
684 return FaviconURL::IconType::kFavIcon;
685 case blink::WebIconURL::kTypeTouch:
686 return FaviconURL::IconType::kTouchIcon;
687 case blink::WebIconURL::kTypeTouchPrecomposed:
688 return FaviconURL::IconType::kTouchPrecomposedIcon;
689 case blink::WebIconURL::kTypeInvalid:
690 return FaviconURL::IconType::kInvalid;
691 }
692 NOTREACHED();
693 return FaviconURL::IconType::kInvalid;
694 }
695
696 std::vector<gfx::Size> ConvertToFaviconSizes(
697 const blink::WebVector<blink::WebSize>& web_sizes) {
698 std::vector<gfx::Size> result;
699 result.reserve(web_sizes.size());
700 for (const blink::WebSize& web_size : web_sizes)
701 result.push_back(gfx::Size(web_size));
702 return result;
703 }
704
680 } // namespace 705 } // namespace
681 706
682 // The following methods are outside of the anonymous namespace to ensure that 707 // The following methods are outside of the anonymous namespace to ensure that
683 // the corresponding symbols get emmitted even on symbol_level 1. 708 // the corresponding symbols get emmitted even on symbol_level 1.
684 NOINLINE void ExhaustMemory() { 709 NOINLINE void ExhaustMemory() {
685 volatile void* ptr = nullptr; 710 volatile void* ptr = nullptr;
686 do { 711 do {
687 ptr = malloc(0x10000000); 712 ptr = malloc(0x10000000);
688 base::debug::Alias(&ptr); 713 base::debug::Alias(&ptr);
689 } while (ptr); 714 } while (ptr);
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after
3760 base::string16 shortened_title = title16.substr(0, kMaxTitleChars); 3785 base::string16 shortened_title = title16.substr(0, kMaxTitleChars);
3761 Send(new FrameHostMsg_UpdateTitle(routing_id_, 3786 Send(new FrameHostMsg_UpdateTitle(routing_id_,
3762 shortened_title, direction)); 3787 shortened_title, direction));
3763 } 3788 }
3764 3789
3765 // Also check whether we have new encoding name. 3790 // Also check whether we have new encoding name.
3766 UpdateEncoding(frame_, frame_->View()->PageEncoding().Utf8()); 3791 UpdateEncoding(frame_, frame_->View()->PageEncoding().Utf8());
3767 } 3792 }
3768 3793
3769 void RenderFrameImpl::DidChangeIcon(blink::WebIconURL::Type icon_type) { 3794 void RenderFrameImpl::DidChangeIcon(blink::WebIconURL::Type icon_type) {
3770 // TODO(nasko): Investigate wheather implementation should move here. 3795 SendUpdateFaviconURL(icon_type);
3771 render_view_->didChangeIcon(frame_, icon_type); 3796 }
3797
3798 void RenderFrameImpl::SendUpdateFaviconURL(
3799 blink::WebIconURL::Type icon_types_mask) {
3800 if (frame_->Parent())
3801 return;
3802
3803 WebVector<blink::WebIconURL> icon_urls = frame_->IconURLs(icon_types_mask);
3804 if (icon_urls.empty())
3805 return;
3806
3807 std::vector<FaviconURL> urls;
3808 urls.reserve(icon_urls.size());
3809 for (const blink::WebIconURL& icon_url : icon_urls) {
3810 urls.push_back(FaviconURL(icon_url.GetIconURL(),
3811 ToFaviconType(icon_url.IconType()),
3812 ConvertToFaviconSizes(icon_url.Sizes())));
3813 }
3814 DCHECK_EQ(icon_urls.size(), urls.size());
3815
3816 Send(new FrameHostMsg_UpdateFaviconURL(GetRoutingID(), urls));
3772 } 3817 }
3773 3818
3774 void RenderFrameImpl::DidFinishDocumentLoad() { 3819 void RenderFrameImpl::DidFinishDocumentLoad() {
3775 TRACE_EVENT1("navigation,benchmark,rail", 3820 TRACE_EVENT1("navigation,benchmark,rail",
3776 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_); 3821 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_);
3777 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); 3822 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_));
3778 3823
3779 for (auto& observer : observers_) 3824 for (auto& observer : observers_)
3780 observer.DidFinishDocumentLoad(); 3825 observer.DidFinishDocumentLoad();
3781 3826
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 5049
5005 void RenderFrameImpl::DidStopLoading() { 5050 void RenderFrameImpl::DidStopLoading() {
5006 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", 5051 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading",
5007 "id", routing_id_); 5052 "id", routing_id_);
5008 5053
5009 // Any subframes created after this point won't be considered part of the 5054 // Any subframes created after this point won't be considered part of the
5010 // current history navigation (if this was one), so we don't need to track 5055 // current history navigation (if this was one), so we don't need to track
5011 // this state anymore. 5056 // this state anymore.
5012 history_subframe_unique_names_.clear(); 5057 history_subframe_unique_names_.clear();
5013 5058
5059 blink::WebIconURL::Type icon_types_mask =
5060 static_cast<blink::WebIconURL::Type>(
5061 blink::WebIconURL::kTypeFavicon |
5062 blink::WebIconURL::kTypeTouchPrecomposed |
5063 blink::WebIconURL::kTypeTouch);
5064 SendUpdateFaviconURL(icon_types_mask);
5065
5014 render_view_->FrameDidStopLoading(frame_); 5066 render_view_->FrameDidStopLoading(frame_);
5015 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 5067 Send(new FrameHostMsg_DidStopLoading(routing_id_));
5016 } 5068 }
5017 5069
5018 void RenderFrameImpl::DidChangeLoadProgress(double load_progress) { 5070 void RenderFrameImpl::DidChangeLoadProgress(double load_progress) {
5019 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); 5071 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress));
5020 } 5072 }
5021 5073
5022 void RenderFrameImpl::HandleWebAccessibilityEvent( 5074 void RenderFrameImpl::HandleWebAccessibilityEvent(
5023 const blink::WebAXObject& obj, blink::WebAXEvent event) { 5075 const blink::WebAXObject& obj, blink::WebAXEvent event) {
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
6782 policy(info.default_policy), 6834 policy(info.default_policy),
6783 replaces_current_history_item(info.replaces_current_history_item), 6835 replaces_current_history_item(info.replaces_current_history_item),
6784 history_navigation_in_new_child_frame( 6836 history_navigation_in_new_child_frame(
6785 info.is_history_navigation_in_new_child_frame), 6837 info.is_history_navigation_in_new_child_frame),
6786 client_redirect(info.is_client_redirect), 6838 client_redirect(info.is_client_redirect),
6787 cache_disabled(info.is_cache_disabled), 6839 cache_disabled(info.is_cache_disabled),
6788 form(info.form), 6840 form(info.form),
6789 source_location(info.source_location) {} 6841 source_location(info.source_location) {}
6790 6842
6791 } // namespace content 6843 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698