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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 10834201: Revert 150232 (speculative, probably broke (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/renderer/chrome_render_view_observer.h" 5 #include "chrome/renderer/chrome_render_view_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 render_view()->GetContentStateImmediately() ? 691 render_view()->GetContentStateImmediately() ?
692 0 : kDelayForCaptureMs)); 692 0 : kDelayForCaptureMs));
693 693
694 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); 694 WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
695 GURL osd_url = main_frame->document().openSearchDescriptionURL(); 695 GURL osd_url = main_frame->document().openSearchDescriptionURL();
696 if (!osd_url.is_empty()) { 696 if (!osd_url.is_empty()) {
697 Send(new ChromeViewHostMsg_PageHasOSDD( 697 Send(new ChromeViewHostMsg_PageHasOSDD(
698 routing_id(), render_view()->GetPageId(), osd_url, 698 routing_id(), render_view()->GetPageId(), osd_url,
699 search_provider::AUTODETECTED_PROVIDER)); 699 search_provider::AUTODETECTED_PROVIDER));
700 } 700 }
701 }
702 701
703 void ChromeRenderViewObserver::DidFinishLoad(WebKit::WebFrame* frame) {
704 if (frame->parent())
705 return;
706
707 // Please note that we are updating favicons only for the _main_ frame.
708 // Updating Favicon URLs at DidFinishLoad ensures that icon loads always get
709 // initiated after all of the other page resources have been fetched, so icon
710 // loads should not compete with page resources for network bandwidth.
711 int icon_types = WebIconURL::TypeFavicon; 702 int icon_types = WebIconURL::TypeFavicon;
712 if (chrome::kEnableTouchIcon) 703 if (chrome::kEnableTouchIcon)
713 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; 704 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch;
714 705
715 CollectAndUpdateFaviconURLs(frame, icon_types); 706 WebVector<WebIconURL> icon_urls =
707 render_view()->GetWebView()->mainFrame()->iconURLs(icon_types);
708 std::vector<FaviconURL> urls;
709 for (size_t i = 0; i < icon_urls.size(); i++) {
710 WebURL url = icon_urls[i].iconURL();
711 if (!url.isEmpty())
712 urls.push_back(FaviconURL(url, ToFaviconType(icon_urls[i].iconType())));
713 }
714 if (!urls.empty()) {
715 Send(new IconHostMsg_UpdateFaviconURL(
716 routing_id(), render_view()->GetPageId(), urls));
717 }
716 } 718 }
717 719
718 void ChromeRenderViewObserver::DidChangeIcon(WebFrame* frame, 720 void ChromeRenderViewObserver::DidChangeIcon(WebFrame* frame,
719 WebIconURL::Type icon_type) { 721 WebIconURL::Type icon_type) {
720 if (frame->parent()) 722 if (frame->parent())
721 return; 723 return;
722 724
723 if (!chrome::kEnableTouchIcon && 725 if (!chrome::kEnableTouchIcon &&
724 icon_type != WebIconURL::TypeFavicon) 726 icon_type != WebIconURL::TypeFavicon)
725 return; 727 return;
726 728
727 CollectAndUpdateFaviconURLs(frame, icon_type); 729 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type);
730 std::vector<FaviconURL> urls;
731 for (size_t i = 0; i < icon_urls.size(); i++) {
732 urls.push_back(FaviconURL(icon_urls[i].iconURL(),
733 ToFaviconType(icon_urls[i].iconType())));
734 }
735 Send(new IconHostMsg_UpdateFaviconURL(
736 routing_id(), render_view()->GetPageId(), urls));
728 } 737 }
729 738
730 void ChromeRenderViewObserver::DidCommitProvisionalLoad( 739 void ChromeRenderViewObserver::DidCommitProvisionalLoad(
731 WebFrame* frame, bool is_new_navigation) { 740 WebFrame* frame, bool is_new_navigation) {
732 if (!is_new_navigation) 741 if (!is_new_navigation)
733 return; 742 return;
734 743
735 CapturePageInfoLater( 744 CapturePageInfoLater(
736 true, // preliminary_capture 745 true, // preliminary_capture
737 base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs)); 746 base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs));
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 webkit_glue::ImageDecoder decoder( 1091 webkit_glue::ImageDecoder decoder(
1083 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize)); 1092 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize));
1084 const unsigned char* src_data = 1093 const unsigned char* src_data =
1085 reinterpret_cast<const unsigned char*>(&data[0]); 1094 reinterpret_cast<const unsigned char*>(&data[0]);
1086 1095
1087 return decoder.Decode(src_data, data.size()); 1096 return decoder.Decode(src_data, data.size());
1088 } 1097 }
1089 return SkBitmap(); 1098 return SkBitmap();
1090 } 1099 }
1091 1100
1092 void ChromeRenderViewObserver::CollectAndUpdateFaviconURLs(
1093 WebKit::WebFrame* frame, int icon_types) {
1094 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_types);
1095 std::vector<FaviconURL> urls;
1096 for (size_t i = 0; i < icon_urls.size(); i++) {
1097 WebURL url = icon_urls[i].iconURL();
1098 if (!url.isEmpty())
1099 urls.push_back(FaviconURL(url, ToFaviconType(icon_urls[i].iconType())));
1100 }
1101 if (!urls.empty()) {
1102 Send(new IconHostMsg_UpdateFaviconURL(
1103 routing_id(), render_view()->GetPageId(), urls));
1104 }
1105 }
1106
1107 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { 1101 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) {
1108 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); 1102 return (strict_security_hosts_.find(host) != strict_security_hosts_.end());
1109 } 1103 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698