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

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

Issue 2043753002: Declarative resource hints go through mojo IPC to //content Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove gmocking + add another browser test Created 4 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 (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_render_message_filter.h" 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 cookie_settings_(CookieSettingsFactory::GetForProfile(profile)) { 58 cookie_settings_(CookieSettingsFactory::GetForProfile(profile)) {
59 } 59 }
60 60
61 ChromeRenderMessageFilter::~ChromeRenderMessageFilter() { 61 ChromeRenderMessageFilter::~ChromeRenderMessageFilter() {
62 } 62 }
63 63
64 bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message) { 64 bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
65 bool handled = true; 65 bool handled = true;
66 IPC_BEGIN_MESSAGE_MAP(ChromeRenderMessageFilter, message) 66 IPC_BEGIN_MESSAGE_MAP(ChromeRenderMessageFilter, message)
67 IPC_MESSAGE_HANDLER(NetworkHintsMsg_DNSPrefetch, OnDnsPrefetch) 67 IPC_MESSAGE_HANDLER(NetworkHintsMsg_DNSPrefetch, OnDnsPrefetch)
68 IPC_MESSAGE_HANDLER(NetworkHintsMsg_Preconnect, OnPreconnect)
69 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdatedCacheStats, 68 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdatedCacheStats,
70 OnUpdatedCacheStats) 69 OnUpdatedCacheStats)
71 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDatabase, OnAllowDatabase) 70 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDatabase, OnAllowDatabase)
72 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDOMStorage, OnAllowDOMStorage) 71 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDOMStorage, OnAllowDOMStorage)
73 IPC_MESSAGE_HANDLER_DELAY_REPLY( 72 IPC_MESSAGE_HANDLER_DELAY_REPLY(
74 ChromeViewHostMsg_RequestFileSystemAccessSync, 73 ChromeViewHostMsg_RequestFileSystemAccessSync,
75 OnRequestFileSystemAccessSync) 74 OnRequestFileSystemAccessSync)
76 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessAsync, 75 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessAsync,
77 OnRequestFileSystemAccessAsync) 76 OnRequestFileSystemAccessAsync)
78 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB) 77 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB)
(...skipping 26 matching lines...) Expand all
105 break; 104 break;
106 } 105 }
107 } 106 }
108 107
109 void ChromeRenderMessageFilter::OnDnsPrefetch( 108 void ChromeRenderMessageFilter::OnDnsPrefetch(
110 const network_hints::LookupRequest& request) { 109 const network_hints::LookupRequest& request) {
111 if (predictor_) 110 if (predictor_)
112 predictor_->DnsPrefetchList(request.hostname_list); 111 predictor_->DnsPrefetchList(request.hostname_list);
113 } 112 }
114 113
115 void ChromeRenderMessageFilter::OnPreconnect(const GURL& url,
116 bool allow_credentials,
117 int count) {
118 if (count < 1) {
119 LOG(WARNING) << "NetworkHintsMsg_Preconnect IPC with invalid count: "
120 << count;
121 return;
122 }
123 if (predictor_ && url.is_valid() && url.has_host() && url.has_scheme() &&
124 url.SchemeIsHTTPOrHTTPS()) {
125 predictor_->PreconnectUrl(url, GURL(),
126 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED,
127 allow_credentials, count);
128 }
129 }
130
131 void ChromeRenderMessageFilter::OnUpdatedCacheStats( 114 void ChromeRenderMessageFilter::OnUpdatedCacheStats(
132 uint64_t min_dead_capacity, 115 uint64_t min_dead_capacity,
133 uint64_t max_dead_capacity, 116 uint64_t max_dead_capacity,
134 uint64_t capacity, 117 uint64_t capacity,
135 uint64_t live_size, 118 uint64_t live_size,
136 uint64_t dead_size) { 119 uint64_t dead_size) {
137 web_cache::WebCacheManager::GetInstance()->ObserveStats( 120 web_cache::WebCacheManager::GetInstance()->ObserveStats(
138 render_process_id_, min_dead_capacity, max_dead_capacity, capacity, 121 render_process_id_, min_dead_capacity, max_dead_capacity, capacity,
139 live_size, dead_size); 122 live_size, dead_size);
140 } 123 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 rappor::SampleString(g_browser_process->rappor_service(), metric, 334 rappor::SampleString(g_browser_process->rappor_service(), metric,
352 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, sample); 335 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, sample);
353 } 336 }
354 337
355 void ChromeRenderMessageFilter::OnRecordRapporURL(const std::string& metric, 338 void ChromeRenderMessageFilter::OnRecordRapporURL(const std::string& metric,
356 const GURL& sample) { 339 const GURL& sample) {
357 DCHECK_CURRENTLY_ON(BrowserThread::UI); 340 DCHECK_CURRENTLY_ON(BrowserThread::UI);
358 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), 341 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
359 metric, sample); 342 metric, sample);
360 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698