| 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 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_NETWORK_CONTROLLER_CHROMEOS_H_ | 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_NETWORK_CONTROLLER_CHROMEOS_H_ |
| 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_NETWORK_CONTROLLER_CHROMEOS_H_ | 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_NETWORK_CONTROLLER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chromeos/network/network_state_handler_observer.h" | 16 #include "chromeos/network/network_state_handler_observer.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 // Handles network-related tasks for app_shell on Chrome OS. | 20 // Handles network-related tasks for app_shell on Chrome OS. |
| 21 class ShellNetworkController : public chromeos::NetworkStateHandlerObserver { | 21 class ShellNetworkController : public chromeos::NetworkStateHandlerObserver { |
| 22 public: | 22 public: |
| 23 // This class must be instantiated after chromeos::DBusThreadManager and | 23 // This class must be instantiated after chromeos::DBusThreadManager and |
| 24 // destroyed before it. | 24 // destroyed before it. |
| 25 explicit ShellNetworkController(const std::string& preferred_network_name); | 25 explicit ShellNetworkController(const std::string& preferred_network_name); |
| 26 virtual ~ShellNetworkController(); | 26 ~ShellNetworkController() override; |
| 27 | 27 |
| 28 // chromeos::NetworkStateHandlerObserver overrides: | 28 // chromeos::NetworkStateHandlerObserver overrides: |
| 29 virtual void NetworkListChanged() override; | 29 void NetworkListChanged() override; |
| 30 virtual void NetworkConnectionStateChanged( | 30 void NetworkConnectionStateChanged( |
| 31 const chromeos::NetworkState* state) override; | 31 const chromeos::NetworkState* state) override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // State of communication with the connection manager. | 34 // State of communication with the connection manager. |
| 35 enum State { | 35 enum State { |
| 36 // No in-progress requests. | 36 // No in-progress requests. |
| 37 STATE_IDLE = 0, | 37 STATE_IDLE = 0, |
| 38 // Waiting for the result of an attempt to connect to the preferred network. | 38 // Waiting for the result of an attempt to connect to the preferred network. |
| 39 STATE_WAITING_FOR_PREFERRED_RESULT, | 39 STATE_WAITING_FOR_PREFERRED_RESULT, |
| 40 // Waiting for the result of an attempt to connect to a non-preferred | 40 // Waiting for the result of an attempt to connect to a non-preferred |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 bool preferred_network_is_active_; | 77 bool preferred_network_is_active_; |
| 78 | 78 |
| 79 base::WeakPtrFactory<ShellNetworkController> weak_ptr_factory_; | 79 base::WeakPtrFactory<ShellNetworkController> weak_ptr_factory_; |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(ShellNetworkController); | 81 DISALLOW_COPY_AND_ASSIGN(ShellNetworkController); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace extensions | 84 } // namespace extensions |
| 85 | 85 |
| 86 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_NETWORK_CONTROLLER_CHROMEOS_H_ | 86 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_NETWORK_CONTROLLER_CHROMEOS_H_ |
| OLD | NEW |