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

Side by Side Diff: content/browser/webui/url_data_manager_backend.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
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 "content/browser/webui/url_data_manager_backend.h" 5 #include "content/browser/webui/url_data_manager_backend.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 class URLRequestChromeJob : public net::URLRequestJob, 112 class URLRequestChromeJob : public net::URLRequestJob,
113 public base::SupportsWeakPtr<URLRequestChromeJob> { 113 public base::SupportsWeakPtr<URLRequestChromeJob> {
114 public: 114 public:
115 // |is_incognito| set when job is generated from an incognito profile. 115 // |is_incognito| set when job is generated from an incognito profile.
116 URLRequestChromeJob(net::URLRequest* request, 116 URLRequestChromeJob(net::URLRequest* request,
117 net::NetworkDelegate* network_delegate, 117 net::NetworkDelegate* network_delegate,
118 URLDataManagerBackend* backend, 118 URLDataManagerBackend* backend,
119 bool is_incognito); 119 bool is_incognito);
120 120
121 // net::URLRequestJob implementation. 121 // net::URLRequestJob implementation.
122 virtual void Start() override; 122 void Start() override;
123 virtual void Kill() override; 123 void Kill() override;
124 virtual bool ReadRawData(net::IOBuffer* buf, 124 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
125 int buf_size, 125 bool GetMimeType(std::string* mime_type) const override;
126 int* bytes_read) override; 126 int GetResponseCode() const override;
127 virtual bool GetMimeType(std::string* mime_type) const override; 127 void GetResponseInfo(net::HttpResponseInfo* info) override;
128 virtual int GetResponseCode() const override;
129 virtual void GetResponseInfo(net::HttpResponseInfo* info) override;
130 128
131 // Used to notify that the requested data's |mime_type| is ready. 129 // Used to notify that the requested data's |mime_type| is ready.
132 void MimeTypeAvailable(const std::string& mime_type); 130 void MimeTypeAvailable(const std::string& mime_type);
133 131
134 // Called by ChromeURLDataManager to notify us that the data blob is ready 132 // Called by ChromeURLDataManager to notify us that the data blob is ready
135 // for us. 133 // for us.
136 void DataAvailable(base::RefCountedMemory* bytes); 134 void DataAvailable(base::RefCountedMemory* bytes);
137 135
138 void set_mime_type(const std::string& mime_type) { 136 void set_mime_type(const std::string& mime_type) {
139 mime_type_ = mime_type; 137 mime_type_ = mime_type;
(...skipping 28 matching lines...) Expand all
168 void set_access_control_allow_origin(const std::string& value) { 166 void set_access_control_allow_origin(const std::string& value) {
169 access_control_allow_origin_ = value; 167 access_control_allow_origin_ = value;
170 } 168 }
171 169
172 // Returns true when job was generated from an incognito profile. 170 // Returns true when job was generated from an incognito profile.
173 bool is_incognito() const { 171 bool is_incognito() const {
174 return is_incognito_; 172 return is_incognito_;
175 } 173 }
176 174
177 private: 175 private:
178 virtual ~URLRequestChromeJob(); 176 ~URLRequestChromeJob() override;
179 177
180 // Helper for Start(), to let us start asynchronously. 178 // Helper for Start(), to let us start asynchronously.
181 // (This pattern is shared by most net::URLRequestJob implementations.) 179 // (This pattern is shared by most net::URLRequestJob implementations.)
182 void StartAsync(bool allowed); 180 void StartAsync(bool allowed);
183 181
184 // Called on the UI thread to check if this request is allowed. 182 // Called on the UI thread to check if this request is allowed.
185 static void CheckStoragePartitionMatches( 183 static void CheckStoragePartitionMatches(
186 int render_process_id, 184 int render_process_id,
187 const GURL& url, 185 const GURL& url,
188 const base::WeakPtr<URLRequestChromeJob>& job); 186 const base::WeakPtr<URLRequestChromeJob>& job);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 public: 450 public:
453 // |is_incognito| should be set for incognito profiles. 451 // |is_incognito| should be set for incognito profiles.
454 ChromeProtocolHandler(ResourceContext* resource_context, 452 ChromeProtocolHandler(ResourceContext* resource_context,
455 bool is_incognito, 453 bool is_incognito,
456 AppCacheServiceImpl* appcache_service, 454 AppCacheServiceImpl* appcache_service,
457 ChromeBlobStorageContext* blob_storage_context) 455 ChromeBlobStorageContext* blob_storage_context)
458 : resource_context_(resource_context), 456 : resource_context_(resource_context),
459 is_incognito_(is_incognito), 457 is_incognito_(is_incognito),
460 appcache_service_(appcache_service), 458 appcache_service_(appcache_service),
461 blob_storage_context_(blob_storage_context) {} 459 blob_storage_context_(blob_storage_context) {}
462 virtual ~ChromeProtocolHandler() {} 460 ~ChromeProtocolHandler() override {}
463 461
464 virtual net::URLRequestJob* MaybeCreateJob( 462 net::URLRequestJob* MaybeCreateJob(
465 net::URLRequest* request, 463 net::URLRequest* request,
466 net::NetworkDelegate* network_delegate) const override { 464 net::NetworkDelegate* network_delegate) const override {
467 DCHECK(request); 465 DCHECK(request);
468 466
469 // Check for chrome://view-http-cache/*, which uses its own job type. 467 // Check for chrome://view-http-cache/*, which uses its own job type.
470 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url())) 468 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url()))
471 return ViewHttpCacheJobFactory::CreateJobForRequest(request, 469 return ViewHttpCacheJobFactory::CreateJobForRequest(request,
472 network_delegate); 470 network_delegate);
473 471
474 // Next check for chrome://appcache-internals/, which uses its own job type. 472 // Next check for chrome://appcache-internals/, which uses its own job type.
(...skipping 22 matching lines...) Expand all
497 request->url().host() == kChromeUIHistogramHost) { 495 request->url().host() == kChromeUIHistogramHost) {
498 return new HistogramInternalsRequestJob(request, network_delegate); 496 return new HistogramInternalsRequestJob(request, network_delegate);
499 } 497 }
500 498
501 // Fall back to using a custom handler 499 // Fall back to using a custom handler
502 return new URLRequestChromeJob( 500 return new URLRequestChromeJob(
503 request, network_delegate, 501 request, network_delegate,
504 GetURLDataManagerForResourceContext(resource_context_), is_incognito_); 502 GetURLDataManagerForResourceContext(resource_context_), is_incognito_);
505 } 503 }
506 504
507 virtual bool IsSafeRedirectTarget(const GURL& location) const override { 505 bool IsSafeRedirectTarget(const GURL& location) const override {
508 return false; 506 return false;
509 } 507 }
510 508
511 private: 509 private:
512 // These members are owned by ProfileIOData, which owns this ProtocolHandler. 510 // These members are owned by ProfileIOData, which owns this ProtocolHandler.
513 content::ResourceContext* const resource_context_; 511 content::ResourceContext* const resource_context_;
514 512
515 // True when generated from an incognito profile. 513 // True when generated from an incognito profile.
516 const bool is_incognito_; 514 const bool is_incognito_;
517 AppCacheServiceImpl* appcache_service_; 515 AppCacheServiceImpl* appcache_service_;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 720 }
723 721
724 namespace { 722 namespace {
725 723
726 class DevToolsJobFactory 724 class DevToolsJobFactory
727 : public net::URLRequestJobFactory::ProtocolHandler { 725 : public net::URLRequestJobFactory::ProtocolHandler {
728 public: 726 public:
729 // |is_incognito| should be set for incognito profiles. 727 // |is_incognito| should be set for incognito profiles.
730 DevToolsJobFactory(content::ResourceContext* resource_context, 728 DevToolsJobFactory(content::ResourceContext* resource_context,
731 bool is_incognito); 729 bool is_incognito);
732 virtual ~DevToolsJobFactory(); 730 ~DevToolsJobFactory() override;
733 731
734 virtual net::URLRequestJob* MaybeCreateJob( 732 net::URLRequestJob* MaybeCreateJob(
735 net::URLRequest* request, 733 net::URLRequest* request,
736 net::NetworkDelegate* network_delegate) const override; 734 net::NetworkDelegate* network_delegate) const override;
737 735
738 private: 736 private:
739 // |resource_context_| and |network_delegate_| are owned by ProfileIOData, 737 // |resource_context_| and |network_delegate_| are owned by ProfileIOData,
740 // which owns this ProtocolHandler. 738 // which owns this ProtocolHandler.
741 content::ResourceContext* const resource_context_; 739 content::ResourceContext* const resource_context_;
742 740
743 // True when generated from an incognito profile. 741 // True when generated from an incognito profile.
744 const bool is_incognito_; 742 const bool is_incognito_;
(...skipping 21 matching lines...) Expand all
766 764
767 } // namespace 765 } // namespace
768 766
769 net::URLRequestJobFactory::ProtocolHandler* 767 net::URLRequestJobFactory::ProtocolHandler*
770 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, 768 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context,
771 bool is_incognito) { 769 bool is_incognito) {
772 return new DevToolsJobFactory(resource_context, is_incognito); 770 return new DevToolsJobFactory(resource_context, is_incognito);
773 } 771 }
774 772
775 } // namespace content 773 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/url_data_manager_backend.h ('k') | content/browser/webui/web_ui_controller_factory_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698