Upstream changes for NetworkQualityProvider
[chromium-blink-merge.git] / chromeos / network / network_configuration_observer.h
blobf9e94694ae61b5177da5811ddb36068d477bc90c
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_NETWORK_NETWORK_CONFIGURATION_OBSERVER_H_
6 #define CHROMEOS_NETWORK_NETWORK_CONFIGURATION_OBSERVER_H_
8 #include <string>
10 #include "base/macros.h"
12 namespace base {
13 class DictionaryValue;
16 namespace chromeos {
18 struct NetworkConfiguration;
20 // Observer class for network configuration events.
21 class NetworkConfigurationObserver {
22 public:
23 // Indicates whether a configuration change is triggered by a user action,
24 // by an extension or by policy.
25 enum Source {
26 // Triggered by a user action.
27 SOURCE_USER_ACTION,
28 // Triggered by an extension to install a configuration.
29 SOURCE_EXTENSION_INSTALL,
30 // Triggered by a policy.
31 SOURCE_POLICY
34 // Called whenever a network configuration is created, or an existing
35 // configuration is replaced (see comment for CreateConfiguration).
36 // |service_path| provides the Shill current identifier for the network.
37 // Use properties[GUID] to get the global unique identifier. |profile_path|
38 // can be used to determine whether or not the network is shared.
39 // |properties| contains the Shill properties that were passed to
40 // NetworkConfigurationHandler::CreateConfiguration.
41 virtual void OnConfigurationCreated(
42 const std::string& service_path,
43 const std::string& profile_path,
44 const base::DictionaryValue& properties,
45 Source source) = 0;
47 // Called whenever a network configuration is removed. |service_path|
48 // provides the Shill current identifier for the network. |guid| will be set
49 // to the corresponding GUID for the network if known at the time of removal,
50 // otherwise it will be empty.
51 virtual void OnConfigurationRemoved(const std::string& service_path,
52 const std::string& guid,
53 Source source) = 0;
55 // Called whenever network properties are set. |service_path| provides the
56 // Shill current identifier for the network. |guid| will be set to the
57 // corresponding GUID for the network. |set_properties| contains the Shill
58 // properties that were passed to NetworkConfigurationHandler::SetProperties.
59 virtual void OnPropertiesSet(const std::string& service_path,
60 const std::string& guid,
61 const base::DictionaryValue& set_properties,
62 Source source) = 0;
64 // Called whenever the profile (e.g. shared or user) that a configuration is
65 // associated with changes (see comment for OnConfigurationCreated).
66 virtual void OnConfigurationProfileChanged(
67 const std::string& service_path,
68 const std::string& profile_path,
69 Source source) = 0;
71 protected:
72 virtual ~NetworkConfigurationObserver() {}
74 private:
75 DISALLOW_ASSIGN(NetworkConfigurationObserver);
78 } // namespace chromeos
80 #endif // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_OBSERVER_H_