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

Side by Side Diff: components/network_time/network_time_tracker.cc

Issue 2448943004: Add experimental feature info to certificate reports (Closed)
Patch Set: undo more unnecessary changes Created 4 years, 1 month 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 "components/network_time/network_time_tracker.h" 5 #include "components/network_time/network_time_tracker.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 17 matching lines...) Expand all
28 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
29 #include "net/http/http_response_headers.h" 29 #include "net/http/http_response_headers.h"
30 #include "net/url_request/url_fetcher.h" 30 #include "net/url_request/url_fetcher.h"
31 #include "net/url_request/url_fetcher_response_writer.h" 31 #include "net/url_request/url_fetcher_response_writer.h"
32 #include "net/url_request/url_request_context_getter.h" 32 #include "net/url_request/url_request_context_getter.h"
33 33
34 namespace network_time { 34 namespace network_time {
35 35
36 const base::Feature kNetworkTimeServiceQuerying{ 36 const base::Feature kNetworkTimeServiceQuerying{
37 "NetworkTimeServiceQuerying", base::FEATURE_DISABLED_BY_DEFAULT}; 37 "NetworkTimeServiceQuerying", base::FEATURE_DISABLED_BY_DEFAULT};
38 // This parameter must have the value "true" in order for
39 // StartTimeFetch() to start time queries on demand.
40 const char kVariationsServiceEnableFetchesOnDemand[] = "EnableFetchesOnDemand";
38 41
39 namespace { 42 namespace {
40 43
41 // Time updates happen in two ways. First, other components may call 44 // Time updates happen in two ways. First, other components may call
42 // UpdateNetworkTime() if they happen to obtain the time securely. This will 45 // UpdateNetworkTime() if they happen to obtain the time securely. This will
43 // likely be deprecated in favor of the second way, which is scheduled time 46 // likely be deprecated in favor of the second way, which is scheduled time
44 // queries issued by NetworkTimeTracker itself. 47 // queries issued by NetworkTimeTracker itself.
45 // 48 //
46 // On startup, the clock state may be read from a pref. (This, too, may be 49 // On startup, the clock state may be read from a pref. (This, too, may be
47 // deprecated.) After that, the time is checked every 50 // deprecated.) After that, the time is checked every
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // be that badly wrong, but all the same it's included here to document the very 96 // be that badly wrong, but all the same it's included here to document the very
94 // rough nature of the time service provided by this class.) 97 // rough nature of the time service provided by this class.)
95 const uint32_t kTimeServerMaxSkewSeconds = 10; 98 const uint32_t kTimeServerMaxSkewSeconds = 10;
96 99
97 const char kTimeServiceURL[] = "http://clients2.google.com/time/1/current"; 100 const char kTimeServiceURL[] = "http://clients2.google.com/time/1/current";
98 101
99 const char kVariationsServiceCheckTimeIntervalSeconds[] = 102 const char kVariationsServiceCheckTimeIntervalSeconds[] =
100 "CheckTimeIntervalSeconds"; 103 "CheckTimeIntervalSeconds";
101 const char kVariationsServiceRandomQueryProbability[] = 104 const char kVariationsServiceRandomQueryProbability[] =
102 "RandomQueryProbability"; 105 "RandomQueryProbability";
103 // This parameter must have the value "true" in order for
104 // StartTimeFetch() to start time queries on demand.
105 const char kVariationsServiceEnableFetchesOnDemand[] = "EnableFetchesOnDemand";
106 106
107 // This is an ECDSA prime256v1 named-curve key. 107 // This is an ECDSA prime256v1 named-curve key.
108 const int kKeyVersion = 1; 108 const int kKeyVersion = 1;
109 const uint8_t kKeyPubBytes[] = { 109 const uint8_t kKeyPubBytes[] = {
110 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 110 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
111 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 111 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
112 0x42, 0x00, 0x04, 0xeb, 0xd8, 0xad, 0x0b, 0x8f, 0x75, 0xe8, 0x84, 0x36, 112 0x42, 0x00, 0x04, 0xeb, 0xd8, 0xad, 0x0b, 0x8f, 0x75, 0xe8, 0x84, 0x36,
113 0x23, 0x48, 0x14, 0x24, 0xd3, 0x93, 0x42, 0x25, 0x43, 0xc1, 0xde, 0x36, 113 0x23, 0x48, 0x14, 0x24, 0xd3, 0x93, 0x42, 0x25, 0x43, 0xc1, 0xde, 0x36,
114 0x29, 0xc6, 0x95, 0xca, 0xeb, 0x28, 0x85, 0xff, 0x09, 0xdc, 0x08, 0xec, 114 0x29, 0xc6, 0x95, 0xca, 0xeb, 0x28, 0x85, 0xff, 0x09, 0xdc, 0x08, 0xec,
115 0x45, 0x74, 0x6e, 0x4b, 0xc3, 0xa5, 0xfd, 0x8a, 0x2f, 0x02, 0xa0, 0x4b, 115 0x45, 0x74, 0x6e, 0x4b, 0xc3, 0xa5, 0xfd, 0x8a, 0x2f, 0x02, 0xa0, 0x4b,
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 base::Time network_time; 550 base::Time network_time;
551 if (GetNetworkTime(&network_time, nullptr) != NETWORK_TIME_AVAILABLE) { 551 if (GetNetworkTime(&network_time, nullptr) != NETWORK_TIME_AVAILABLE) {
552 return true; 552 return true;
553 } 553 }
554 554
555 // Otherwise, make the decision at random. 555 // Otherwise, make the decision at random.
556 return base::RandDouble() < RandomQueryProbability(); 556 return base::RandDouble() < RandomQueryProbability();
557 } 557 }
558 558
559 } // namespace network_time 559 } // namespace network_time
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698