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

Unified Diff: chromeos/network/network_configuration_handler.h

Issue 2689223002: Defer NetworkConfigurationHandler::CreateShillConfiguration callback (Closed)
Patch Set: Created 3 years, 10 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
Index: chromeos/network/network_configuration_handler.h
diff --git a/chromeos/network/network_configuration_handler.h b/chromeos/network/network_configuration_handler.h
index b780ce53c2e85beb84da8273abd7f9f2ee45bb4a..8c3b222970eac25a227f7a022c2cda3992d8cbbb 100644
--- a/chromeos/network/network_configuration_handler.h
+++ b/chromeos/network/network_configuration_handler.h
@@ -20,6 +20,7 @@
#include "chromeos/network/network_configuration_observer.h"
#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_handler_callbacks.h"
+#include "chromeos/network/network_state_handler_observer.h"
namespace base {
class DictionaryValue;
@@ -55,9 +56,9 @@ namespace chromeos {
// user consumption. Both |callback| and |error_callback| are permitted to be
// null callbacks.
class CHROMEOS_EXPORT NetworkConfigurationHandler
- : public base::SupportsWeakPtr<NetworkConfigurationHandler> {
+ : public NetworkStateHandlerObserver {
public:
- ~NetworkConfigurationHandler();
+ ~NetworkConfigurationHandler() override;
// Manages the observer list.
void AddObserver(NetworkConfigurationObserver* observer);
@@ -122,6 +123,10 @@ class CHROMEOS_EXPORT NetworkConfigurationHandler
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback);
+ // NetworkStateHandlerObserver
+ void NetworkListChanged() override;
+ void OnShuttingDown() override;
+
// Construct and initialize an instance for testing.
static NetworkConfigurationHandler* InitializeForTest(
NetworkStateHandler* network_state_handler,
@@ -138,7 +143,9 @@ class CHROMEOS_EXPORT NetworkConfigurationHandler
void Init(NetworkStateHandler* network_state_handler,
NetworkDeviceHandler* network_device_handler);
- void RunCreateNetworkCallback(
+ // Called when a configuration completes. This will wait for the cached
+ // state (NetworkStateHandler) to update before triggering the callback.
+ void ConfigurationCompleted(
const std::string& profile_path,
NetworkConfigurationObserver::Source source,
std::unique_ptr<base::DictionaryValue> configure_properties,
@@ -206,8 +213,15 @@ class CHROMEOS_EXPORT NetworkConfigurationHandler
std::map<std::string, std::unique_ptr<ProfileEntryDeleter>>
profile_entry_deleters_;
+ // Map of configuration callbacks to run once the service becomes available
+ // in the NetworkStateHandler cache.
+ std::map<std::string, network_handler::ServiceResultCallback>
+ configure_callbacks_;
+
base::ObserverList<NetworkConfigurationObserver, true> observers_;
+ base::WeakPtrFactory<NetworkConfigurationHandler> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationHandler);
};
« no previous file with comments | « chromeos/network/network_cert_migrator_unittest.cc ('k') | chromeos/network/network_configuration_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698