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

Unified Diff: src/service_manager.cc

Issue 3528016: Cashew: implement backend usage API (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git
Patch Set: Fix code review nits and remove hardcoded usage URLs Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/service_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/service_manager.cc
diff --git a/src/service_manager.cc b/src/service_manager.cc
index 39f3c6d1d283d77c59bf4dea6823ea26cbe42e7d..4ca3348141462fae6949949f56b6033eb308d4e9 100644
--- a/src/service_manager.cc
+++ b/src/service_manager.cc
@@ -6,6 +6,7 @@
#include <glog/logging.h>
+#include "src/cashew_server.h"
#include "src/service.h"
namespace cashew {
@@ -23,7 +24,7 @@ static const char* kTypeCellular = "cellular";
ServiceManager::ServiceManager(DBus::Connection& connection) // NOLINT
: DBus::ObjectProxy(connection, kFlimflamManagerPath,
kFlimflamManagerName),
- connection_(connection) {
+ connection_(connection), cashew_server_(NULL) {
// init our state with a GetProperties() call to Flimflam
// we'll update this state by monitoring PropertyChanged signals
GetFlimflamServices();
@@ -43,6 +44,11 @@ const Service* ServiceManager::GetService(const std::string& service_path)
return static_cast<const Service *>(it->second);
}
+void ServiceManager::SetCashewServer(CashewServer *cashew_server) {
+ DLOG(INFO) << "SetCashewServer";
+ cashew_server_ = cashew_server;
+}
+
// Flimflam Manager D-Bus Proxy methods
void ServiceManager::PropertyChanged(const std::string& property_name,
@@ -68,6 +74,17 @@ void ServiceManager::StateChanged(const std::string& new_state) {
// onFlimflamOnline() hooks. If we care.
}
+// Service methods
+
+void ServiceManager::EmitDataPlansUpdate(const Service& service) {
+ DLOG(INFO) << "EmitDataPlansUpdate: service = " << service.GetPath();
+ if (cashew_server_ == NULL) {
+ DLOG(WARNING) << "EmitDataPlansUpdate: no Cashew server";
+ return;
+ }
+ cashew_server_->EmitDataPlansUpdate(service);
+}
+
// Private methods
void ServiceManager::DeleteServices(ServiceMap *service_map) {
@@ -160,7 +177,7 @@ void ServiceManager::OnServicesUpdate(const ServicePathList& paths) {
void ServiceManager::OnNewService(const DBus::Path& path) {
DLOG(INFO) << "OnNewService: " << path;
DCHECK(GetService(path) == NULL);
- Service *service = new(std::nothrow) Service(connection_, path);
+ Service *service = new(std::nothrow) Service(this, connection_, path);
if (service == NULL) {
LOG(ERROR) << "OnNewService: couldn't create service for " << path;
return;
« no previous file with comments | « src/service_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698