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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 11411180: move favicon download code from chrome/ into content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix order Created 8 years 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
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/browser/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/history/history_tab_helper.h" 13 #include "chrome/browser/history/history_tab_helper.h"
14 #include "chrome/browser/history/history_types.h" 14 #include "chrome/browser/history/history_types.h"
15 #include "chrome/browser/prerender/prerender_final_status.h" 15 #include "chrome/browser/prerender/prerender_final_status.h"
16 #include "chrome/browser/prerender/prerender_handle.h" 16 #include "chrome/browser/prerender/prerender_handle.h"
17 #include "chrome/browser/prerender/prerender_manager.h" 17 #include "chrome/browser/prerender/prerender_manager.h"
18 #include "chrome/browser/prerender/prerender_render_view_host_observer.h" 18 #include "chrome/browser/prerender/prerender_render_view_host_observer.h"
19 #include "chrome/browser/prerender/prerender_tracker.h" 19 #include "chrome/browser/prerender/prerender_tracker.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents.h"
22 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/icon_messages.h"
24 #include "chrome/common/prerender_messages.h" 23 #include "chrome/common/prerender_messages.h"
25 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
26 #include "content/public/browser/browser_child_process_host.h" 25 #include "content/public/browser/browser_child_process_host.h"
27 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
29 #include "content/public/browser/render_view_host.h" 28 #include "content/public/browser/render_view_host.h"
30 #include "content/public/browser/resource_request_details.h" 29 #include "content/public/browser/resource_request_details.h"
31 #include "content/public/browser/session_storage_namespace.h" 30 #include "content/public/browser/session_storage_namespace.h"
32 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
33 #include "content/public/browser/web_contents_delegate.h" 32 #include "content/public/browser/web_contents_delegate.h"
34 #include "content/public/browser/web_contents_view.h" 33 #include "content/public/browser/web_contents_view.h"
34 #include "content/public/common/favicon_url.h"
35 #include "ui/gfx/rect.h" 35 #include "ui/gfx/rect.h"
36 36
37 using content::DownloadItem; 37 using content::DownloadItem;
38 using content::OpenURLParams; 38 using content::OpenURLParams;
39 using content::RenderViewHost; 39 using content::RenderViewHost;
40 using content::ResourceRedirectDetails; 40 using content::ResourceRedirectDetails;
41 using content::SessionStorageNamespace; 41 using content::SessionStorageNamespace;
42 using content::WebContents; 42 using content::WebContents;
43 43
44 namespace prerender { 44 namespace prerender {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 prerendering_has_started_ = true; 289 prerendering_has_started_ = true;
290 290
291 WebContents* new_contents = CreateWebContents(session_storage_namespace); 291 WebContents* new_contents = CreateWebContents(session_storage_namespace);
292 prerender_contents_.reset( 292 prerender_contents_.reset(
293 TabContents::Factory::CreateTabContents(new_contents)); 293 TabContents::Factory::CreateTabContents(new_contents));
294 content::WebContentsObserver::Observe(new_contents); 294 content::WebContentsObserver::Observe(new_contents);
295 295
296 tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); 296 tab_contents_delegate_.reset(new TabContentsDelegateImpl(this));
297 new_contents->SetDelegate(tab_contents_delegate_.get()); 297 new_contents->SetDelegate(tab_contents_delegate_.get());
298
299 // Set the size of the prerender WebContents. 298 // Set the size of the prerender WebContents.
300 prerender_contents_->web_contents()->GetView()->SizeContents(size_); 299 prerender_contents_->web_contents()->GetView()->SizeContents(size_);
301 300
302 // Register as an observer of the RenderViewHost so we get messages. 301 // Register as an observer of the RenderViewHost so we get messages.
303 render_view_host_observer_.reset( 302 render_view_host_observer_.reset(
304 new PrerenderRenderViewHostObserver(this, GetRenderViewHostMutable())); 303 new PrerenderRenderViewHostObserver(this, GetRenderViewHostMutable()));
305 304
306 child_id_ = GetRenderViewHost()->GetProcess()->GetID(); 305 child_id_ = GetRenderViewHost()->GetProcess()->GetID();
307 route_id_ = GetRenderViewHost()->GetRoutingID(); 306 route_id_ = GetRenderViewHost()->GetRoutingID();
308 307
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 WebContents* PrerenderContents::CreateWebContents( 476 WebContents* PrerenderContents::CreateWebContents(
478 SessionStorageNamespace* session_storage_namespace) { 477 SessionStorageNamespace* session_storage_namespace) {
479 // TODO(ajwong): Remove the temporary map once prerendering is aware of 478 // TODO(ajwong): Remove the temporary map once prerendering is aware of
480 // multiple session storage namespaces per tab. 479 // multiple session storage namespaces per tab.
481 content::SessionStorageNamespaceMap session_storage_namespace_map; 480 content::SessionStorageNamespaceMap session_storage_namespace_map;
482 session_storage_namespace_map[""] = session_storage_namespace; 481 session_storage_namespace_map[""] = session_storage_namespace;
483 return WebContents::CreateWithSessionStorage( 482 return WebContents::CreateWithSessionStorage(
484 profile_, NULL, MSG_ROUTING_NONE, NULL, session_storage_namespace_map); 483 profile_, NULL, MSG_ROUTING_NONE, NULL, session_storage_namespace_map);
485 } 484 }
486 485
487 void PrerenderContents::OnUpdateFaviconURL( 486 void PrerenderContents::DidUpdateFaviconURL(
488 int32 page_id, 487 int32 page_id,
489 const std::vector<FaviconURL>& urls) { 488 const std::vector<content::FaviconURL>& urls) {
490 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_; 489 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_;
491 for (std::vector<FaviconURL>::const_iterator it = urls.begin(); 490 for (std::vector<content::FaviconURL>::const_iterator it = urls.begin();
492 it != urls.end(); ++it) { 491 it != urls.end(); ++it) {
493 if (it->icon_type == FaviconURL::FAVICON) { 492 if (it->icon_type == content::FaviconURL::FAVICON) {
494 icon_url_ = it->icon_url; 493 icon_url_ = it->icon_url;
495 VLOG(1) << icon_url_; 494 VLOG(1) << icon_url_;
496 return; 495 return;
497 } 496 }
498 } 497 }
499 } 498 }
500 499
501 bool PrerenderContents::AddAliasURL(const GURL& url) { 500 bool PrerenderContents::AddAliasURL(const GURL& url) {
502 const bool http = url.SchemeIs(chrome::kHttpScheme); 501 const bool http = url.SchemeIs(chrome::kHttpScheme);
503 const bool https = url.SchemeIs(chrome::kHttpsScheme); 502 const bool https = url.SchemeIs(chrome::kHttpsScheme);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 bool PrerenderContents::IsCrossSiteNavigationPending() const { 684 bool PrerenderContents::IsCrossSiteNavigationPending() const {
686 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) 685 if (!prerender_contents_.get() || !prerender_contents_->web_contents())
687 return false; 686 return false;
688 const WebContents* web_contents = prerender_contents_->web_contents(); 687 const WebContents* web_contents = prerender_contents_->web_contents();
689 return (web_contents->GetSiteInstance() != 688 return (web_contents->GetSiteInstance() !=
690 web_contents->GetPendingSiteInstance()); 689 web_contents->GetPendingSiteInstance());
691 } 690 }
692 691
693 692
694 } // namespace prerender 693 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/prerender/prerender_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698