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

Side by Side Diff: chrome/browser/chromeos/cros/network_library.h

Issue 8734013: Resubmit CL. See 8429004. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
16 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
17 #include "base/observer_list.h" 18 #include "base/observer_list.h"
18 #include "base/string16.h" 19 #include "base/string16.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 PROPERTY_INDEX_ROAMING_STATE, 125 PROPERTY_INDEX_ROAMING_STATE,
125 PROPERTY_INDEX_SAVE_CREDENTIALS, 126 PROPERTY_INDEX_SAVE_CREDENTIALS,
126 PROPERTY_INDEX_SCANNING, 127 PROPERTY_INDEX_SCANNING,
127 PROPERTY_INDEX_SECURITY, 128 PROPERTY_INDEX_SECURITY,
128 PROPERTY_INDEX_SELECTED_NETWORK, 129 PROPERTY_INDEX_SELECTED_NETWORK,
129 PROPERTY_INDEX_SERVICES, 130 PROPERTY_INDEX_SERVICES,
130 PROPERTY_INDEX_SERVICE_WATCH_LIST, 131 PROPERTY_INDEX_SERVICE_WATCH_LIST,
131 PROPERTY_INDEX_SERVING_OPERATOR, 132 PROPERTY_INDEX_SERVING_OPERATOR,
132 PROPERTY_INDEX_SIGNAL_STRENGTH, 133 PROPERTY_INDEX_SIGNAL_STRENGTH,
133 PROPERTY_INDEX_SIM_LOCK, 134 PROPERTY_INDEX_SIM_LOCK,
135 PROPERTY_INDEX_SSID,
134 PROPERTY_INDEX_STATE, 136 PROPERTY_INDEX_STATE,
135 PROPERTY_INDEX_SUPPORT_NETWORK_SCAN, 137 PROPERTY_INDEX_SUPPORT_NETWORK_SCAN,
136 PROPERTY_INDEX_TECHNOLOGY_FAMILY, 138 PROPERTY_INDEX_TECHNOLOGY_FAMILY,
137 PROPERTY_INDEX_TYPE, 139 PROPERTY_INDEX_TYPE,
138 PROPERTY_INDEX_UI_DATA, 140 PROPERTY_INDEX_UI_DATA,
139 PROPERTY_INDEX_UNKNOWN, 141 PROPERTY_INDEX_UNKNOWN,
140 PROPERTY_INDEX_USAGE_URL, 142 PROPERTY_INDEX_USAGE_URL,
141 PROPERTY_INDEX_OLP, 143 PROPERTY_INDEX_OLP,
142 PROPERTY_INDEX_OPEN_VPN_USER, 144 PROPERTY_INDEX_OPEN_VPN_USER,
143 PROPERTY_INDEX_OPEN_VPN_PASSWORD, 145 PROPERTY_INDEX_OPEN_VPN_PASSWORD,
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 const base::Value& value, 668 const base::Value& value,
667 PropertyIndex* index); 669 PropertyIndex* index);
668 670
669 protected: 671 protected:
670 Network(const std::string& service_path, 672 Network(const std::string& service_path,
671 ConnectionType type); 673 ConnectionType type);
672 674
673 NetworkParser* network_parser() { return network_parser_.get(); } 675 NetworkParser* network_parser() { return network_parser_.get(); }
674 void SetNetworkParser(NetworkParser* parser); 676 void SetNetworkParser(NetworkParser* parser);
675 677
678 // Updates property_map_ for the corresponding property index.
679 void UpdatePropertyMap(PropertyIndex index, const base::Value& value);
680
676 // Set the state and update flags if necessary. 681 // Set the state and update flags if necessary.
677 void SetState(ConnectionState state); 682 void SetState(ConnectionState state);
678 683
679 // Parse name/value pairs from libcros. 684 // Parse name/value pairs from libcros.
680 virtual void ParseInfo(const base::DictionaryValue& info); 685 virtual void ParseInfo(const base::DictionaryValue& info);
681 686
682 // Erase cached credentials, used when "Save password" is unchecked. 687 // Erase cached credentials, used when "Save password" is unchecked.
683 virtual void EraseCredentials(); 688 virtual void EraseCredentials();
684 689
685 // Calculate a unique identifier for the network. 690 // Calculate a unique identifier for the network.
686 virtual void CalculateUniqueId(); 691 virtual void CalculateUniqueId();
687 692
688 // Methods to asynchronously set network service properties 693 // Methods to asynchronously set network service properties
689 virtual void SetStringProperty(const char* prop, const std::string& str, 694 virtual void SetStringProperty(const char* prop, const std::string& str,
690 std::string* dest); 695 std::string* dest);
691 virtual void SetBooleanProperty(const char* prop, bool b, bool* dest); 696 virtual void SetBooleanProperty(const char* prop, bool b, bool* dest);
692 virtual void SetIntegerProperty(const char* prop, int i, int* dest); 697 virtual void SetIntegerProperty(const char* prop, int i, int* dest);
693 virtual void SetValueProperty(const char* prop, base::Value* val); 698 virtual void SetValueProperty(const char* prop, base::Value* val);
694 virtual void ClearProperty(const char* prop); 699 virtual void ClearProperty(const char* prop);
695 700
696 // This will clear the property if string is empty. Otherwise, it will set it. 701 // This will clear the property if string is empty. Otherwise, it will set it.
697 virtual void SetOrClearStringProperty(const char* prop, 702 virtual void SetOrClearStringProperty(const char* prop,
698 const std::string& str, 703 const std::string& str,
699 std::string* dest); 704 std::string* dest);
700 705
701 void set_unique_id(const std::string& unique_id) { unique_id_ = unique_id; } 706 void set_unique_id(const std::string& unique_id) { unique_id_ = unique_id; }
702 DictionaryValue* ui_data() { return &ui_data_; } 707 DictionaryValue* ui_data() { return &ui_data_; }
703 708
704 private: 709 private:
710 typedef std::map<PropertyIndex, base::Value*> PropertyMap;
711
705 // This allows NetworkParser and its subclasses access to device 712 // This allows NetworkParser and its subclasses access to device
706 // privates so that they can be reconstituted during parsing. The 713 // privates so that they can be reconstituted during parsing. The
707 // parsers only access things through the private set_ functions so 714 // parsers only access things through the private set_ functions so
708 // that this class can evolve without having to change all the 715 // that this class can evolve without having to change all the
709 // parsers. 716 // parsers.
710 friend class NetworkParser; 717 friend class NetworkParser;
711 friend class NativeNetworkParser; 718 friend class NativeNetworkParser;
712 friend class NativeVirtualNetworkParser; 719 friend class NativeVirtualNetworkParser;
713 friend class OncNetworkParser; 720 friend class OncNetworkParser;
714 friend class OncVirtualNetworkParser; 721 friend class OncVirtualNetworkParser;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 796
790 // UI-level state that is opaque to the connection manager. It's kept in a 797 // UI-level state that is opaque to the connection manager. It's kept in a
791 // DictionaryValue to allow for simple addition of new settings. The value is 798 // DictionaryValue to allow for simple addition of new settings. The value is
792 // stored in JSON-serialized from in the connection manager. 799 // stored in JSON-serialized from in the connection manager.
793 DictionaryValue ui_data_; 800 DictionaryValue ui_data_;
794 801
795 // This is the parser we use to parse messages from the native 802 // This is the parser we use to parse messages from the native
796 // network layer. 803 // network layer.
797 scoped_ptr<NetworkParser> network_parser_; 804 scoped_ptr<NetworkParser> network_parser_;
798 805
806 // This map stores the set of properties for the network.
807 // Not all properties in this map are exposed via get methods.
808 PropertyMap property_map_;
809
799 DISALLOW_COPY_AND_ASSIGN(Network); 810 DISALLOW_COPY_AND_ASSIGN(Network);
800 }; 811 };
801 812
802 // Class for networks of TYPE_ETHERNET. 813 // Class for networks of TYPE_ETHERNET.
803 class EthernetNetwork : public Network { 814 class EthernetNetwork : public Network {
804 public: 815 public:
805 explicit EthernetNetwork(const std::string& service_path); 816 explicit EthernetNetwork(const std::string& service_path);
806 private: 817 private:
807 // This allows the implementation classes access to privates. 818 // This allows the implementation classes access to privates.
808 NETWORK_LIBRARY_IMPL_FRIENDS; 819 NETWORK_LIBRARY_IMPL_FRIENDS;
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 const std::string& service_path) = 0; 1752 const std::string& service_path) = 0;
1742 1753
1743 // Factory function, creates a new instance and returns ownership. 1754 // Factory function, creates a new instance and returns ownership.
1744 // For normal usage, access the singleton via CrosLibrary::Get(). 1755 // For normal usage, access the singleton via CrosLibrary::Get().
1745 static NetworkLibrary* GetImpl(bool stub); 1756 static NetworkLibrary* GetImpl(bool stub);
1746 }; 1757 };
1747 1758
1748 } // namespace chromeos 1759 } // namespace chromeos
1749 1760
1750 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ 1761 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/native_network_parser.cc ('k') | chrome/browser/chromeos/cros/network_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698