OLD | NEW |
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/chromeos/mobile/mobile_activator.h" | 5 #include "chrome/browser/chromeos/mobile/mobile_activator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "chromeos/network/device_state.h" | 29 #include "chromeos/network/device_state.h" |
30 #include "chromeos/network/network_activation_handler.h" | 30 #include "chromeos/network/network_activation_handler.h" |
31 #include "chromeos/network/network_configuration_handler.h" | 31 #include "chromeos/network/network_configuration_handler.h" |
32 #include "chromeos/network/network_connection_handler.h" | 32 #include "chromeos/network/network_connection_handler.h" |
33 #include "chromeos/network/network_event_log.h" | 33 #include "chromeos/network/network_event_log.h" |
34 #include "chromeos/network/network_handler_callbacks.h" | 34 #include "chromeos/network/network_handler_callbacks.h" |
35 #include "chromeos/network/network_state.h" | 35 #include "chromeos/network/network_state.h" |
36 #include "chromeos/network/network_state_handler.h" | 36 #include "chromeos/network/network_state_handler.h" |
| 37 #include "components/ssl_config/ssl_config_prefs.h" |
37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
38 #include "third_party/cros_system_api/dbus/service_constants.h" | 39 #include "third_party/cros_system_api/dbus/service_constants.h" |
39 #include "ui/chromeos/network/network_connect.h" | 40 #include "ui/chromeos/network/network_connect.h" |
40 | 41 |
41 using content::BrowserThread; | 42 using content::BrowserThread; |
42 | 43 |
43 namespace { | 44 namespace { |
44 | 45 |
45 // Cellular configuration file path. | 46 // Cellular configuration file path. |
46 const char kCellularConfigPath[] = | 47 const char kCellularConfigPath[] = |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 void MobileActivator::ReEnableCertRevocationChecking() { | 1090 void MobileActivator::ReEnableCertRevocationChecking() { |
1090 // Check that both the browser process and prefs exist before trying to | 1091 // Check that both the browser process and prefs exist before trying to |
1091 // use them, since this method can be called by the destructor while Chrome | 1092 // use them, since this method can be called by the destructor while Chrome |
1092 // is shutting down, during which either could be NULL. | 1093 // is shutting down, during which either could be NULL. |
1093 if (!g_browser_process) | 1094 if (!g_browser_process) |
1094 return; | 1095 return; |
1095 PrefService* prefs = g_browser_process->local_state(); | 1096 PrefService* prefs = g_browser_process->local_state(); |
1096 if (!prefs) | 1097 if (!prefs) |
1097 return; | 1098 return; |
1098 if (reenable_cert_check_) { | 1099 if (reenable_cert_check_) { |
1099 prefs->SetBoolean(prefs::kCertRevocationCheckingEnabled, | 1100 prefs->SetBoolean(ssl_config::prefs::kCertRevocationCheckingEnabled, true); |
1100 true); | |
1101 reenable_cert_check_ = false; | 1101 reenable_cert_check_ = false; |
1102 } | 1102 } |
1103 } | 1103 } |
1104 | 1104 |
1105 void MobileActivator::DisableCertRevocationChecking() { | 1105 void MobileActivator::DisableCertRevocationChecking() { |
1106 // Disable SSL cert checks since we might be performing activation in the | 1106 // Disable SSL cert checks since we might be performing activation in the |
1107 // restricted pool. | 1107 // restricted pool. |
1108 // TODO(rkc): We want to do this only if on Cellular. | 1108 // TODO(rkc): We want to do this only if on Cellular. |
1109 PrefService* prefs = g_browser_process->local_state(); | 1109 PrefService* prefs = g_browser_process->local_state(); |
1110 if (!reenable_cert_check_ && | 1110 if (!reenable_cert_check_ && |
1111 prefs->GetBoolean( | 1111 prefs->GetBoolean(ssl_config::prefs::kCertRevocationCheckingEnabled)) { |
1112 prefs::kCertRevocationCheckingEnabled)) { | |
1113 reenable_cert_check_ = true; | 1112 reenable_cert_check_ = true; |
1114 prefs->SetBoolean(prefs::kCertRevocationCheckingEnabled, false); | 1113 prefs->SetBoolean(ssl_config::prefs::kCertRevocationCheckingEnabled, false); |
1115 } | 1114 } |
1116 } | 1115 } |
1117 | 1116 |
1118 bool MobileActivator::GotActivationError( | 1117 bool MobileActivator::GotActivationError( |
1119 const NetworkState* network, std::string* error) const { | 1118 const NetworkState* network, std::string* error) const { |
1120 DCHECK(network); | 1119 DCHECK(network); |
1121 bool got_error = false; | 1120 bool got_error = false; |
1122 const char* error_code = kErrorDefault; | 1121 const char* error_code = kErrorDefault; |
1123 const std::string& activation = network->activation_state(); | 1122 const std::string& activation = network->activation_state(); |
1124 | 1123 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 cellular_plan_payment_time_ = base::Time::Now(); | 1162 cellular_plan_payment_time_ = base::Time::Now(); |
1164 } | 1163 } |
1165 | 1164 |
1166 bool MobileActivator::HasRecentCellularPlanPayment() const { | 1165 bool MobileActivator::HasRecentCellularPlanPayment() const { |
1167 const int kRecentPlanPaymentHours = 6; | 1166 const int kRecentPlanPaymentHours = 6; |
1168 return (base::Time::Now() - | 1167 return (base::Time::Now() - |
1169 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; | 1168 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; |
1170 } | 1169 } |
1171 | 1170 |
1172 } // namespace chromeos | 1171 } // namespace chromeos |
OLD | NEW |