Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5220)

Unified Diff: net/url_request/url_request.cc

Issue 7523042: Add a status message "Waiting for extension Foo..." when there's a request (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_http_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index b71b36b311f19b34debb9b8fdcf4d8d15a56cdc6..eeca03535f26a26e59dd81a6f90369f3540c903b 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -141,6 +141,7 @@ URLRequest::URLRequest(const GURL& url, Delegate* delegate)
final_upload_progress_(0),
priority_(LOWEST),
identifier_(GenerateURLRequestIdentifier()),
+ blocked_on_delegate_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(
before_request_callback_(this, &URLRequest::BeforeRequestComplete)),
has_notified_completion_(false) {
@@ -254,8 +255,13 @@ void URLRequest::SetExtraRequestHeaders(
// for request headers are implemented.
}
-LoadState URLRequest::GetLoadState() const {
- return job_ ? job_->GetLoadState() : LOAD_STATE_IDLE;
+LoadStateWithParam URLRequest::GetLoadState() const {
+ if (blocked_on_delegate_) {
+ return LoadStateWithParam(LOAD_STATE_WAITING_FOR_DELEGATE,
+ load_state_param_);
+ }
+ return LoadStateWithParam(job_ ? job_->GetLoadState() : LOAD_STATE_IDLE,
+ string16());
}
uint64 URLRequest::GetUploadProgress() const {
@@ -400,7 +406,7 @@ void URLRequest::Start() {
if (context_->network_delegate()->NotifyBeforeURLRequest(
this, &before_request_callback_, &delegate_redirect_url_) ==
net::ERR_IO_PENDING) {
- net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
+ SetBlockedOnDelegate();
return; // paused
}
}
@@ -414,7 +420,7 @@ void URLRequest::BeforeRequestComplete(int error) {
DCHECK(!job_);
DCHECK_NE(ERR_IO_PENDING, error);
- net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
+ SetUnblockedOnDelegate();
if (error != OK) {
net_log_.AddEvent(NetLog::TYPE_CANCELLED,
make_scoped_refptr(new NetLogStringParameter("source", "delegate")));
@@ -804,4 +810,15 @@ void URLRequest::NotifyRequestCompleted() {
context_->network_delegate()->NotifyCompleted(this);
}
+void URLRequest::SetBlockedOnDelegate() {
+ blocked_on_delegate_ = true;
+ net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
+}
+
+void URLRequest::SetUnblockedOnDelegate() {
+ blocked_on_delegate_ = false;
+ load_state_param_.clear();
+ net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
+}
+
} // namespace net
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_http_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698