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

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

Issue 20182002: Make inttypes.h and similar macro usage C++11-friendly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: line Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 if (send_cors_header) { 69 if (send_cors_header) {
70 raw_headers.append(1, '\0'); 70 raw_headers.append(1, '\0');
71 raw_headers.append("Access-Control-Allow-Origin: *"); 71 raw_headers.append("Access-Control-Allow-Origin: *");
72 } 72 }
73 73
74 if (!last_modified_time.is_null()) { 74 if (!last_modified_time.is_null()) {
75 // Hash the time and make an etag to avoid exposing the exact 75 // Hash the time and make an etag to avoid exposing the exact
76 // user installation time of the extension. 76 // user installation time of the extension.
77 std::string hash = base::StringPrintf("%"PRId64"", 77 std::string hash = base::StringPrintf("%" PRId64,
78 last_modified_time.ToInternalValue()); 78 last_modified_time.ToInternalValue());
79 hash = base::SHA1HashString(hash); 79 hash = base::SHA1HashString(hash);
80 std::string etag; 80 std::string etag;
81 if (base::Base64Encode(hash, &etag)) { 81 if (base::Base64Encode(hash, &etag)) {
82 raw_headers.append(1, '\0'); 82 raw_headers.append(1, '\0');
83 raw_headers.append("ETag: \""); 83 raw_headers.append("ETag: \"");
84 raw_headers.append(etag); 84 raw_headers.append(etag);
85 raw_headers.append("\""); 85 raw_headers.append("\"");
86 // Also force revalidation. 86 // Also force revalidation.
87 raw_headers.append(1, '\0'); 87 raw_headers.append(1, '\0');
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 send_cors_header); 562 send_cors_header);
563 } 563 }
564 564
565 } // namespace 565 } // namespace
566 566
567 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( 567 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler(
568 bool is_incognito, 568 bool is_incognito,
569 ExtensionInfoMap* extension_info_map) { 569 ExtensionInfoMap* extension_info_map) {
570 return new ExtensionProtocolHandler(is_incognito, extension_info_map); 570 return new ExtensionProtocolHandler(is_incognito, extension_info_map);
571 } 571 }
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | chrome/browser/safe_browsing/browser_feature_extractor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698