diff options
Diffstat (limited to 'chrome/browser')
21 files changed, 66 insertions, 57 deletions
diff --git a/chrome/browser/android/intercept_download_resource_throttle.cc b/chrome/browser/android/intercept_download_resource_throttle.cc index 5700ff9..d29010d 100644 --- a/chrome/browser/android/intercept_download_resource_throttle.cc +++ b/chrome/browser/android/intercept_download_resource_throttle.cc @@ -33,6 +33,10 @@ void InterceptDownloadResourceThrottle::WillProcessResponse(bool* defer) { ProcessDownloadRequest(); } +const char* InterceptDownloadResourceThrottle::GetNameForLogging() const { + return "InterceptDownloadResourceThrottle"; +} + void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { if (request_->method() != net::HttpRequestHeaders::kGetMethod || request_->response_info().did_use_http_auth) @@ -50,4 +54,4 @@ void InterceptDownloadResourceThrottle::ProcessDownloadRequest() { controller()->Cancel(); } -} // namespace +} // namespace chrome diff --git a/chrome/browser/android/intercept_download_resource_throttle.h b/chrome/browser/android/intercept_download_resource_throttle.h index a42a502..8b14d74 100644 --- a/chrome/browser/android/intercept_download_resource_throttle.h +++ b/chrome/browser/android/intercept_download_resource_throttle.h @@ -27,6 +27,7 @@ class InterceptDownloadResourceThrottle : public content::ResourceThrottle { // content::ResourceThrottle implementation: virtual void WillStartRequest(bool* defer) OVERRIDE; virtual void WillProcessResponse(bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; private: virtual ~InterceptDownloadResourceThrottle(); @@ -41,6 +42,6 @@ class InterceptDownloadResourceThrottle : public content::ResourceThrottle { DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle); }; -} // namespace +} // namespace chrome #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ diff --git a/chrome/browser/chromeos/login/merge_session_throttle.cc b/chrome/browser/chromeos/login/merge_session_throttle.cc index 2672851..e73894b 100644 --- a/chrome/browser/chromeos/login/merge_session_throttle.cc +++ b/chrome/browser/chromeos/login/merge_session_throttle.cc @@ -99,6 +99,10 @@ void MergeSessionThrottle::WillStartRequest(bool* defer) { *defer = true; } +const char* MergeSessionThrottle::GetNameForLogging() const { + return "MergeSessionThrottle"; +} + // static. bool MergeSessionThrottle::AreAllSessionMergedAlready() { return !base::AtomicRefCountIsZero(&all_profiles_restored_); diff --git a/chrome/browser/chromeos/login/merge_session_throttle.h b/chrome/browser/chromeos/login/merge_session_throttle.h index e53352f..ddcc9ad 100644 --- a/chrome/browser/chromeos/login/merge_session_throttle.h +++ b/chrome/browser/chromeos/login/merge_session_throttle.h @@ -36,6 +36,7 @@ class MergeSessionThrottle // content::ResourceThrottle implementation: virtual void WillStartRequest(bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; // Checks if session is already merged. static bool AreAllSessionMergedAlready(); diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc index b790dad..ad95f70 100644 --- a/chrome/browser/component_updater/component_updater_service.cc +++ b/chrome/browser/component_updater/component_updater_service.cc @@ -168,6 +168,7 @@ class CUResourceThrottle // Overriden from ResourceThrottle. virtual void WillStartRequest(bool* defer) OVERRIDE; virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; // Component updater calls this function via PostTask to unblock the request. void Unblock(); @@ -1103,6 +1104,10 @@ void CUResourceThrottle::WillRedirectRequest(const GURL& new_url, bool* defer) { WillStartRequest(defer); } +const char* CUResourceThrottle::GetNameForLogging() const { + return "ComponentUpdateResourceThrottle"; +} + void CUResourceThrottle::Unblock() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (state_ == BLOCKED) diff --git a/chrome/browser/download/download_resource_throttle.cc b/chrome/browser/download/download_resource_throttle.cc index 1fae14d..c66e985 100644 --- a/chrome/browser/download/download_resource_throttle.cc +++ b/chrome/browser/download/download_resource_throttle.cc @@ -42,6 +42,10 @@ void DownloadResourceThrottle::WillProcessResponse(bool* defer) { WillDownload(defer); } +const char* DownloadResourceThrottle::GetNameForLogging() const { + return "DownloadResourceThrottle"; +} + void DownloadResourceThrottle::WillDownload(bool* defer) { DCHECK(!request_deferred_); diff --git a/chrome/browser/download/download_resource_throttle.h b/chrome/browser/download/download_resource_throttle.h index b3c6ad7..4627b25 100644 --- a/chrome/browser/download/download_resource_throttle.h +++ b/chrome/browser/download/download_resource_throttle.h @@ -32,6 +32,7 @@ class DownloadResourceThrottle virtual void WillStartRequest(bool* defer) OVERRIDE; virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; virtual void WillProcessResponse(bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; private: virtual ~DownloadResourceThrottle(); diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index 9767b23..321a90b 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc @@ -135,6 +135,10 @@ class TestNavigationListener virtual void WillStartRequest(bool* defer) OVERRIDE { *defer = true; } + + virtual const char* GetNameForLogging() const OVERRIDE { + return "TestNavigationListener::Throttle"; + } }; typedef base::WeakPtr<Throttle> WeakThrottle; typedef std::list<WeakThrottle> WeakThrottleList; diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index 500d885..008b6fc 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -1181,9 +1181,9 @@ bool ExtensionWebRequestEventRouter::DispatchEvent( std::string delegate_info = l10n_util::GetStringFUTF8(IDS_LOAD_STATE_PARAMETER_EXTENSION, UTF8ToUTF16((*it)->extension_name)); - request->SetDelegateInfo( - delegate_info.c_str(), - net::URLRequest::DELEGATE_INFO_DISPLAY_TO_USER); + // LobAndReport allows extensions that block requests to be displayed in + // the load status bar. + request->LogAndReportBlockedBy(delegate_info.c_str()); } ++num_handlers_blocking; } @@ -1750,8 +1750,7 @@ void ExtensionWebRequestEventRouter::DecrementBlockCount( } if (num_handlers_blocking == 0) { - blocked_request.request->SetDelegateInfo( - NULL, net::URLRequest::DELEGATE_INFO_DEBUG_ONLY); + blocked_request.request->LogUnblocked(); ExecuteDeltas(profile, request_id, true); } else { // Update the URLRequest to make sure it's tagged with an extension that's @@ -1765,9 +1764,7 @@ void ExtensionWebRequestEventRouter::DecrementBlockCount( std::string delegate_info = l10n_util::GetStringFUTF8(IDS_LOAD_STATE_PARAMETER_EXTENSION, UTF8ToUTF16(it->extension_name)); - blocked_request.request->SetDelegateInfo( - delegate_info.c_str(), - net::URLRequest::DELEGATE_INFO_DISPLAY_TO_USER); + blocked_request.request->LogAndReportBlockedBy(delegate_info.c_str()); break; } } diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc index b04b326..7102e36 100644 --- a/chrome/browser/extensions/user_script_listener.cc +++ b/chrome/browser/extensions/user_script_listener.cc @@ -46,6 +46,10 @@ class UserScriptListener::Throttle } } + virtual const char* GetNameForLogging() const OVERRIDE { + return "UserScriptListener::Throttle"; + } + private: bool should_defer_; bool did_defer_; diff --git a/chrome/browser/managed_mode/managed_mode_resource_throttle.cc b/chrome/browser/managed_mode/managed_mode_resource_throttle.cc index 03f41a1..001508d 100644 --- a/chrome/browser/managed_mode/managed_mode_resource_throttle.cc +++ b/chrome/browser/managed_mode/managed_mode_resource_throttle.cc @@ -57,6 +57,10 @@ void ManagedModeResourceThrottle::WillRedirectRequest(const GURL& new_url, ShowInterstitialIfNeeded(true, new_url, defer); } +const char* ManagedModeResourceThrottle::GetNameForLogging() const { + return "ManagedModeResourceThrottle"; +} + void ManagedModeResourceThrottle::OnInterstitialResult(bool continue_request) { if (continue_request) controller()->Resume(); diff --git a/chrome/browser/managed_mode/managed_mode_resource_throttle.h b/chrome/browser/managed_mode/managed_mode_resource_throttle.h index b4b8f5a..6cd17ee 100644 --- a/chrome/browser/managed_mode/managed_mode_resource_throttle.h +++ b/chrome/browser/managed_mode/managed_mode_resource_throttle.h @@ -28,6 +28,8 @@ class ManagedModeResourceThrottle : public content::ResourceThrottle { virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; + private: void ShowInterstitialIfNeeded(bool is_redirect, const GURL& url, diff --git a/chrome/browser/prerender/prerender_pending_swap_throttle.cc b/chrome/browser/prerender/prerender_pending_swap_throttle.cc index 23b7ae59..b1a3455 100644 --- a/chrome/browser/prerender/prerender_pending_swap_throttle.cc +++ b/chrome/browser/prerender/prerender_pending_swap_throttle.cc @@ -47,6 +47,10 @@ void PrerenderPendingSwapThrottle::WillStartRequest(bool* defer) { this->AsWeakPtr()); } +const char* PrerenderPendingSwapThrottle::GetNameForLogging() const { + return "PrerenderPendingSwapThrottle"; +} + void PrerenderPendingSwapThrottle::Resume() { DCHECK(throttled_); diff --git a/chrome/browser/prerender/prerender_pending_swap_throttle.h b/chrome/browser/prerender/prerender_pending_swap_throttle.h index 8165871..ebc3e1a 100644 --- a/chrome/browser/prerender/prerender_pending_swap_throttle.h +++ b/chrome/browser/prerender/prerender_pending_swap_throttle.h @@ -33,6 +33,8 @@ class PrerenderPendingSwapThrottle // content::ResourceThrottle implementation: virtual void WillStartRequest(bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; + // Called by the PrerenderTracker when the swap failed. // May only be called if currently throttling the resource. void Resume(); diff --git a/chrome/browser/prerender/prerender_resource_throttle.cc b/chrome/browser/prerender/prerender_resource_throttle.cc index 045d40e..8499c0c 100644 --- a/chrome/browser/prerender/prerender_resource_throttle.cc +++ b/chrome/browser/prerender/prerender_resource_throttle.cc @@ -112,6 +112,10 @@ void PrerenderResourceThrottle::WillRedirectRequest(const GURL& new_url, this->AsWeakPtr()); } +const char* PrerenderResourceThrottle::GetNameForLogging() const { + return "PrerenderResourceThrottle"; +} + void PrerenderResourceThrottle::Resume() { DCHECK(throttled_); diff --git a/chrome/browser/prerender/prerender_resource_throttle.h b/chrome/browser/prerender/prerender_resource_throttle.h index 63f2cd0..3ac4c5e 100644 --- a/chrome/browser/prerender/prerender_resource_throttle.h +++ b/chrome/browser/prerender/prerender_resource_throttle.h @@ -34,6 +34,7 @@ class PrerenderResourceThrottle // content::ResourceThrottle implementation: virtual void WillStartRequest(bool* defer) OVERRIDE; virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; // Called by the PrerenderTracker when a prerender becomes visible. // May only be called if currently throttling the resource. diff --git a/chrome/browser/renderer_host/offline_resource_throttle.cc b/chrome/browser/renderer_host/offline_resource_throttle.cc index 4613437..598debd 100644 --- a/chrome/browser/renderer_host/offline_resource_throttle.cc +++ b/chrome/browser/renderer_host/offline_resource_throttle.cc @@ -103,6 +103,10 @@ void OfflineResourceThrottle::WillStartRequest(bool* defer) { *defer = true; } +const char* OfflineResourceThrottle::GetNameForLogging() const { + return "OfflineResourceThrottle"; +} + void OfflineResourceThrottle::OnBlockingPageComplete(bool proceed) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); diff --git a/chrome/browser/renderer_host/offline_resource_throttle.h b/chrome/browser/renderer_host/offline_resource_throttle.h index 95d8674..a78fadc 100644 --- a/chrome/browser/renderer_host/offline_resource_throttle.h +++ b/chrome/browser/renderer_host/offline_resource_throttle.h @@ -31,6 +31,7 @@ class OfflineResourceThrottle // content::ResourceThrottle implementation: virtual void WillStartRequest(bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; private: // OfflineLoadPage callback. diff --git a/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc b/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc index 4427ca0bd..e5cebb1 100644 --- a/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc +++ b/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc @@ -71,6 +71,10 @@ void SafeBrowsingResourceThrottle::WillRedirectRequest(const GURL& new_url, *defer = true; } +const char* SafeBrowsingResourceThrottle::GetNameForLogging() const { + return "SafeBrowsingResourceThrottle"; +} + // SafeBrowsingService::Client implementation, called on the IO thread once // the URL has been classified. void SafeBrowsingResourceThrottle::OnCheckBrowseUrlResult( diff --git a/chrome/browser/renderer_host/safe_browsing_resource_throttle.h b/chrome/browser/renderer_host/safe_browsing_resource_throttle.h index 88ec0e4..45483c1 100644 --- a/chrome/browser/renderer_host/safe_browsing_resource_throttle.h +++ b/chrome/browser/renderer_host/safe_browsing_resource_throttle.h @@ -55,6 +55,7 @@ class SafeBrowsingResourceThrottle // content::ResourceThrottle implementation (called on IO thread): virtual void WillStartRequest(bool* defer) OVERRIDE; virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; + virtual const char* GetNameForLogging() const OVERRIDE; // SafeBrowsingDabaseManager::Client implementation (called on IO thread): virtual void OnCheckBrowseUrlResult( diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index 427a0a3..2f40b4d 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -150,52 +150,9 @@ bool Base64StringToHashes(const std::string& hashes_str, // Returns a Value representing the state of a pre-existing URLRequest when // net-internals was opened. -Value* RequestStateToValue(const net::URLRequest* request, - net::NetLog::LogLevel log_level) { - DictionaryValue* dict = new DictionaryValue(); - dict->SetString("url", request->original_url().possibly_invalid_spec()); - - const std::vector<GURL>& url_chain = request->url_chain(); - if (url_chain.size() > 1) { - ListValue* list = new ListValue(); - for (std::vector<GURL>::const_iterator url = url_chain.begin(); - url != url_chain.end(); ++url) { - list->AppendString(url->spec()); - } - dict->Set("url_chain", list); - } - - dict->SetInteger("load_flags", request->load_flags()); - - net::LoadStateWithParam load_state = request->GetLoadState(); - dict->SetInteger("load_state", load_state.state); - if (!load_state.param.empty()) - dict->SetString("load_state_param", load_state.param); - - dict->SetString("method", request->method()); - dict->SetBoolean("has_upload", request->has_upload()); - dict->SetBoolean("is_pending", request->is_pending()); - - // Add the status of the request. The status should always be IO_PENDING, and - // the error should always be OK, unless something is holding onto a request - // that has finished or a request was leaked. Neither of these should happen. - switch (request->status().status()) { - case net::URLRequestStatus::SUCCESS: - dict->SetString("status", "SUCCESS"); - break; - case net::URLRequestStatus::IO_PENDING: - dict->SetString("status", "IO_PENDING"); - break; - case net::URLRequestStatus::CANCELED: - dict->SetString("status", "CANCELED"); - break; - case net::URLRequestStatus::FAILED: - dict->SetString("status", "FAILED"); - break; - } - if (request->status().error() != net::OK) - dict->SetInteger("net_error", request->status().error()); - return dict; +Value* GetRequestStateAsValue(const net::URLRequest* request, + net::NetLog::LogLevel log_level) { + return request->GetStateAsValue(); } // Returns true if |request1| was created before |request2|. @@ -1816,7 +1773,7 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { request_it != requests.end(); ++request_it) { const net::URLRequest* request = *request_it; net::NetLog::ParametersCallback callback = - base::Bind(&RequestStateToValue, base::Unretained(request)); + base::Bind(&GetRequestStateAsValue, base::Unretained(request)); // Create and add the entry directly, to avoid sending it to any other // NetLog observers. |