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 "base/allocator/allocator_extension.h" | 7 #include "base/allocator/allocator_extension.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 class RendererResourceDelegate : public content::ResourceDispatcherDelegate { | 70 class RendererResourceDelegate : public content::ResourceDispatcherDelegate { |
71 public: | 71 public: |
72 RendererResourceDelegate() | 72 RendererResourceDelegate() |
73 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 73 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
74 } | 74 } |
75 | 75 |
76 virtual webkit_glue::ResourceLoaderBridge::Peer* OnRequestComplete( | 76 virtual webkit_glue::ResourceLoaderBridge::Peer* OnRequestComplete( |
77 webkit_glue::ResourceLoaderBridge::Peer* current_peer, | 77 webkit_glue::ResourceLoaderBridge::Peer* current_peer, |
78 ResourceType::Type resource_type, | 78 ResourceType::Type resource_type, |
79 const net::URLRequestStatus& status) { | 79 int error_code) { |
80 // Update the browser about our cache. | 80 // Update the browser about our cache. |
81 // Rate limit informing the host of our cache stats. | 81 // Rate limit informing the host of our cache stats. |
82 if (!weak_factory_.HasWeakPtrs()) { | 82 if (!weak_factory_.HasWeakPtrs()) { |
83 MessageLoop::current()->PostDelayedTask( | 83 MessageLoop::current()->PostDelayedTask( |
84 FROM_HERE, | 84 FROM_HERE, |
85 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, | 85 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, |
86 weak_factory_.GetWeakPtr()), | 86 weak_factory_.GetWeakPtr()), |
87 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); | 87 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); |
88 } | 88 } |
89 | 89 |
90 if (status.status() != net::URLRequestStatus::CANCELED || | 90 if (error_code == net::ERR_ABORTED) { |
91 status.error() == net::ERR_ABORTED) { | |
92 return NULL; | 91 return NULL; |
93 } | 92 } |
94 | 93 |
95 // Resource canceled with a specific error are filtered. | 94 // Resource canceled with a specific error are filtered. |
96 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( | 95 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( |
97 resource_type, current_peer, status.error()); | 96 resource_type, current_peer, error_code); |
98 } | 97 } |
99 | 98 |
100 virtual webkit_glue::ResourceLoaderBridge::Peer* OnReceivedResponse( | 99 virtual webkit_glue::ResourceLoaderBridge::Peer* OnReceivedResponse( |
101 webkit_glue::ResourceLoaderBridge::Peer* current_peer, | 100 webkit_glue::ResourceLoaderBridge::Peer* current_peer, |
102 const std::string& mime_type, | 101 const std::string& mime_type, |
103 const GURL& url) { | 102 const GURL& url) { |
104 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( | 103 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( |
105 current_peer, RenderThread::Get(), mime_type, url); | 104 current_peer, RenderThread::Get(), mime_type, url); |
106 } | 105 } |
107 | 106 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 if (clear_cache_pending_) { | 356 if (clear_cache_pending_) { |
358 clear_cache_pending_ = false; | 357 clear_cache_pending_ = false; |
359 WebCache::clear(); | 358 WebCache::clear(); |
360 } | 359 } |
361 } | 360 } |
362 | 361 |
363 const RendererContentSettingRules* | 362 const RendererContentSettingRules* |
364 ChromeRenderProcessObserver::content_setting_rules() const { | 363 ChromeRenderProcessObserver::content_setting_rules() const { |
365 return &content_setting_rules_; | 364 return &content_setting_rules_; |
366 } | 365 } |
OLD | NEW |