summaryrefslogtreecommitdiffstats
path: root/chromeos/network/network_configuration_observer.h
blob: f9e94694ae61b5177da5811ddb36068d477bc90c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_NETWORK_NETWORK_CONFIGURATION_OBSERVER_H_
#define CHROMEOS_NETWORK_NETWORK_CONFIGURATION_OBSERVER_H_

#include <string>

#include "base/macros.h"

namespace base {
class DictionaryValue;
}

namespace chromeos {

struct NetworkConfiguration;

// Observer class for network configuration events.
class NetworkConfigurationObserver {
 public:
  // Indicates whether a configuration change is triggered by a user action,
  // by an extension or by policy.
  enum Source {
    // Triggered by a user action.
    SOURCE_USER_ACTION,
    // Triggered by an extension to install a configuration.
    SOURCE_EXTENSION_INSTALL,
    // Triggered by a policy.
    SOURCE_POLICY
  };

  // Called whenever a network configuration is created, or an existing
  // configuration is replaced (see comment for CreateConfiguration).
  // |service_path| provides the Shill current identifier for the network.
  // Use properties[GUID] to get the global unique identifier. |profile_path|
  // can be used to determine whether or not the network is shared.
  // |properties| contains the Shill properties that were passed to
  // NetworkConfigurationHandler::CreateConfiguration.
  virtual void OnConfigurationCreated(
      const std::string& service_path,
      const std::string& profile_path,
      const base::DictionaryValue& properties,
      Source source) = 0;

  // Called whenever a network configuration is removed. |service_path|
  // provides the Shill current identifier for the network. |guid| will be set
  // to the corresponding GUID for the network if known at the time of removal,
  // otherwise it will be empty.
  virtual void OnConfigurationRemoved(const std::string& service_path,
                                      const std::string& guid,
                                      Source source) = 0;

  // Called whenever network properties are set. |service_path| provides the
  // Shill current identifier for the network. |guid| will be set to the
  // corresponding GUID for the network. |set_properties| contains the Shill
  // properties that were passed to NetworkConfigurationHandler::SetProperties.
  virtual void OnPropertiesSet(const std::string& service_path,
                               const std::string& guid,
                               const base::DictionaryValue& set_properties,
                               Source source) = 0;

  // Called whenever the profile (e.g. shared or user) that a configuration is
  // associated with changes (see comment for OnConfigurationCreated).
  virtual void OnConfigurationProfileChanged(
      const std::string& service_path,
      const std::string& profile_path,
      Source source) = 0;

 protected:
  virtual ~NetworkConfigurationObserver() {}

 private:
  DISALLOW_ASSIGN(NetworkConfigurationObserver);
};

}  // namespace chromeos

#endif  // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_OBSERVER_H_