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

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

Issue 2918903002: Move IconURLs method from WebFrame to WebLocalFrame (Closed)
Patch Set: Fixing compile problems in chrome/browser/extensions/favicon_downloader_unittest.cc 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 void ConvertToFaviconSizes(const blink::WebVector<blink::WebSize>& web_sizes,
697 std::vector<gfx::Size>* sizes) {
698 DCHECK(sizes->empty());
699 sizes->reserve(web_sizes.size());
700 for (size_t i = 0; i < web_sizes.size(); ++i)
Avi (use Gerrit) 2017/06/06 23:10:04 for (:)
Łukasz Anforowicz 2017/06/06 23:25:36 Done + also returning the vector (instead of using
701 sizes->push_back(gfx::Size(web_sizes[i]));
702 }
703
680 } // namespace 704 } // namespace
681 705
682 // The following methods are outside of the anonymous namespace to ensure that 706 // The following methods are outside of the anonymous namespace to ensure that
683 // the corresponding symbols get emmitted even on symbol_level 1. 707 // the corresponding symbols get emmitted even on symbol_level 1.
684 NOINLINE void ExhaustMemory() { 708 NOINLINE void ExhaustMemory() {
685 volatile void* ptr = nullptr; 709 volatile void* ptr = nullptr;
686 do { 710 do {
687 ptr = malloc(0x10000000); 711 ptr = malloc(0x10000000);
688 base::debug::Alias(&ptr); 712 base::debug::Alias(&ptr);
689 } while (ptr); 713 } while (ptr);
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after
3760 base::string16 shortened_title = title16.substr(0, kMaxTitleChars); 3784 base::string16 shortened_title = title16.substr(0, kMaxTitleChars);
3761 Send(new FrameHostMsg_UpdateTitle(routing_id_, 3785 Send(new FrameHostMsg_UpdateTitle(routing_id_,
3762 shortened_title, direction)); 3786 shortened_title, direction));
3763 } 3787 }
3764 3788
3765 // Also check whether we have new encoding name. 3789 // Also check whether we have new encoding name.
3766 UpdateEncoding(frame_, frame_->View()->PageEncoding().Utf8()); 3790 UpdateEncoding(frame_, frame_->View()->PageEncoding().Utf8());
3767 } 3791 }
3768 3792
3769 void RenderFrameImpl::DidChangeIcon(blink::WebIconURL::Type icon_type) { 3793 void RenderFrameImpl::DidChangeIcon(blink::WebIconURL::Type icon_type) {
3770 // TODO(nasko): Investigate wheather implementation should move here. 3794 SendUpdateFaviconURL(icon_type);
3771 render_view_->didChangeIcon(frame_, icon_type); 3795 }
3796
3797 void RenderFrameImpl::SendUpdateFaviconURL(
3798 blink::WebIconURL::Type icon_types_mask) {
3799 if (frame_->Parent())
3800 return;
3801
3802 WebVector<blink::WebIconURL> icon_urls = frame_->IconURLs(icon_types_mask);
3803 if (icon_urls.empty())
3804 return;
3805
3806 std::vector<FaviconURL> urls;
3807 for (size_t i = 0; i < icon_urls.size(); i++) {
Avi (use Gerrit) 2017/06/06 23:10:04 for (:)
Łukasz Anforowicz 2017/06/06 23:25:36 Done.
3808 std::vector<gfx::Size> sizes;
3809 ConvertToFaviconSizes(icon_urls[i].Sizes(), &sizes);
3810 urls.push_back(FaviconURL(icon_urls[i].GetIconURL(),
3811 ToFaviconType(icon_urls[i].IconType()), sizes));
3812 }
3813 DCHECK_EQ(icon_urls.size(), urls.size());
3814
3815 Send(new FrameHostMsg_UpdateFaviconURL(GetRoutingID(), urls));
3772 } 3816 }
3773 3817
3774 void RenderFrameImpl::DidFinishDocumentLoad() { 3818 void RenderFrameImpl::DidFinishDocumentLoad() {
3775 TRACE_EVENT1("navigation,benchmark,rail", 3819 TRACE_EVENT1("navigation,benchmark,rail",
3776 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_); 3820 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_);
3777 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); 3821 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_));
3778 3822
3779 for (auto& observer : observers_) 3823 for (auto& observer : observers_)
3780 observer.DidFinishDocumentLoad(); 3824 observer.DidFinishDocumentLoad();
3781 3825
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 5048
5005 void RenderFrameImpl::DidStopLoading() { 5049 void RenderFrameImpl::DidStopLoading() {
5006 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", 5050 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading",
5007 "id", routing_id_); 5051 "id", routing_id_);
5008 5052
5009 // Any subframes created after this point won't be considered part of the 5053 // 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 5054 // current history navigation (if this was one), so we don't need to track
5011 // this state anymore. 5055 // this state anymore.
5012 history_subframe_unique_names_.clear(); 5056 history_subframe_unique_names_.clear();
5013 5057
5058 blink::WebIconURL::Type icon_types_mask =
5059 static_cast<blink::WebIconURL::Type>(
5060 blink::WebIconURL::kTypeFavicon |
5061 blink::WebIconURL::kTypeTouchPrecomposed |
5062 blink::WebIconURL::kTypeTouch);
5063 SendUpdateFaviconURL(icon_types_mask);
5064
5014 render_view_->FrameDidStopLoading(frame_); 5065 render_view_->FrameDidStopLoading(frame_);
5015 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 5066 Send(new FrameHostMsg_DidStopLoading(routing_id_));
5016 } 5067 }
5017 5068
5018 void RenderFrameImpl::DidChangeLoadProgress(double load_progress) { 5069 void RenderFrameImpl::DidChangeLoadProgress(double load_progress) {
5019 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); 5070 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress));
5020 } 5071 }
5021 5072
5022 void RenderFrameImpl::HandleWebAccessibilityEvent( 5073 void RenderFrameImpl::HandleWebAccessibilityEvent(
5023 const blink::WebAXObject& obj, blink::WebAXEvent event) { 5074 const blink::WebAXObject& obj, blink::WebAXEvent event) {
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
6782 policy(info.default_policy), 6833 policy(info.default_policy),
6783 replaces_current_history_item(info.replaces_current_history_item), 6834 replaces_current_history_item(info.replaces_current_history_item),
6784 history_navigation_in_new_child_frame( 6835 history_navigation_in_new_child_frame(
6785 info.is_history_navigation_in_new_child_frame), 6836 info.is_history_navigation_in_new_child_frame),
6786 client_redirect(info.is_client_redirect), 6837 client_redirect(info.is_client_redirect),
6787 cache_disabled(info.is_cache_disabled), 6838 cache_disabled(info.is_cache_disabled),
6788 form(info.form), 6839 form(info.form),
6789 source_location(info.source_location) {} 6840 source_location(info.source_location) {}
6790 6841
6791 } // namespace content 6842 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698