OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/string16.h" | 19 #include "base/string16.h" |
20 #include "base/timer.h" | 20 #include "base/timer.h" |
21 #include "chrome/browser/chromeos/cros/network_ui_data.h" | |
21 #include "third_party/cros/chromeos_network.h" | 22 #include "third_party/cros/chromeos_network.h" |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 class DictionaryValue; | 25 class DictionaryValue; |
25 class Value; | 26 class Value; |
26 } | 27 } |
27 | 28 |
28 namespace chromeos { | 29 namespace chromeos { |
29 | 30 |
30 class NetworkDeviceParser; | 31 class NetworkDeviceParser; |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 NetworkProfileType profile_type() const { return profile_type_; } | 659 NetworkProfileType profile_type() const { return profile_type_; } |
659 | 660 |
660 const std::string& unique_id() const { return unique_id_; } | 661 const std::string& unique_id() const { return unique_id_; } |
661 int priority_order() const { return priority_order_; } | 662 int priority_order() const { return priority_order_; } |
662 | 663 |
663 const std::string& proxy_config() const { return proxy_config_; } | 664 const std::string& proxy_config() const { return proxy_config_; } |
664 | 665 |
665 const DictionaryValue* ui_data() const { return &ui_data_; } | 666 const DictionaryValue* ui_data() const { return &ui_data_; } |
666 DictionaryValue* ui_data() { return &ui_data_; } | 667 DictionaryValue* ui_data() { return &ui_data_; } |
667 | 668 |
669 const DictionaryValue* onc() const { return &onc_; } | |
670 DictionaryValue* onc() { return &onc_; } | |
671 | |
668 void set_notify_failure(bool state) { notify_failure_ = state; } | 672 void set_notify_failure(bool state) { notify_failure_ = state; } |
669 | 673 |
670 void SetPreferred(bool preferred); | 674 void SetPreferred(bool preferred); |
671 | 675 |
672 void SetAutoConnect(bool auto_connect); | 676 void SetAutoConnect(bool auto_connect); |
673 | 677 |
674 void SetName(const std::string& name); | 678 void SetName(const std::string& name); |
675 | 679 |
676 void SetSaveCredentials(bool save_credentials); | 680 void SetSaveCredentials(bool save_credentials); |
677 | 681 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
840 | 844 |
841 // These must not be modified after construction. | 845 // These must not be modified after construction. |
842 std::string service_path_; | 846 std::string service_path_; |
843 ConnectionType type_; | 847 ConnectionType type_; |
844 | 848 |
845 // UI-level state that is opaque to the connection manager. It's kept in a | 849 // UI-level state that is opaque to the connection manager. It's kept in a |
846 // DictionaryValue to allow for simple addition of new settings. The value is | 850 // DictionaryValue to allow for simple addition of new settings. The value is |
847 // stored in JSON-serialized from in the connection manager. | 851 // stored in JSON-serialized from in the connection manager. |
848 DictionaryValue ui_data_; | 852 DictionaryValue ui_data_; |
849 | 853 |
854 // This contains the ONC blob if this network was imported via ONC. This is | |
kmixter1
2011/12/13 19:21:03
nit: This contains the deserialized ONC blob...
Mattias Nissler (ping if slow)
2011/12/14 20:46:38
Obsolete now...
| |
855 // currently only used for policy-configured networks to figure out which | |
856 // properties should be user-editable and what their default values are. | |
857 DictionaryValue onc_; | |
858 | |
850 // This is the parser we use to parse messages from the native | 859 // This is the parser we use to parse messages from the native |
851 // network layer. | 860 // network layer. |
852 scoped_ptr<NetworkParser> network_parser_; | 861 scoped_ptr<NetworkParser> network_parser_; |
853 | 862 |
854 // This map stores the set of properties for the network. | 863 // This map stores the set of properties for the network. |
855 // Not all properties in this map are exposed via get methods. | 864 // Not all properties in this map are exposed via get methods. |
856 PropertyMap property_map_; | 865 PropertyMap property_map_; |
857 | 866 |
858 DISALLOW_COPY_AND_ASSIGN(Network); | 867 DISALLOW_COPY_AND_ASSIGN(Network); |
859 }; | 868 }; |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1783 // If nothing is changed, this method does nothing. | 1792 // If nothing is changed, this method does nothing. |
1784 virtual void SetIPConfig(const NetworkIPConfig& ipconfig) = 0; | 1793 virtual void SetIPConfig(const NetworkIPConfig& ipconfig) = 0; |
1785 | 1794 |
1786 // This will connect to a preferred network if the currently connected | 1795 // This will connect to a preferred network if the currently connected |
1787 // network is not preferred. This should be called when the active profile | 1796 // network is not preferred. This should be called when the active profile |
1788 // changes. | 1797 // changes. |
1789 virtual void SwitchToPreferredNetwork() = 0; | 1798 virtual void SwitchToPreferredNetwork() = 0; |
1790 | 1799 |
1791 // Load networks from an Open Network Configuration blob. | 1800 // Load networks from an Open Network Configuration blob. |
1792 virtual bool LoadOncNetworks(const std::string& onc_blob, | 1801 virtual bool LoadOncNetworks(const std::string& onc_blob, |
1793 const std::string& passcode) = 0; | 1802 const std::string& passcode, |
1803 NetworkUIData::ONCSource source) = 0; | |
1794 | 1804 |
1795 // This sets the active network for the network type. Note: priority order | 1805 // This sets the active network for the network type. Note: priority order |
1796 // is unchanged (i.e. if a wifi network is set to active, but an ethernet | 1806 // is unchanged (i.e. if a wifi network is set to active, but an ethernet |
1797 // network is still active, active_network() will still return the ethernet | 1807 // network is still active, active_network() will still return the ethernet |
1798 // network). Other networks of the same type will become inactive. | 1808 // network). Other networks of the same type will become inactive. |
1799 // Used for testing. | 1809 // Used for testing. |
1800 virtual bool SetActiveNetwork(ConnectionType type, | 1810 virtual bool SetActiveNetwork(ConnectionType type, |
1801 const std::string& service_path) = 0; | 1811 const std::string& service_path) = 0; |
1802 | 1812 |
1803 // Factory function, creates a new instance and returns ownership. | 1813 // Factory function, creates a new instance and returns ownership. |
1804 // For normal usage, access the singleton via CrosLibrary::Get(). | 1814 // For normal usage, access the singleton via CrosLibrary::Get(). |
1805 static NetworkLibrary* GetImpl(bool stub); | 1815 static NetworkLibrary* GetImpl(bool stub); |
1806 }; | 1816 }; |
1807 | 1817 |
1808 } // namespace chromeos | 1818 } // namespace chromeos |
1809 | 1819 |
1810 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 1820 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
OLD | NEW |