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

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

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. Created 7 years 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 "chrome/browser/extensions/extension_protocols.h" 5 #include "chrome/browser/extensions/extension_protocols.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 raw_headers.append("Access-Control-Allow-Origin: *"); 79 raw_headers.append("Access-Control-Allow-Origin: *");
80 } 80 }
81 81
82 if (!last_modified_time.is_null()) { 82 if (!last_modified_time.is_null()) {
83 // Hash the time and make an etag to avoid exposing the exact 83 // Hash the time and make an etag to avoid exposing the exact
84 // user installation time of the extension. 84 // user installation time of the extension.
85 std::string hash = base::StringPrintf("%" PRId64, 85 std::string hash = base::StringPrintf("%" PRId64,
86 last_modified_time.ToInternalValue()); 86 last_modified_time.ToInternalValue());
87 hash = base::SHA1HashString(hash); 87 hash = base::SHA1HashString(hash);
88 std::string etag; 88 std::string etag;
89 if (base::Base64Encode(hash, &etag)) { 89 base::Base64Encode(hash, &etag);
90 raw_headers.append(1, '\0'); 90 raw_headers.append(1, '\0');
91 raw_headers.append("ETag: \""); 91 raw_headers.append("ETag: \"");
92 raw_headers.append(etag); 92 raw_headers.append(etag);
93 raw_headers.append("\""); 93 raw_headers.append("\"");
94 // Also force revalidation. 94 // Also force revalidation.
95 raw_headers.append(1, '\0'); 95 raw_headers.append(1, '\0');
96 raw_headers.append("cache-control: no-cache"); 96 raw_headers.append("cache-control: no-cache");
97 }
98 } 97 }
99 98
100 raw_headers.append(2, '\0'); 99 raw_headers.append(2, '\0');
101 return new net::HttpResponseHeaders(raw_headers); 100 return new net::HttpResponseHeaders(raw_headers);
102 } 101 }
103 102
104 class URLRequestResourceBundleJob : public net::URLRequestSimpleJob { 103 class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
105 public: 104 public:
106 URLRequestResourceBundleJob(net::URLRequest* request, 105 URLRequestResourceBundleJob(net::URLRequest* request,
107 net::NetworkDelegate* network_delegate, 106 net::NetworkDelegate* network_delegate,
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 send_cors_header); 620 send_cors_header);
622 } 621 }
623 622
624 } // namespace 623 } // namespace
625 624
626 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( 625 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler(
627 bool is_incognito, 626 bool is_incognito,
628 extensions::InfoMap* extension_info_map) { 627 extensions::InfoMap* extension_info_map) {
629 return new ExtensionProtocolHandler(is_incognito, extension_info_map); 628 return new ExtensionProtocolHandler(is_incognito, extension_info_map);
630 } 629 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api_helpers.cc ('k') | chrome/browser/extensions/install_signer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698