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/renderer/chrome_render_process_observer.cc

Issue 8498007: ContentSettingsObserver (+ related classes) cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing struct ContentSettings, too. Created 9 years, 1 month 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/renderer/chrome_render_process_observer.h" 5 #include "chrome/renderer/chrome_render_process_observer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 WebCache::UsageStats stats; 99 WebCache::UsageStats stats;
100 WebCache::getUsageStats(&stats); 100 WebCache::getUsageStats(&stats);
101 RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats(stats)); 101 RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats(stats));
102 } 102 }
103 103
104 ScopedRunnableMethodFactory<RendererResourceDelegate> method_factory_; 104 ScopedRunnableMethodFactory<RendererResourceDelegate> method_factory_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate); 106 DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate);
107 }; 107 };
108 108
109 class RenderViewContentSettingsSetter : public content::RenderViewVisitor {
110 public:
111 RenderViewContentSettingsSetter(const GURL& url,
112 const ContentSettings& content_settings)
113 : url_(url),
114 content_settings_(content_settings) {
115 }
116
117 virtual bool Visit(content::RenderView* render_view) {
118 if (GURL(render_view->GetWebView()->mainFrame()->document().url()) ==
119 url_) {
120 ContentSettingsObserver::Get(render_view)->SetContentSettings(
121 content_settings_);
122 }
123 return true;
124 }
125
126 private:
127 GURL url_;
128 ContentSettings content_settings_;
129
130 DISALLOW_COPY_AND_ASSIGN(RenderViewContentSettingsSetter);
131 };
132
133 #if defined(OS_WIN) 109 #if defined(OS_WIN)
134 static base::win::IATPatchFunction g_iat_patch_createdca; 110 static base::win::IATPatchFunction g_iat_patch_createdca;
135 HDC WINAPI CreateDCAPatch(LPCSTR driver_name, 111 HDC WINAPI CreateDCAPatch(LPCSTR driver_name,
136 LPCSTR device_name, 112 LPCSTR device_name,
137 LPCSTR output, 113 LPCSTR output,
138 const void* init_data) { 114 const void* init_data) {
139 DCHECK(std::string("DISPLAY") == std::string(driver_name)); 115 DCHECK(std::string("DISPLAY") == std::string(driver_name));
140 DCHECK(!device_name); 116 DCHECK(!device_name);
141 DCHECK(!output); 117 DCHECK(!output);
142 DCHECK(!init_data); 118 DCHECK(!init_data);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 232
257 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { 233 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() {
258 } 234 }
259 235
260 bool ChromeRenderProcessObserver::OnControlMessageReceived( 236 bool ChromeRenderProcessObserver::OnControlMessageReceived(
261 const IPC::Message& message) { 237 const IPC::Message& message) {
262 bool handled = true; 238 bool handled = true;
263 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) 239 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message)
264 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, 240 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess,
265 OnSetIsIncognitoProcess) 241 OnSetIsIncognitoProcess)
266 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetDefaultContentSettings,
267 OnSetDefaultContentSettings)
268 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingsForCurrentURL,
269 OnSetContentSettingsForCurrentURL)
270 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, 242 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules,
271 OnSetContentSettingRules) 243 OnSetContentSettingRules)
272 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) 244 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities)
273 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) 245 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache)
274 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) 246 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup)
275 #if defined(USE_TCMALLOC) 247 #if defined(USE_TCMALLOC)
276 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererTcmalloc, 248 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererTcmalloc,
277 OnGetRendererTcmalloc) 249 OnGetRendererTcmalloc)
278 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetTcmallocHeapProfiling, 250 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetTcmallocHeapProfiling,
279 OnSetTcmallocHeapProfiling) 251 OnSetTcmallocHeapProfiling)
(...skipping 11 matching lines...) Expand all
291 263
292 void ChromeRenderProcessObserver::WebKitInitialized() { 264 void ChromeRenderProcessObserver::WebKitInitialized() {
293 WebRuntimeFeatures::enableMediaPlayer(media::IsMediaLibraryInitialized()); 265 WebRuntimeFeatures::enableMediaPlayer(media::IsMediaLibraryInitialized());
294 } 266 }
295 267
296 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( 268 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess(
297 bool is_incognito_process) { 269 bool is_incognito_process) {
298 is_incognito_process_ = is_incognito_process; 270 is_incognito_process_ = is_incognito_process;
299 } 271 }
300 272
301 void ChromeRenderProcessObserver::OnSetContentSettingsForCurrentURL(
302 const GURL& url,
303 const ContentSettings& content_settings) {
304 RenderViewContentSettingsSetter setter(url, content_settings);
305 content::RenderView::ForEach(&setter);
306 }
307
308 void ChromeRenderProcessObserver::OnSetDefaultContentSettings(
309 const ContentSettings& content_settings) {
310 default_content_settings_ = content_settings;
311 }
312
313 void ChromeRenderProcessObserver::OnSetContentSettingRules( 273 void ChromeRenderProcessObserver::OnSetContentSettingRules(
314 const RendererContentSettingRules& rules) { 274 const RendererContentSettingRules& rules) {
315 content_setting_rules_ = rules; 275 content_setting_rules_ = rules;
316 } 276 }
317 277
318 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, 278 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity,
319 size_t max_dead_capacity, 279 size_t max_dead_capacity,
320 size_t capacity) { 280 size_t capacity) {
321 WebCache::setCapacities( 281 WebCache::setCapacities(
322 min_dead_capacity, max_dead_capacity, capacity); 282 min_dead_capacity, max_dead_capacity, capacity);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (clear_cache_pending_) { 387 if (clear_cache_pending_) {
428 clear_cache_pending_ = false; 388 clear_cache_pending_ = false;
429 WebCache::clear(); 389 WebCache::clear();
430 } 390 }
431 } 391 }
432 392
433 const RendererContentSettingRules* 393 const RendererContentSettingRules*
434 ChromeRenderProcessObserver::content_setting_rules() const { 394 ChromeRenderProcessObserver::content_setting_rules() const {
435 return &content_setting_rules_; 395 return &content_setting_rules_;
436 } 396 }
437
438 const ContentSettings*
439 ChromeRenderProcessObserver::default_content_settings() const {
440 return &default_content_settings_;
441 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_process_observer.h ('k') | chrome/renderer/content_settings_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698