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

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

Issue 7690006: Revert 97446 - Modifying prefetch to account for multi-profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_render_view_host_observer.h" 5 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/dom_operation_notification_details.h" 8 #include "chrome/browser/dom_operation_notification_details.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/net/predictor.h" 10 #include "chrome/browser/net/predictor_api.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/extensions/extension_messages.h" 14 #include "chrome/common/extensions/extension_messages.h"
15 #include "chrome/common/render_messages.h" 15 #include "chrome/common/render_messages.h"
16 #include "content/browser/browsing_instance.h" 16 #include "content/browser/browsing_instance.h"
17 #include "content/browser/child_process_security_policy.h" 17 #include "content/browser/child_process_security_policy.h"
18 #include "content/browser/renderer_host/render_view_host_delegate.h" 18 #include "content/browser/renderer_host/render_view_host_delegate.h"
19 #include "content/browser/renderer_host/render_view_host.h" 19 #include "content/browser/renderer_host/render_view_host.h"
20 #include "content/browser/site_instance.h" 20 #include "content/browser/site_instance.h"
21 #include "content/common/bindings_policy.h" 21 #include "content/common/bindings_policy.h"
22 #include "content/common/notification_service.h" 22 #include "content/common/notification_service.h"
23 #include "content/common/url_constants.h" 23 #include "content/common/url_constants.h"
24 #include "content/common/view_messages.h" 24 #include "content/common/view_messages.h"
25 25
26 ChromeRenderViewHostObserver::ChromeRenderViewHostObserver( 26 ChromeRenderViewHostObserver::ChromeRenderViewHostObserver(
27 RenderViewHost* render_view_host, chrome_browser_net::Predictor* predictor) 27 RenderViewHost* render_view_host)
28 : RenderViewHostObserver(render_view_host), 28 : RenderViewHostObserver(render_view_host) {
29 predictor_(predictor) {
30 InitRenderViewHostForExtensions(); 29 InitRenderViewHostForExtensions();
31 } 30 }
32 31
33 ChromeRenderViewHostObserver::~ChromeRenderViewHostObserver() { 32 ChromeRenderViewHostObserver::~ChromeRenderViewHostObserver() {
34 } 33 }
35 34
36 void ChromeRenderViewHostObserver::RenderViewHostInitialized() { 35 void ChromeRenderViewHostObserver::RenderViewHostInitialized() {
37 InitRenderViewForExtensions(); 36 InitRenderViewForExtensions();
38 } 37 }
39 38
40 void ChromeRenderViewHostObserver::Navigate( 39 void ChromeRenderViewHostObserver::Navigate(
41 const ViewMsg_Navigate_Params& params) { 40 const ViewMsg_Navigate_Params& params) {
42 const GURL& url = params.url; 41 const GURL& url = params.url;
43 if (!predictor_)
44 return;
45 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame) && 42 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame) &&
46 (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme))) 43 (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme)))
47 predictor_->PreconnectUrlAndSubresources(url); 44 chrome_browser_net::PreconnectUrlAndSubresources(url);
48 } 45 }
49 46
50 bool ChromeRenderViewHostObserver::OnMessageReceived( 47 bool ChromeRenderViewHostObserver::OnMessageReceived(
51 const IPC::Message& message) { 48 const IPC::Message& message) {
52 bool handled = true; 49 bool handled = true;
53 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewHostObserver, message) 50 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewHostObserver, message)
54 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, 51 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse,
55 OnDomOperationResponse) 52 OnDomOperationResponse)
56 IPC_MESSAGE_UNHANDLED(handled = false) 53 IPC_MESSAGE_UNHANDLED(handled = false)
57 IPC_END_MESSAGE_MAP() 54 IPC_END_MESSAGE_MAP()
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 153 }
157 154
158 void ChromeRenderViewHostObserver::OnDomOperationResponse( 155 void ChromeRenderViewHostObserver::OnDomOperationResponse(
159 const std::string& json_string, int automation_id) { 156 const std::string& json_string, int automation_id) {
160 DomOperationNotificationDetails details(json_string, automation_id); 157 DomOperationNotificationDetails details(json_string, automation_id);
161 NotificationService::current()->Notify( 158 NotificationService::current()->Notify(
162 chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, 159 chrome::NOTIFICATION_DOM_OPERATION_RESPONSE,
163 Source<RenderViewHost>(render_view_host()), 160 Source<RenderViewHost>(render_view_host()),
164 Details<DomOperationNotificationDetails>(&details)); 161 Details<DomOperationNotificationDetails>(&details));
165 } 162 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_view_host_observer.h ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698