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

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: Fix test 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 #include <vector>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "components/keyed_service/core/keyed_service.h" 15 #include "components/keyed_service/core/keyed_service.h"
16 #include "extensions/common/api/networking_private.h"
pneubeck (no reviews) 2015/04/09 09:41:22 not sure why you have to change this include. if p
stevenjb 2015/04/09 16:20:25 Because we use ScopedVector<DeviceStateProperties>
14 17
15 namespace content { 18 namespace content {
16 class BrowserContext; 19 class BrowserContext;
17 } 20 }
18 21
19 namespace extensions { 22 namespace extensions {
20 23
21 class NetworkingPrivateDelegateObserver; 24 class NetworkingPrivateDelegateObserver;
22 25
23 namespace core_api { 26 namespace core_api {
24 namespace networking_private { 27 namespace networking_private {
28 struct DeviceStateProperties;
25 struct VerificationProperties; 29 struct VerificationProperties;
26 } // networking_private 30 } // networking_private
27 } // core_api 31 } // core_api
28 32
29 // Base class for platform dependent networkingPrivate API implementations. 33 // Base class for platform dependent networkingPrivate API implementations.
30 // All inputs and results for this class use ONC values. See 34 // All inputs and results for this class use ONC values. See
31 // networking_private.idl for descriptions of the expected inputs and results. 35 // networking_private.idl for descriptions of the expected inputs and results.
32 class NetworkingPrivateDelegate : public KeyedService { 36 class NetworkingPrivateDelegate : public KeyedService {
33 public: 37 public:
34 typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> 38 using DictionaryCallback =
35 DictionaryCallback; 39 base::Callback<void(scoped_ptr<base::DictionaryValue>)>;
36 typedef base::Callback<void()> VoidCallback; 40 using VoidCallback = base::Callback<void()>;
37 typedef base::Callback<void(bool)> BoolCallback; 41 using BoolCallback = base::Callback<void(bool)>;
38 typedef base::Callback<void(const std::string&)> StringCallback; 42 using StringCallback = base::Callback<void(const std::string&)>;
39 typedef base::Callback<void(scoped_ptr<base::ListValue>)> NetworkListCallback; 43 using NetworkListCallback = base::Callback<void(scoped_ptr<base::ListValue>)>;
40 typedef base::Callback<void(const std::string&)> FailureCallback; 44 using FailureCallback = base::Callback<void(const std::string&)>;
41 typedef core_api::networking_private::VerificationProperties 45 using DeviceStateList =
42 VerificationProperties; 46 ScopedVector<core_api::networking_private::DeviceStateProperties>;
47 using VerificationProperties =
48 core_api::networking_private::VerificationProperties;
43 49
44 // The Verify* methods will be forwarded to a delegate implementation if 50 // 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 51 // provided, otherwise they will fail. A separate delegate it used so that the
46 // current Verify* implementations are not exposed outside of src/chrome. 52 // current Verify* implementations are not exposed outside of src/chrome.
47 class VerifyDelegate { 53 class VerifyDelegate {
48 public: 54 public:
49 typedef NetworkingPrivateDelegate::VerificationProperties 55 typedef NetworkingPrivateDelegate::VerificationProperties
50 VerificationProperties; 56 VerificationProperties;
51 typedef NetworkingPrivateDelegate::BoolCallback BoolCallback; 57 typedef NetworkingPrivateDelegate::BoolCallback BoolCallback;
52 typedef NetworkingPrivateDelegate::StringCallback StringCallback; 58 typedef NetworkingPrivateDelegate::StringCallback StringCallback;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 virtual void GetCaptivePortalStatus( 135 virtual void GetCaptivePortalStatus(
130 const std::string& guid, 136 const std::string& guid,
131 const StringCallback& success_callback, 137 const StringCallback& success_callback,
132 const FailureCallback& failure_callback) = 0; 138 const FailureCallback& failure_callback) = 0;
133 139
134 // Synchronous methods 140 // Synchronous methods
135 141
136 // Returns a list of ONC type strings. 142 // Returns a list of ONC type strings.
137 virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() = 0; 143 virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() = 0;
138 144
145 // Returns a list of DeviceStateProperties.
146 virtual scoped_ptr<DeviceStateList> GetDeviceStateList() = 0;
147
139 // Returns true if the ONC network type |type| is enabled. 148 // Returns true if the ONC network type |type| is enabled.
140 virtual bool EnableNetworkType(const std::string& type) = 0; 149 virtual bool EnableNetworkType(const std::string& type) = 0;
141 150
142 // Returns true if the ONC network type |type| is disabled. 151 // Returns true if the ONC network type |type| is disabled.
143 virtual bool DisableNetworkType(const std::string& type) = 0; 152 virtual bool DisableNetworkType(const std::string& type) = 0;
144 153
145 // Returns true if a scan was requested. It may take many seconds for a scan 154 // 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. 155 // to complete. The scan may or may not trigger API events when complete.
147 virtual bool RequestScan() = 0; 156 virtual bool RequestScan() = 0;
148 157
(...skipping 20 matching lines...) Expand all
169 private: 178 private:
170 // Interface for Verify* methods. May be NULL. 179 // Interface for Verify* methods. May be NULL.
171 scoped_ptr<VerifyDelegate> verify_delegate_; 180 scoped_ptr<VerifyDelegate> verify_delegate_;
172 181
173 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegate); 182 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegate);
174 }; 183 };
175 184
176 } // namespace extensions 185 } // namespace extensions
177 186
178 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE _H_ 187 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698