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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 10198040: New link rel=prerender api, using WebKit::WebPrerenderingPlatform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: is this closer? Created 8 years, 7 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
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/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/download/download_request_limiter.h" 10 #include "chrome/browser/download/download_request_limiter.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/renderer_host/transfer_navigation_resource_throttle.h" 23 #include "chrome/browser/renderer_host/transfer_navigation_resource_throttle.h"
24 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 24 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
25 #include "chrome/browser/ui/auto_login_prompter.h" 25 #include "chrome/browser/ui/auto_login_prompter.h"
26 #include "chrome/browser/ui/login/login_prompt.h" 26 #include "chrome/browser/ui/login/login_prompt.h"
27 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 27 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/extensions/user_script.h" 29 #include "chrome/common/extensions/user_script.h"
30 #include "chrome/common/render_messages.h" 30 #include "chrome/common/render_messages.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
33 #include "content/public/browser/render_widget_host_view.h"
mmenke 2012/05/01 16:23:21 nit: Alphabetize.
gavinp 2012/05/01 18:50:22 Done.
33 #include "content/public/browser/render_view_host.h" 34 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/render_view_host_delegate.h"
34 #include "content/public/browser/resource_context.h" 36 #include "content/public/browser/resource_context.h"
35 #include "content/public/browser/resource_dispatcher_host.h" 37 #include "content/public/browser/resource_dispatcher_host.h"
36 #include "content/public/browser/resource_request_info.h" 38 #include "content/public/browser/resource_request_info.h"
39 #include "content/public/browser/web_contents.h"
40 #include "content/public/browser/web_contents_view.h"
37 #include "net/base/load_flags.h" 41 #include "net/base/load_flags.h"
38 #include "net/base/ssl_config_service.h" 42 #include "net/base/ssl_config_service.h"
39 #include "net/url_request/url_request.h" 43 #include "net/url_request/url_request.h"
44 #include "ui/gfx/size.h"
40 45
41 // TODO(oshima): Enable this for other platforms. 46 // TODO(oshima): Enable this for other platforms.
42 #if defined(OS_CHROMEOS) 47 #if defined(OS_CHROMEOS)
43 #include "chrome/browser/renderer_host/offline_resource_throttle.h" 48 #include "chrome/browser/renderer_host/offline_resource_throttle.h"
44 #endif 49 #endif
45 50
46 using content::BrowserThread; 51 using content::BrowserThread;
47 using content::RenderViewHost; 52 using content::RenderViewHost;
48 using content::ResourceDispatcherHostLoginDelegate; 53 using content::ResourceDispatcherHostLoginDelegate;
49 using content::ResourceRequestInfo; 54 using content::ResourceRequestInfo;
50 55
51 namespace { 56 namespace {
52 57
58 // TODO(gavinp): Remove this after https://bugs.webkit.org/show_bug.cgi?id=85005
59 // lands in WebKit.
53 void AddPrerenderOnUI( 60 void AddPrerenderOnUI(
54 int render_process_id, int render_view_id, 61 int render_process_id, int render_view_id,
55 const GURL& url, const content::Referrer& referrer) { 62 const GURL& url, const content::Referrer& referrer) {
56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
57 prerender::PrerenderManager* prerender_manager = 64 prerender::PrerenderManager* prerender_manager =
58 prerender::FindPrerenderManagerUsingRenderProcessId(render_process_id); 65 prerender::FindPrerenderManagerUsingRenderProcessId(render_process_id);
59 if (!prerender_manager) 66 if (!prerender_manager)
60 return; 67 return;
61 68
62 prerender_manager->AddPrerenderFromLinkRelPrerender(render_process_id, 69 RenderViewHost* render_view_host =
63 render_view_id, 70 RenderViewHost::FromID(render_process_id, render_view_id);
64 url, 71 if (!render_view_host)
65 referrer); 72 return;
73 gfx::Rect tab_bounds;
74 if (content::WebContents* source_wc =
75 render_view_host->GetDelegate()->GetAsWebContents())
76 source_wc->GetView()->GetContainerBounds(&tab_bounds);
77 prerender_manager->AddPrerenderFromLinkRelPrerender(
78 render_process_id, render_view_id, url, referrer,
79 !tab_bounds.IsEmpty() ?
80 tab_bounds.size() :
81 prerender_manager->config().default_tab_bounds.size(),
82 render_view_host->GetSessionStorageNamespace());
66 } 83 }
67 84
68 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { 85 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) {
69 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id, 86 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id,
70 render_view_id); 87 render_view_id);
71 if (!rvh) 88 if (!rvh)
72 return; 89 return;
73 90
74 content::NotificationService::current()->Notify( 91 content::NotificationService::current()->Notify(
75 chrome::NOTIFICATION_DOWNLOAD_INITIATED, 92 chrome::NOTIFICATION_DOWNLOAD_INITIATED,
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 #if defined(ENABLE_ONE_CLICK_SIGNIN) 354 #if defined(ENABLE_ONE_CLICK_SIGNIN)
338 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 355 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
339 356
340 // See if the response contains the Google-Accounts-SignIn header. If so, 357 // See if the response contains the Google-Accounts-SignIn header. If so,
341 // then the user has just finished signing in, and the server is allowing the 358 // then the user has just finished signing in, and the server is allowing the
342 // browser to suggest connecting the user's profile to the account. 359 // browser to suggest connecting the user's profile to the account.
343 OneClickSigninHelper::ShowInfoBarIfPossible(request, info->GetChildID(), 360 OneClickSigninHelper::ShowInfoBarIfPossible(request, info->GetChildID(),
344 info->GetRouteID()); 361 info->GetRouteID());
345 #endif 362 #endif
346 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698