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

Side by Side Diff: chrome/browser/chromeos/mobile/mobile_activator.cc

Issue 23712002: Cleanup network type matching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Generalized network type matching. Created 7 years, 3 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/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 17 matching lines...) Expand all
28 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
29 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
30 #include "chromeos/network/device_state.h" 30 #include "chromeos/network/device_state.h"
31 #include "chromeos/network/network_activation_handler.h" 31 #include "chromeos/network/network_activation_handler.h"
32 #include "chromeos/network/network_configuration_handler.h" 32 #include "chromeos/network/network_configuration_handler.h"
33 #include "chromeos/network/network_connection_handler.h" 33 #include "chromeos/network/network_connection_handler.h"
34 #include "chromeos/network/network_event_log.h" 34 #include "chromeos/network/network_event_log.h"
35 #include "chromeos/network/network_handler_callbacks.h" 35 #include "chromeos/network/network_handler_callbacks.h"
36 #include "chromeos/network/network_state.h" 36 #include "chromeos/network/network_state.h"
37 #include "chromeos/network/network_state_handler.h" 37 #include "chromeos/network/network_state_handler.h"
38 #include "chromeos/network/shill_property_util.h"
38 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
39 #include "third_party/cros_system_api/dbus/service_constants.h" 40 #include "third_party/cros_system_api/dbus/service_constants.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[] =
47 "/usr/share/chromeos-assets/mobile/mobile_config.json"; 48 "/usr/share/chromeos-assets/mobile/mobile_config.json";
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 this, &MobileActivator::HandleOTASPTimeout); 364 this, &MobileActivator::HandleOTASPTimeout);
364 } 365 }
365 366
366 void MobileActivator::StartActivation() { 367 void MobileActivator::StartActivation() {
367 UMA_HISTOGRAM_COUNTS("Cellular.MobileSetupStart", 1); 368 UMA_HISTOGRAM_COUNTS("Cellular.MobileSetupStart", 1);
368 const NetworkState* network = GetNetworkState(service_path_); 369 const NetworkState* network = GetNetworkState(service_path_);
369 // Check if we can start activation process. 370 // Check if we can start activation process.
370 if (!network) { 371 if (!network) {
371 NetworkStateHandler::TechnologyState technology_state = 372 NetworkStateHandler::TechnologyState technology_state =
372 NetworkHandler::Get()->network_state_handler()->GetTechnologyState( 373 NetworkHandler::Get()->network_state_handler()->GetTechnologyState(
373 flimflam::kTypeCellular); 374 NetworkTypePattern::Cellular());
374 std::string error; 375 std::string error;
375 if (technology_state == NetworkStateHandler::TECHNOLOGY_UNAVAILABLE) { 376 if (technology_state == NetworkStateHandler::TECHNOLOGY_UNAVAILABLE) {
376 error = kErrorNoDevice; 377 error = kErrorNoDevice;
377 } else if (technology_state != NetworkStateHandler::TECHNOLOGY_ENABLED) { 378 } else if (technology_state != NetworkStateHandler::TECHNOLOGY_ENABLED) {
378 error = kErrorDisabled; 379 error = kErrorDisabled;
379 } else { 380 } else {
380 error = kErrorNoService; 381 error = kErrorNoService;
381 } 382 }
382 ChangeState(NULL, PLAN_ACTIVATION_ERROR, GetErrorMessage(error)); 383 ChangeState(NULL, PLAN_ACTIVATION_ERROR, GetErrorMessage(error));
383 return; 384 return;
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 cellular_plan_payment_time_ = base::Time::Now(); 1020 cellular_plan_payment_time_ = base::Time::Now();
1020 } 1021 }
1021 1022
1022 bool MobileActivator::HasRecentCellularPlanPayment() const { 1023 bool MobileActivator::HasRecentCellularPlanPayment() const {
1023 const int kRecentPlanPaymentHours = 6; 1024 const int kRecentPlanPaymentHours = 6;
1024 return (base::Time::Now() - 1025 return (base::Time::Now() -
1025 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; 1026 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours;
1026 } 1027 }
1027 1028
1028 } // namespace chromeos 1029 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698