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

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

Issue 690943003: Move network_connect code to ui/chromeos/network (Take 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
11 #include "ash/system/chromeos/network/network_connect.h"
12 #include "base/bind.h" 11 #include "base/bind.h"
13 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
14 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
15 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
16 #include "base/location.h" 15 #include "base/location.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/memory/ref_counted_memory.h" 17 #include "base/memory/ref_counted_memory.h"
19 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
20 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
21 #include "base/observer_list_threadsafe.h" 20 #include "base/observer_list_threadsafe.h"
22 #include "base/prefs/pref_service.h" 21 #include "base/prefs/pref_service.h"
23 #include "base/strings/string_piece.h" 22 #include "base/strings/string_piece.h"
24 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
25 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
26 #include "base/timer/timer.h" 25 #include "base/timer/timer.h"
27 #include "base/values.h" 26 #include "base/values.h"
28 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
29 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
30 #include "chromeos/network/device_state.h" 29 #include "chromeos/network/device_state.h"
31 #include "chromeos/network/network_activation_handler.h" 30 #include "chromeos/network/network_activation_handler.h"
32 #include "chromeos/network/network_configuration_handler.h" 31 #include "chromeos/network/network_configuration_handler.h"
33 #include "chromeos/network/network_connection_handler.h" 32 #include "chromeos/network/network_connection_handler.h"
34 #include "chromeos/network/network_event_log.h" 33 #include "chromeos/network/network_event_log.h"
35 #include "chromeos/network/network_handler_callbacks.h" 34 #include "chromeos/network/network_handler_callbacks.h"
36 #include "chromeos/network/network_state.h" 35 #include "chromeos/network/network_state.h"
37 #include "chromeos/network/network_state_handler.h" 36 #include "chromeos/network/network_state_handler.h"
38 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
39 #include "third_party/cros_system_api/dbus/service_constants.h" 38 #include "third_party/cros_system_api/dbus/service_constants.h"
39 #include "ui/chromeos/network/network_connect.h"
40 40
41 using content::BrowserThread; 41 using content::BrowserThread;
42 42
43 namespace { 43 namespace {
44 44
45 // Cellular configuration file path. 45 // Cellular configuration file path.
46 const char kCellularConfigPath[] = 46 const char kCellularConfigPath[] =
47 "/usr/share/chromeos-assets/mobile/mobile_config.json"; 47 "/usr/share/chromeos-assets/mobile/mobile_config.json";
48 48
49 // Cellular config file field names. 49 // Cellular config file field names.
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 network_handler::ErrorCallback()); 617 network_handler::ErrorCallback());
618 return; 618 return;
619 } 619 }
620 // Stop this callback 620 // Stop this callback
621 continue_reconnect_timer_.Stop(); 621 continue_reconnect_timer_.Stop();
622 EvaluateCellularNetwork(network); 622 EvaluateCellularNetwork(network);
623 } else { 623 } else {
624 LOG(WARNING) << "Connect failed, will try again in a little bit."; 624 LOG(WARNING) << "Connect failed, will try again in a little bit.";
625 if (network) { 625 if (network) {
626 VLOG(1) << "Connecting to: " << network->path(); 626 VLOG(1) << "Connecting to: " << network->path();
627 ash::NetworkConnect::Get()->ConnectToNetwork(network->path()); 627 ui::NetworkConnect::Get()->ConnectToNetwork(network->path());
628 } 628 }
629 } 629 }
630 } 630 }
631 631
632 void MobileActivator::RefreshCellularNetworks() { 632 void MobileActivator::RefreshCellularNetworks() {
633 if (state_ == PLAN_ACTIVATION_PAGE_LOADING || 633 if (state_ == PLAN_ACTIVATION_PAGE_LOADING ||
634 state_ == PLAN_ACTIVATION_DONE || 634 state_ == PLAN_ACTIVATION_DONE ||
635 state_ == PLAN_ACTIVATION_ERROR) { 635 state_ == PLAN_ACTIVATION_ERROR) {
636 return; 636 return;
637 } 637 }
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 cellular_plan_payment_time_ = base::Time::Now(); 1163 cellular_plan_payment_time_ = base::Time::Now();
1164 } 1164 }
1165 1165
1166 bool MobileActivator::HasRecentCellularPlanPayment() const { 1166 bool MobileActivator::HasRecentCellularPlanPayment() const {
1167 const int kRecentPlanPaymentHours = 6; 1167 const int kRecentPlanPaymentHours = 6;
1168 return (base::Time::Now() - 1168 return (base::Time::Now() -
1169 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; 1169 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours;
1170 } 1170 }
1171 1171
1172 } // namespace chromeos 1172 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/options/vpn_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698