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

Unified Diff: chromeos/network/network_profile_handler.cc

Issue 14729017: Add NetworkHandler to own network handlers in src/chromeos/network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos_unittests Created 7 years, 7 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 | « chromeos/network/network_profile_handler.h ('k') | chromeos/network/network_profile_handler_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_profile_handler.cc
diff --git a/chromeos/network/network_profile_handler.cc b/chromeos/network/network_profile_handler.cc
index 30c8fde78eb00274c715305bae8d8b3596263eae..cd6a8c665cbdea9a0e830a58c83321021e38b6ea 100644
--- a/chromeos/network/network_profile_handler.cc
+++ b/chromeos/network/network_profile_handler.cc
@@ -18,8 +18,6 @@
namespace chromeos {
-static NetworkProfileHandler* g_profile_handler_instance = NULL;
-
namespace {
bool ConvertListValueToStringVector(const base::ListValue& string_list,
@@ -54,51 +52,8 @@ class ProfilePathEquals {
std::string path_;
};
-class NetworkProfileHandlerImpl : public NetworkProfileHandler {
- public:
- NetworkProfileHandlerImpl() {
- DBusThreadManager::Get()->GetShillManagerClient()->
- AddPropertyChangedObserver(this);
-
- // Request the initial profile list.
- DBusThreadManager::Get()->GetShillManagerClient()->GetProperties(
- base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback,
- weak_ptr_factory_.GetWeakPtr()));
- }
-
- virtual ~NetworkProfileHandlerImpl() {
- DBusThreadManager::Get()->GetShillManagerClient()->
- RemovePropertyChangedObserver(this);
- }
-};
-
} // namespace
-// static
-NetworkProfileHandler* NetworkProfileHandler::Initialize() {
- CHECK(!g_profile_handler_instance);
- g_profile_handler_instance = new NetworkProfileHandlerImpl();
- return g_profile_handler_instance;
-}
-
-// static
-bool NetworkProfileHandler::IsInitialized() {
- return g_profile_handler_instance;
-}
-
-// static
-void NetworkProfileHandler::Shutdown() {
- CHECK(g_profile_handler_instance);
- delete g_profile_handler_instance;
- g_profile_handler_instance = NULL;
-}
-
-// static
-NetworkProfileHandler* NetworkProfileHandler::Get() {
- CHECK(g_profile_handler_instance);
- return g_profile_handler_instance;
-}
-
void NetworkProfileHandler::AddObserver(NetworkProfileObserver* observer) {
observers_.AddObserver(observer);
}
@@ -139,6 +94,7 @@ void NetworkProfileHandler::OnPropertyChanged(const std::string& name,
&new_profile_paths);
DCHECK(result);
+ VLOG(2) << "Profiles: " << profiles_.size();
// Search for removed profiles.
std::vector<std::string> removed_profile_paths;
for (ProfileList::const_iterator it = profiles_.begin();
@@ -225,9 +181,18 @@ const NetworkProfile* NetworkProfileHandler::GetProfileForUserhash(
NetworkProfileHandler::NetworkProfileHandler()
: weak_ptr_factory_(this) {
+ DBusThreadManager::Get()->GetShillManagerClient()->
+ AddPropertyChangedObserver(this);
+
+ // Request the initial profile list.
+ DBusThreadManager::Get()->GetShillManagerClient()->GetProperties(
+ base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback,
+ weak_ptr_factory_.GetWeakPtr()));
}
NetworkProfileHandler::~NetworkProfileHandler() {
+ DBusThreadManager::Get()->GetShillManagerClient()->
+ RemovePropertyChangedObserver(this);
}
} // namespace chromeos
« no previous file with comments | « chromeos/network/network_profile_handler.h ('k') | chromeos/network/network_profile_handler_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698