Chromium Code Reviews| Index: chrome/browser/ui/webui/chrome_url_data_manager_backend.cc |
| diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc |
| index 838f5419462950cea8fa1de55ddf083ad6be0d58..b21ff593597d25376f14070304c8367258048500 100644 |
| --- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc |
| +++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc |
| @@ -181,6 +181,10 @@ class URLRequestChromeJob : public net::URLRequestJob { |
| mime_type_ = mime_type; |
| } |
| + void SetAllowCaching(bool allow_caching) { |
| + allow_caching_ = allow_caching; |
| + } |
| + |
| private: |
| virtual ~URLRequestChromeJob(); |
| @@ -203,6 +207,7 @@ class URLRequestChromeJob : public net::URLRequestJob { |
| scoped_refptr<net::IOBuffer> pending_buf_; |
| int pending_buf_size_; |
| std::string mime_type_; |
| + bool allow_caching_; |
|
James Hawkins
2012/05/21 15:58:50
nit: Document member variable.
Patrick Dubroy
2012/05/21 16:26:28
Done.
|
| // The backend is owned by ChromeURLRequestContext and always outlives us. |
| ChromeURLDataManagerBackend* backend_; |
| @@ -217,6 +222,7 @@ URLRequestChromeJob::URLRequestChromeJob(net::URLRequest* request, |
| : net::URLRequestJob(request), |
| data_offset_(0), |
| pending_buf_size_(0), |
| + allow_caching_(true), |
| backend_(backend), |
| ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| DCHECK(backend); |
| @@ -254,6 +260,8 @@ void URLRequestChromeJob::GetResponseInfo(net::HttpResponseInfo* info) { |
| // indistiguishable from other error types. Instant relies on getting a 200. |
| info->headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK"); |
| AddContentSecurityPolicyHeader(request_->url(), info->headers); |
| + if (!allow_caching_) |
| + info->headers->AddHeader("Cache-Control: no-cache"); |
| } |
| void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) { |
| @@ -418,6 +426,7 @@ bool ChromeURLDataManagerBackend::StartRequest(const GURL& url, |
| // as the data blob. For now do it here, since NotifyHeadersComplete() is |
| // going to get called once we return. |
| job->SetMimeType(source->GetMimeType(path)); |
| + job->SetAllowCaching(source->AllowCaching()); |
| const ChromeURLRequestContext* context = |
| static_cast<const ChromeURLRequestContext*>(job->request()->context()); |