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

Side by Side Diff: extensions/browser/api/networking_private/networking_private_delegate.h

Issue 1059033002: Implement networkingPrivate.getDeviceStates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 8 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
OLDNEW
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_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_ 5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_ 6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 13 matching lines...) Expand all
24 namespace networking_private { 24 namespace networking_private {
25 struct VerificationProperties; 25 struct VerificationProperties;
26 } // networking_private 26 } // networking_private
27 } // core_api 27 } // core_api
28 28
29 // Base class for platform dependent networkingPrivate API implementations. 29 // Base class for platform dependent networkingPrivate API implementations.
30 // All inputs and results for this class use ONC values. See 30 // All inputs and results for this class use ONC values. See
31 // networking_private.idl for descriptions of the expected inputs and results. 31 // networking_private.idl for descriptions of the expected inputs and results.
32 class NetworkingPrivateDelegate : public KeyedService { 32 class NetworkingPrivateDelegate : public KeyedService {
33 public: 33 public:
34 typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> 34 using DictionaryCallback =
35 DictionaryCallback; 35 base::Callback<void(scoped_ptr<base::DictionaryValue>)>;
36 typedef base::Callback<void()> VoidCallback; 36 using VoidCallback = base::Callback<void()>;
37 typedef base::Callback<void(bool)> BoolCallback; 37 using BoolCallback = base::Callback<void(bool)>;
38 typedef base::Callback<void(const std::string&)> StringCallback; 38 using StringCallback = base::Callback<void(const std::string&)>;
39 typedef base::Callback<void(scoped_ptr<base::ListValue>)> NetworkListCallback; 39 using NetworkListCallback = base::Callback<void(scoped_ptr<base::ListValue>)>;
40 typedef base::Callback<void(const std::string&)> FailureCallback; 40 using FailureCallback = base::Callback<void(const std::string&)>;
41 typedef core_api::networking_private::VerificationProperties 41 using DeviceStateMap = std::map<std::string, std::string>;
pneubeck (no reviews) 2015/04/08 10:05:07 please document what the keys and values are.
stevenjb 2015/04/08 20:27:30 Documented with GetDeviceStates. I can rename the
42 VerificationProperties; 42 using VerificationProperties =
43 core_api::networking_private::VerificationProperties;
43 44
44 // The Verify* methods will be forwarded to a delegate implementation if 45 // The Verify* methods will be forwarded to a delegate implementation if
45 // provided, otherwise they will fail. A separate delegate it used so that the 46 // provided, otherwise they will fail. A separate delegate it used so that the
46 // current Verify* implementations are not exposed outside of src/chrome. 47 // current Verify* implementations are not exposed outside of src/chrome.
47 class VerifyDelegate { 48 class VerifyDelegate {
48 public: 49 public:
49 typedef NetworkingPrivateDelegate::VerificationProperties 50 typedef NetworkingPrivateDelegate::VerificationProperties
50 VerificationProperties; 51 VerificationProperties;
51 typedef NetworkingPrivateDelegate::BoolCallback BoolCallback; 52 typedef NetworkingPrivateDelegate::BoolCallback BoolCallback;
52 typedef NetworkingPrivateDelegate::StringCallback StringCallback; 53 typedef NetworkingPrivateDelegate::StringCallback StringCallback;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 virtual void GetCaptivePortalStatus( 130 virtual void GetCaptivePortalStatus(
130 const std::string& guid, 131 const std::string& guid,
131 const StringCallback& success_callback, 132 const StringCallback& success_callback,
132 const FailureCallback& failure_callback) = 0; 133 const FailureCallback& failure_callback) = 0;
133 134
134 // Synchronous methods 135 // Synchronous methods
135 136
136 // Returns a list of ONC type strings. 137 // Returns a list of ONC type strings.
137 virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() = 0; 138 virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() = 0;
138 139
140 // Returns a map of ONC network types to ONC device states.
141 virtual scoped_ptr<DeviceStateMap> GetDeviceStates() = 0;
142
139 // Returns true if the ONC network type |type| is enabled. 143 // Returns true if the ONC network type |type| is enabled.
140 virtual bool EnableNetworkType(const std::string& type) = 0; 144 virtual bool EnableNetworkType(const std::string& type) = 0;
141 145
142 // Returns true if the ONC network type |type| is disabled. 146 // Returns true if the ONC network type |type| is disabled.
143 virtual bool DisableNetworkType(const std::string& type) = 0; 147 virtual bool DisableNetworkType(const std::string& type) = 0;
144 148
145 // Returns true if a scan was requested. It may take many seconds for a scan 149 // Returns true if a scan was requested. It may take many seconds for a scan
146 // to complete. The scan may or may not trigger API events when complete. 150 // to complete. The scan may or may not trigger API events when complete.
147 virtual bool RequestScan() = 0; 151 virtual bool RequestScan() = 0;
148 152
(...skipping 20 matching lines...) Expand all
169 private: 173 private:
170 // Interface for Verify* methods. May be NULL. 174 // Interface for Verify* methods. May be NULL.
171 scoped_ptr<VerifyDelegate> verify_delegate_; 175 scoped_ptr<VerifyDelegate> verify_delegate_;
172 176
173 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegate); 177 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegate);
174 }; 178 };
175 179
176 } // namespace extensions 180 } // namespace extensions
177 181
178 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE _H_ 182 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698