| OLD | NEW |
| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 "A request can be sent to retrieve the current time when the user " | 473 "A request can be sent to retrieve the current time when the user " |
| 474 "encounters an SSL date error, or in the background if Chromium " | 474 "encounters an SSL date error, or in the background if Chromium " |
| 475 "determines that it doesn't have an accurate timestamp." | 475 "determines that it doesn't have an accurate timestamp." |
| 476 data: "None" | 476 data: "None" |
| 477 destination: GOOGLE_OWNED_SERVICE | 477 destination: GOOGLE_OWNED_SERVICE |
| 478 } | 478 } |
| 479 policy { | 479 policy { |
| 480 cookies_allowed: false | 480 cookies_allowed: false |
| 481 setting: "This feature cannot be disabled by settings." | 481 setting: "This feature cannot be disabled by settings." |
| 482 chrome_policy { | 482 chrome_policy { |
| 483 NetworkTimeQueriesEnabled { | 483 BrowserNetworkTimeQueriesEnabled { |
| 484 NetworkTimeQueriesEnabled: false | 484 BrowserNetworkTimeQueriesEnabled: false |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 })"); | 487 })"); |
| 488 // This cancels any outstanding fetch. | 488 // This cancels any outstanding fetch. |
| 489 time_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this, | 489 time_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this, |
| 490 traffic_annotation); | 490 traffic_annotation); |
| 491 if (!time_fetcher_) { | 491 if (!time_fetcher_) { |
| 492 DVLOG(1) << "tried to make fetch happen; failed"; | 492 DVLOG(1) << "tried to make fetch happen; failed"; |
| 493 return; | 493 return; |
| 494 } | 494 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 base::Time network_time; | 636 base::Time network_time; |
| 637 if (GetNetworkTime(&network_time, nullptr) != NETWORK_TIME_AVAILABLE) { | 637 if (GetNetworkTime(&network_time, nullptr) != NETWORK_TIME_AVAILABLE) { |
| 638 return true; | 638 return true; |
| 639 } | 639 } |
| 640 | 640 |
| 641 // Otherwise, make the decision at random. | 641 // Otherwise, make the decision at random. |
| 642 return base::RandDouble() < RandomQueryProbability(); | 642 return base::RandDouble() < RandomQueryProbability(); |
| 643 } | 643 } |
| 644 | 644 |
| 645 } // namespace network_time | 645 } // namespace network_time |
| OLD | NEW |