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 // This file contains helper functions used by Chromium OS login. | 5 // This file contains helper functions used by Chromium OS login. |
6 | 6 |
7 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
8 #define CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 8 #define CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 NetworkStateHelper(); | 57 NetworkStateHelper(); |
58 virtual ~NetworkStateHelper(); | 58 virtual ~NetworkStateHelper(); |
59 | 59 |
60 // Returns name of the currently connected network. | 60 // Returns name of the currently connected network. |
61 // If there are no connected networks, returns name of the network | 61 // If there are no connected networks, returns name of the network |
62 // that is in the "connecting" state. Otherwise empty string is returned. | 62 // that is in the "connecting" state. Otherwise empty string is returned. |
63 // If there are multiple connected networks, network priority: | 63 // If there are multiple connected networks, network priority: |
64 // Ethernet > WiFi > Cellular. Same for connecting network. | 64 // Ethernet > WiFi > Cellular. Same for connecting network. |
65 virtual base::string16 GetCurrentNetworkName() const; | 65 virtual base::string16 GetCurrentNetworkName() const; |
66 | 66 |
67 // Add a network configuration. | 67 // Add and apply a network configuration. Used in shark/remora mode. |
68 virtual void CreateNetworkFromOnc(const std::string& onc_spec) const; | 68 virtual void CreateAndConnectNetworkFromOnc( |
| 69 const std::string& onc_spec, |
| 70 const base::Closure& success_callback, |
| 71 const base::Closure& error_callback) const; |
69 | 72 |
70 // Returns true if the default network is in connected state. | 73 // Returns true if the default network is in connected state. |
71 virtual bool IsConnected() const; | 74 virtual bool IsConnected() const; |
72 | 75 |
73 // Returns true if the default network is in connecting state. | 76 // Returns true if the default network is in connecting state. |
74 virtual bool IsConnecting() const; | 77 virtual bool IsConnecting() const; |
75 | 78 |
76 private: | 79 private: |
77 void OnCreateConfiguration(const std::string& service_path) const; | 80 void OnCreateConfiguration(const base::Closure& success_callback, |
78 void OnCreateConfigurationFailed( | 81 const base::Closure& error_callback, |
| 82 const std::string& service_path) const; |
| 83 void OnCreateOrConnectNetworkFailed( |
| 84 const base::Closure& error_callback, |
79 const std::string& error_name, | 85 const std::string& error_name, |
80 scoped_ptr<base::DictionaryValue> error_data) const; | 86 scoped_ptr<base::DictionaryValue> error_data) const; |
81 | 87 |
82 DISALLOW_COPY_AND_ASSIGN(NetworkStateHelper); | 88 DISALLOW_COPY_AND_ASSIGN(NetworkStateHelper); |
83 }; | 89 }; |
84 | 90 |
85 // | 91 // |
86 // Webview based login helpers. | 92 // Webview based login helpers. |
87 // | 93 // |
88 | 94 |
89 // Returns the storage partition for the sign-in webview. Note the function gets | 95 // Returns the storage partition for the sign-in webview. Note the function gets |
90 // the partition via the sign-in WebContents thus returns nullptr if the sign-in | 96 // the partition via the sign-in WebContents thus returns nullptr if the sign-in |
91 // webui is torn down. | 97 // webui is torn down. |
92 content::StoragePartition* GetSigninPartition(); | 98 content::StoragePartition* GetSigninPartition(); |
93 | 99 |
94 // Returns the request context that contains sign-in cookies. For old iframe | 100 // Returns the request context that contains sign-in cookies. For old iframe |
95 // based flow, the context of the sign-in profile is returned. For webview based | 101 // based flow, the context of the sign-in profile is returned. For webview based |
96 // flow, the context of the sign-in webview storage partition is returned. | 102 // flow, the context of the sign-in webview storage partition is returned. |
97 net::URLRequestContextGetter* GetSigninContext(); | 103 net::URLRequestContextGetter* GetSigninContext(); |
98 | 104 |
99 } // namespace login | 105 } // namespace login |
100 | 106 |
101 } // namespace chromeos | 107 } // namespace chromeos |
102 | 108 |
103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ | 109 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_HELPER_H_ |
OLD | NEW |