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