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

Side by Side Diff: src/service.h

Issue 5180003: cashew: add local byte counters (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 SRC_SERVICE_H_ 5 #ifndef SRC_SERVICE_H_
6 #define SRC_SERVICE_H_ 6 #define SRC_SERVICE_H_
7 7
8 #include <glib.h> 8 #include <glib.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // get Device object for this service 76 // get Device object for this service
77 // this can return NULL if we don't yet have Device info 77 // this can return NULL if we don't yet have Device info
78 virtual Device* GetDevice() const; 78 virtual Device* GetDevice() const;
79 79
80 // get data plan info, formatted for D-Bus 80 // get data plan info, formatted for D-Bus
81 virtual DBusDataPlanList GetDBusDataPlans() const; 81 virtual DBusDataPlanList GetDBusDataPlans() const;
82 82
83 // do we think that we're the default service at this time? 83 // do we think that we're the default service at this time?
84 virtual bool IsDefaultService() const; 84 virtual bool IsDefaultService() const;
85 85
86 // do we think that we're in the restricted pool at this time?
87 virtual bool RestrictedPool() const;
88
86 // Flimflam Service D-Bus Proxy methods 89 // Flimflam Service D-Bus Proxy methods
87 90
88 // receive incoming PropertyChanged D-Bus signal from Flimflam service 91 // receive incoming PropertyChanged D-Bus signal from Flimflam service
89 virtual void PropertyChanged(const std::string& property_name, 92 virtual void PropertyChanged(const std::string& property_name,
90 const DBus::Variant& new_value); 93 const DBus::Variant& new_value);
91 94
92 // Device methods 95 // Device methods
93 96
94 // we've received updated Cellular.Carrier info from our child Device 97 // we've received updated Cellular.Carrier info from our child Device
95 virtual void OnCarrierUpdate(const std::string& carrier); 98 virtual void OnCarrierUpdate(const std::string& carrier);
96 99
100 // we've received updated byte counter info from our child Device
101 virtual void OnByteCounterUpdate(uint64 rx_bytes, uint64 tx_bytes);
102
97 // DataPlanProviderDelegate methods 103 // DataPlanProviderDelegate methods
98 104
99 // a request to our carrier usage API proxy has completed 105 // a request to our carrier usage API proxy has completed
100 virtual void OnRequestComplete(const DataPlanProvider *provider, 106 virtual void OnRequestComplete(const DataPlanProvider *provider,
101 bool successful, 107 bool successful,
102 const Value *parsed_usage_update); 108 const Value *parsed_usage_update);
103 109
104 // Service Manager methods 110 // Service Manager methods
105 111
106 // we've received an update from our parent about whether or not we're the 112 // we've received an update from our parent about whether or not we're the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 178
173 // GetProperties timer glib source id 179 // GetProperties timer glib source id
174 // 0 means no source 180 // 0 means no source
175 guint get_properties_source_id_; 181 guint get_properties_source_id_;
176 182
177 // are we in the process of retrying our GetProperties call? 183 // are we in the process of retrying our GetProperties call?
178 // this flag exists to distinguish between our initial g_idle_add call 184 // this flag exists to distinguish between our initial g_idle_add call
179 // and our subsequent timer calls 185 // and our subsequent timer calls
180 bool retrying_get_properties_; 186 bool retrying_get_properties_;
181 187
188 // do we think that we're in the restricted pool?
189 // we start out assuming false until we discover otherwise
190 bool restricted_pool_;
191
182 // convert state string to State enum value 192 // convert state string to State enum value
183 State StateFromString(const std::string& state) const; 193 State StateFromString(const std::string& state) const;
184 194
185 // we've received updated Device info from Flimflam 195 // we've received updated Device info from Flimflam
186 void OnDeviceUpdate(const DBus::Path& device_path); 196 void OnDeviceUpdate(const DBus::Path& device_path);
187 197
188 // we've received updated State info from Flimflam 198 // we've received updated State info from Flimflam
189 void OnStateUpdate(const std::string& state); 199 void OnStateUpdate(const std::string& state);
190 200
191 // we've received updated Type info from Flimflam 201 // we've received updated Type info from Flimflam
192 void OnTypeUpdate(const std::string& type); 202 void OnTypeUpdate(const std::string& type);
193 203
194 // we've received updated Cellular.UsageUrl info from Flimflam 204 // we've received updated Cellular.UsageUrl info from Flimflam
195 void OnUsageUrlUpdate(const std::string& usage_url); 205 void OnUsageUrlUpdate(const std::string& usage_url);
196 206
207 // we've received updated Cellular.RestrictedPool info from Flimflam
Jason Glasgow 2010/11/19 02:22:32 This is out of date. See http://codereview.chromi
Vince Laviano 2010/11/19 02:44:58 Thanks for the heads-up. I'll revise my CL to look
208 void OnRestrictedPoolUpdate(bool restricted_pool);
209
197 // glib integration: static wrapper for GetServiceProperties 210 // glib integration: static wrapper for GetServiceProperties
198 // takes object ptr as data and invokes object->GetServiceProperties() 211 // takes object ptr as data and invokes object->GetServiceProperties()
199 static gboolean StaticGetServicePropertiesCallback(gpointer data); 212 static gboolean StaticGetServicePropertiesCallback(gpointer data);
200 213
201 // get service properties from Flimflam 214 // get service properties from Flimflam
202 // returns true on success and false on failure 215 // returns true on success and false on failure
203 bool GetServiceProperties(); 216 bool GetServiceProperties();
204 217
205 // clear a DataPlanList and delete its data plan objects 218 // clear a DataPlanList and delete its data plan objects
206 void DeleteDataPlans(DataPlanList *data_plans); 219 void DeleteDataPlans(DataPlanList *data_plans);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // stop sending periodic usage API requests 276 // stop sending periodic usage API requests
264 void StopSendingUsageRequests(); 277 void StopSendingUsageRequests();
265 278
266 // start sending periodic usage API requests 279 // start sending periodic usage API requests
267 void StartSendingUsageRequests(); 280 void StartSendingUsageRequests();
268 281
269 // something has changed, so reevaluate whether or not we should be sending 282 // something has changed, so reevaluate whether or not we should be sending
270 // periodic usage API requests and adjust our behavior if necessary 283 // periodic usage API requests and adjust our behavior if necessary
271 void ReconsiderSendingUsageRequests(); 284 void ReconsiderSendingUsageRequests();
272 285
286 // consult policy to determine if we should send an unsolicited update
287 void MaybeEmitDataPlansUpdate();
288
273 DISALLOW_COPY_AND_ASSIGN(Service); 289 DISALLOW_COPY_AND_ASSIGN(Service);
274 }; 290 };
275 291
276 } // namespace cashew 292 } // namespace cashew
277 293
278 #endif // SRC_SERVICE_H_ 294 #endif // SRC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698