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

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

Issue 2434683003: Move NetworkStateNotifier and NetworkConnect from src/ui (Closed)
Patch Set: Fix virtuals 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 (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 10 matching lines...) Expand all
21 #include "base/strings/string_piece.h" 21 #include "base/strings/string_piece.h"
22 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
23 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
24 #include "base/timer/timer.h" 24 #include "base/timer/timer.h"
25 #include "base/values.h" 25 #include "base/values.h"
26 #include "chrome/browser/browser_process.h" 26 #include "chrome/browser/browser_process.h"
27 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
28 #include "chromeos/network/device_state.h" 28 #include "chromeos/network/device_state.h"
29 #include "chromeos/network/network_activation_handler.h" 29 #include "chromeos/network/network_activation_handler.h"
30 #include "chromeos/network/network_configuration_handler.h" 30 #include "chromeos/network/network_configuration_handler.h"
31 #include "chromeos/network/network_connect.h"
31 #include "chromeos/network/network_connection_handler.h" 32 #include "chromeos/network/network_connection_handler.h"
32 #include "chromeos/network/network_event_log.h" 33 #include "chromeos/network/network_event_log.h"
33 #include "chromeos/network/network_handler_callbacks.h" 34 #include "chromeos/network/network_handler_callbacks.h"
34 #include "chromeos/network/network_state.h" 35 #include "chromeos/network/network_state.h"
35 #include "chromeos/network/network_state_handler.h" 36 #include "chromeos/network/network_state_handler.h"
36 #include "components/prefs/pref_service.h" 37 #include "components/prefs/pref_service.h"
37 #include "components/ssl_config/ssl_config_prefs.h" 38 #include "components/ssl_config/ssl_config_prefs.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 #include "ui/chromeos/network/network_connect.h"
41 41
42 using content::BrowserThread; 42 using content::BrowserThread;
43 43
44 namespace { 44 namespace {
45 45
46 // Cellular configuration file path. 46 // Cellular configuration file path.
47 const char kCellularConfigPath[] = 47 const char kCellularConfigPath[] =
48 "/usr/share/chromeos-assets/mobile/mobile_config.json"; 48 "/usr/share/chromeos-assets/mobile/mobile_config.json";
49 49
50 // Cellular config file field names. 50 // Cellular config file field names.
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 network_handler::ErrorCallback()); 618 network_handler::ErrorCallback());
619 return; 619 return;
620 } 620 }
621 // Stop this callback 621 // Stop this callback
622 continue_reconnect_timer_.Stop(); 622 continue_reconnect_timer_.Stop();
623 EvaluateCellularNetwork(network); 623 EvaluateCellularNetwork(network);
624 } else { 624 } else {
625 LOG(WARNING) << "Connect failed, will try again in a little bit."; 625 LOG(WARNING) << "Connect failed, will try again in a little bit.";
626 if (network) { 626 if (network) {
627 VLOG(1) << "Connecting to: " << network->path(); 627 VLOG(1) << "Connecting to: " << network->path();
628 ui::NetworkConnect::Get()->ConnectToNetwork(network->path()); 628 NetworkConnect::Get()->ConnectToNetwork(network->path());
629 } 629 }
630 } 630 }
631 } 631 }
632 632
633 void MobileActivator::RefreshCellularNetworks() { 633 void MobileActivator::RefreshCellularNetworks() {
634 if (state_ == PLAN_ACTIVATION_PAGE_LOADING || 634 if (state_ == PLAN_ACTIVATION_PAGE_LOADING ||
635 state_ == PLAN_ACTIVATION_DONE || 635 state_ == PLAN_ACTIVATION_DONE ||
636 state_ == PLAN_ACTIVATION_ERROR) { 636 state_ == PLAN_ACTIVATION_ERROR) {
637 return; 637 return;
638 } 638 }
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 cellular_plan_payment_time_ = base::Time::Now(); 1162 cellular_plan_payment_time_ = base::Time::Now();
1163 } 1163 }
1164 1164
1165 bool MobileActivator::HasRecentCellularPlanPayment() const { 1165 bool MobileActivator::HasRecentCellularPlanPayment() const {
1166 const int kRecentPlanPaymentHours = 6; 1166 const int kRecentPlanPaymentHours = 6;
1167 return (base::Time::Now() - 1167 return (base::Time::Now() -
1168 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; 1168 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours;
1169 } 1169 }
1170 1170
1171 } // namespace chromeos 1171 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698