| OLD | NEW |
| 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/renderer/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/allocator/allocator_extension.h" | 10 #include "base/allocator/allocator_extension.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/threading/platform_thread.h" | 22 #include "base/threading/platform_thread.h" |
| 23 #include "chrome/common/child_process_logging.h" | 23 #include "chrome/common/child_process_logging.h" |
| 24 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/net/net_resource_provider.h" | 26 #include "chrome/common/net/net_resource_provider.h" |
| 27 #include "chrome/common/render_messages.h" | 27 #include "chrome/common/render_messages.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/common/variations/variations_util.h" | 29 #include "chrome/common/variations/variations_util.h" |
| 30 #include "chrome/renderer/content_settings_observer.h" | 30 #include "chrome/renderer/content_settings_observer.h" |
| 31 #include "chrome/renderer/extensions/extension_localization_peer.h" | |
| 32 #include "chrome/renderer/security_filter_peer.h" | 31 #include "chrome/renderer/security_filter_peer.h" |
| 33 #include "content/public/child/resource_dispatcher_delegate.h" | 32 #include "content/public/child/resource_dispatcher_delegate.h" |
| 34 #include "content/public/renderer/render_thread.h" | 33 #include "content/public/renderer/render_thread.h" |
| 35 #include "content/public/renderer/render_view.h" | 34 #include "content/public/renderer/render_view.h" |
| 36 #include "content/public/renderer/render_view_visitor.h" | 35 #include "content/public/renderer/render_view_visitor.h" |
| 37 #include "crypto/nss_util.h" | 36 #include "crypto/nss_util.h" |
| 38 #include "net/base/net_errors.h" | 37 #include "net/base/net_errors.h" |
| 39 #include "net/base/net_module.h" | 38 #include "net/base/net_module.h" |
| 40 #include "third_party/WebKit/public/web/WebCache.h" | 39 #include "third_party/WebKit/public/web/WebCache.h" |
| 41 #include "third_party/WebKit/public/web/WebDocument.h" | 40 #include "third_party/WebKit/public/web/WebDocument.h" |
| 42 #include "third_party/WebKit/public/web/WebFrame.h" | 41 #include "third_party/WebKit/public/web/WebFrame.h" |
| 43 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 42 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 44 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 43 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 45 #include "third_party/WebKit/public/web/WebView.h" | 44 #include "third_party/WebKit/public/web/WebView.h" |
| 46 | 45 |
| 47 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 48 #include "base/win/iat_patch_function.h" | 47 #include "base/win/iat_patch_function.h" |
| 49 #endif | 48 #endif |
| 50 | 49 |
| 50 #if defined(ENABLE_EXTENSIONS) |
| 51 #include "chrome/renderer/extensions/extension_localization_peer.h" |
| 52 #endif |
| 53 |
| 51 using blink::WebCache; | 54 using blink::WebCache; |
| 52 using blink::WebRuntimeFeatures; | 55 using blink::WebRuntimeFeatures; |
| 53 using blink::WebSecurityPolicy; | 56 using blink::WebSecurityPolicy; |
| 54 using blink::WebString; | 57 using blink::WebString; |
| 55 using content::RenderThread; | 58 using content::RenderThread; |
| 56 | 59 |
| 57 namespace { | 60 namespace { |
| 58 | 61 |
| 59 const int kCacheStatsDelayMS = 2000; | 62 const int kCacheStatsDelayMS = 2000; |
| 60 | 63 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 84 | 87 |
| 85 // Resource canceled with a specific error are filtered. | 88 // Resource canceled with a specific error are filtered. |
| 86 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( | 89 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( |
| 87 resource_type, current_peer, error_code); | 90 resource_type, current_peer, error_code); |
| 88 } | 91 } |
| 89 | 92 |
| 90 virtual content::RequestPeer* OnReceivedResponse( | 93 virtual content::RequestPeer* OnReceivedResponse( |
| 91 content::RequestPeer* current_peer, | 94 content::RequestPeer* current_peer, |
| 92 const std::string& mime_type, | 95 const std::string& mime_type, |
| 93 const GURL& url) OVERRIDE { | 96 const GURL& url) OVERRIDE { |
| 97 #if defined(ENABLE_EXTENSIONS) |
| 94 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( | 98 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( |
| 95 current_peer, RenderThread::Get(), mime_type, url); | 99 current_peer, RenderThread::Get(), mime_type, url); |
| 100 #else |
| 101 return NULL; |
| 102 #endif |
| 96 } | 103 } |
| 97 | 104 |
| 98 private: | 105 private: |
| 99 void InformHostOfCacheStats() { | 106 void InformHostOfCacheStats() { |
| 100 WebCache::UsageStats stats; | 107 WebCache::UsageStats stats; |
| 101 WebCache::getUsageStats(&stats); | 108 WebCache::getUsageStats(&stats); |
| 102 RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats(stats)); | 109 RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats(stats)); |
| 103 } | 110 } |
| 104 | 111 |
| 105 base::WeakPtrFactory<RendererResourceDelegate> weak_factory_; | 112 base::WeakPtrFactory<RendererResourceDelegate> weak_factory_; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 369 } |
| 363 | 370 |
| 364 void ChromeRenderProcessObserver::OnGetV8HeapStats() { | 371 void ChromeRenderProcessObserver::OnGetV8HeapStats() { |
| 365 HeapStatisticsCollector::Instance()->InitiateCollection(); | 372 HeapStatisticsCollector::Instance()->InitiateCollection(); |
| 366 } | 373 } |
| 367 | 374 |
| 368 const RendererContentSettingRules* | 375 const RendererContentSettingRules* |
| 369 ChromeRenderProcessObserver::content_setting_rules() const { | 376 ChromeRenderProcessObserver::content_setting_rules() const { |
| 370 return &content_setting_rules_; | 377 return &content_setting_rules_; |
| 371 } | 378 } |
| OLD | NEW |