| OLD | NEW |
| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 bool ChromeRenderProcessObserver::OnControlMessageReceived( | 260 bool ChromeRenderProcessObserver::OnControlMessageReceived( |
| 261 const IPC::Message& message) { | 261 const IPC::Message& message) { |
| 262 bool handled = true; | 262 bool handled = true; |
| 263 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) | 263 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) |
| 264 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, | 264 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, |
| 265 OnSetIsIncognitoProcess) | 265 OnSetIsIncognitoProcess) |
| 266 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetDefaultContentSettings, | 266 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetDefaultContentSettings, |
| 267 OnSetDefaultContentSettings) | 267 OnSetDefaultContentSettings) |
| 268 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingsForCurrentURL, | 268 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingsForCurrentURL, |
| 269 OnSetContentSettingsForCurrentURL) | 269 OnSetContentSettingsForCurrentURL) |
| 270 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetImageSettingRules, |
| 271 OnSetImageSettingRules) |
| 270 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) | 272 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) |
| 271 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) | 273 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) |
| 272 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) | 274 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) |
| 273 #if defined(USE_TCMALLOC) | 275 #if defined(USE_TCMALLOC) |
| 274 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererTcmalloc, | 276 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererTcmalloc, |
| 275 OnGetRendererTcmalloc) | 277 OnGetRendererTcmalloc) |
| 276 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetTcmallocHeapProfiling, | 278 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetTcmallocHeapProfiling, |
| 277 OnSetTcmallocHeapProfiling) | 279 OnSetTcmallocHeapProfiling) |
| 278 IPC_MESSAGE_HANDLER(ChromeViewMsg_WriteTcmallocHeapProfile, | 280 IPC_MESSAGE_HANDLER(ChromeViewMsg_WriteTcmallocHeapProfile, |
| 279 OnWriteTcmallocHeapProfile) | 281 OnWriteTcmallocHeapProfile) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 301 const ContentSettings& content_settings) { | 303 const ContentSettings& content_settings) { |
| 302 RenderViewContentSettingsSetter setter(url, content_settings); | 304 RenderViewContentSettingsSetter setter(url, content_settings); |
| 303 content::RenderView::ForEach(&setter); | 305 content::RenderView::ForEach(&setter); |
| 304 } | 306 } |
| 305 | 307 |
| 306 void ChromeRenderProcessObserver::OnSetDefaultContentSettings( | 308 void ChromeRenderProcessObserver::OnSetDefaultContentSettings( |
| 307 const ContentSettings& content_settings) { | 309 const ContentSettings& content_settings) { |
| 308 ContentSettingsObserver::SetDefaultContentSettings(content_settings); | 310 ContentSettingsObserver::SetDefaultContentSettings(content_settings); |
| 309 } | 311 } |
| 310 | 312 |
| 313 void ChromeRenderProcessObserver::OnSetImageSettingRules( |
| 314 const ContentSettingsForOneType& settings) { |
| 315 image_setting_rules_ = settings; |
| 316 } |
| 317 |
| 311 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, | 318 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, |
| 312 size_t max_dead_capacity, | 319 size_t max_dead_capacity, |
| 313 size_t capacity) { | 320 size_t capacity) { |
| 314 WebCache::setCapacities( | 321 WebCache::setCapacities( |
| 315 min_dead_capacity, max_dead_capacity, capacity); | 322 min_dead_capacity, max_dead_capacity, capacity); |
| 316 } | 323 } |
| 317 | 324 |
| 318 void ChromeRenderProcessObserver::OnClearCache(bool on_navigation) { | 325 void ChromeRenderProcessObserver::OnClearCache(bool on_navigation) { |
| 319 if (on_navigation) { | 326 if (on_navigation) { |
| 320 clear_cache_pending_ = true; | 327 clear_cache_pending_ = true; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 if (client_) | 422 if (client_) |
| 416 client_->OnPurgeMemory(); | 423 client_->OnPurgeMemory(); |
| 417 } | 424 } |
| 418 | 425 |
| 419 void ChromeRenderProcessObserver::ExecutePendingClearCache() { | 426 void ChromeRenderProcessObserver::ExecutePendingClearCache() { |
| 420 if (clear_cache_pending_) { | 427 if (clear_cache_pending_) { |
| 421 clear_cache_pending_ = false; | 428 clear_cache_pending_ = false; |
| 422 WebCache::clear(); | 429 WebCache::clear(); |
| 423 } | 430 } |
| 424 } | 431 } |
| 432 |
| 433 const ContentSettingsForOneType* |
| 434 ChromeRenderProcessObserver::image_setting_rules() const { |
| 435 return &image_setting_rules_; |
| 436 } |
| OLD | NEW |