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

Side by Side Diff: chrome/browser/extensions/chrome_url_request_util.cc

Issue 666153002: Standardize usage of virtual/override/final in chrome/browser/extensions/ (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/extensions/chrome_url_request_util.h" 5 #include "chrome/browser/extensions/chrome_url_request_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 : net::URLRequestSimpleJob(request, network_delegate), 52 : net::URLRequestSimpleJob(request, network_delegate),
53 filename_(filename), 53 filename_(filename),
54 resource_id_(resource_id), 54 resource_id_(resource_id),
55 weak_factory_(this) { 55 weak_factory_(this) {
56 // Leave cache headers out of resource bundle requests. 56 // Leave cache headers out of resource bundle requests.
57 response_info_.headers = extensions::BuildHttpHeaders( 57 response_info_.headers = extensions::BuildHttpHeaders(
58 content_security_policy, send_cors_header, base::Time()); 58 content_security_policy, send_cors_header, base::Time());
59 } 59 }
60 60
61 // Overridden from URLRequestSimpleJob: 61 // Overridden from URLRequestSimpleJob:
62 virtual int GetData(std::string* mime_type, 62 int GetData(std::string* mime_type,
63 std::string* charset, 63 std::string* charset,
64 std::string* data, 64 std::string* data,
65 const net::CompletionCallback& callback) const override { 65 const net::CompletionCallback& callback) const override {
66 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed. 66 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed.
67 tracked_objects::ScopedProfile tracking_profile( 67 tracked_objects::ScopedProfile tracking_profile(
68 FROM_HERE_WITH_EXPLICIT_FUNCTION( 68 FROM_HERE_WITH_EXPLICIT_FUNCTION(
69 "422489 URLRequestResourceBundleJob::GetData")); 69 "422489 URLRequestResourceBundleJob::GetData"));
70 70
71 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 71 const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
72 *data = rb.GetRawDataResource(resource_id_).as_string(); 72 *data = rb.GetRawDataResource(resource_id_).as_string();
73 73
74 // Add the Content-Length header now that we know the resource length. 74 // Add the Content-Length header now that we know the resource length.
75 response_info_.headers->AddHeader( 75 response_info_.headers->AddHeader(
(...skipping 13 matching lines...) Expand all
89 mime_type, 89 mime_type,
90 charset, 90 charset,
91 data, 91 data,
92 base::Owned(read_mime_type), 92 base::Owned(read_mime_type),
93 callback)); 93 callback));
94 DCHECK(posted); 94 DCHECK(posted);
95 95
96 return net::ERR_IO_PENDING; 96 return net::ERR_IO_PENDING;
97 } 97 }
98 98
99 virtual void GetResponseInfo(net::HttpResponseInfo* info) override { 99 void GetResponseInfo(net::HttpResponseInfo* info) override {
100 *info = response_info_; 100 *info = response_info_;
101 } 101 }
102 102
103 private: 103 private:
104 virtual ~URLRequestResourceBundleJob() {} 104 ~URLRequestResourceBundleJob() override {}
105 105
106 void OnMimeTypeRead(std::string* out_mime_type, 106 void OnMimeTypeRead(std::string* out_mime_type,
107 std::string* charset, 107 std::string* charset,
108 std::string* data, 108 std::string* data,
109 std::string* read_mime_type, 109 std::string* read_mime_type,
110 const net::CompletionCallback& callback, 110 const net::CompletionCallback& callback,
111 bool read_result) { 111 bool read_result) {
112 *out_mime_type = *read_mime_type; 112 *out_mime_type = *read_mime_type;
113 if (StartsWithASCII(*read_mime_type, "text/", false)) { 113 if (StartsWithASCII(*read_mime_type, "text/", false)) {
114 // All of our HTML files should be UTF-8 and for other resource types 114 // All of our HTML files should be UTF-8 and for other resource types
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 resource_id, 189 resource_id,
190 content_security_policy, 190 content_security_policy,
191 send_cors_header); 191 send_cors_header);
192 } 192 }
193 } 193 }
194 return NULL; 194 return NULL;
195 } 195 }
196 196
197 } // namespace chrome_url_request_util 197 } // namespace chrome_url_request_util
198 } // namespace extensions 198 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_process_manager_delegate.h ('k') | chrome/browser/extensions/component_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698