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

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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 const base::Value& value, 667 const base::Value& value,
667 PropertyIndex* index); 668 PropertyIndex* index);
668 669
669 protected: 670 protected:
670 Network(const std::string& service_path, 671 Network(const std::string& service_path,
671 ConnectionType type); 672 ConnectionType type);
672 673
673 NetworkParser* network_parser() { return network_parser_.get(); } 674 NetworkParser* network_parser() { return network_parser_.get(); }
674 void SetNetworkParser(NetworkParser* parser); 675 void SetNetworkParser(NetworkParser* parser);
675 676
677 // Updates the properties map for the corresponding property index.
stevenjb 2011/11/30 17:36:20 nit: s/the properties map/|property_map_|/
Charlie Lee 2011/11/30 18:01:21 Done.
678 void UpdatePropertyMap(PropertyIndex index, const base::Value& value);
679
676 // Set the state and update flags if necessary. 680 // Set the state and update flags if necessary.
677 void SetState(ConnectionState state); 681 void SetState(ConnectionState state);
678 682
679 // Parse name/value pairs from libcros. 683 // Parse name/value pairs from libcros.
680 virtual void ParseInfo(const base::DictionaryValue& info); 684 virtual void ParseInfo(const base::DictionaryValue& info);
681 685
682 // Erase cached credentials, used when "Save password" is unchecked. 686 // Erase cached credentials, used when "Save password" is unchecked.
683 virtual void EraseCredentials(); 687 virtual void EraseCredentials();
684 688
685 // Calculate a unique identifier for the network. 689 // Calculate a unique identifier for the network.
686 virtual void CalculateUniqueId(); 690 virtual void CalculateUniqueId();
687 691
688 // Methods to asynchronously set network service properties 692 // Methods to asynchronously set network service properties
689 virtual void SetStringProperty(const char* prop, const std::string& str, 693 virtual void SetStringProperty(const char* prop, const std::string& str,
690 std::string* dest); 694 std::string* dest);
691 virtual void SetBooleanProperty(const char* prop, bool b, bool* dest); 695 virtual void SetBooleanProperty(const char* prop, bool b, bool* dest);
692 virtual void SetIntegerProperty(const char* prop, int i, int* dest); 696 virtual void SetIntegerProperty(const char* prop, int i, int* dest);
693 virtual void SetValueProperty(const char* prop, base::Value* val); 697 virtual void SetValueProperty(const char* prop, base::Value* val);
694 virtual void ClearProperty(const char* prop); 698 virtual void ClearProperty(const char* prop);
695 699
696 // This will clear the property if string is empty. Otherwise, it will set it. 700 // This will clear the property if string is empty. Otherwise, it will set it.
697 virtual void SetOrClearStringProperty(const char* prop, 701 virtual void SetOrClearStringProperty(const char* prop,
698 const std::string& str, 702 const std::string& str,
699 std::string* dest); 703 std::string* dest);
700 704
701 void set_unique_id(const std::string& unique_id) { unique_id_ = unique_id; } 705 void set_unique_id(const std::string& unique_id) { unique_id_ = unique_id; }
702 DictionaryValue* ui_data() { return &ui_data_; } 706 DictionaryValue* ui_data() { return &ui_data_; }
703 707
704 private: 708 private:
709 typedef std::map<PropertyIndex, base::Value*> PropertyMap;
710
705 // This allows NetworkParser and its subclasses access to device 711 // This allows NetworkParser and its subclasses access to device
706 // privates so that they can be reconstituted during parsing. The 712 // privates so that they can be reconstituted during parsing. The
707 // parsers only access things through the private set_ functions so 713 // parsers only access things through the private set_ functions so
708 // that this class can evolve without having to change all the 714 // that this class can evolve without having to change all the
709 // parsers. 715 // parsers.
710 friend class NetworkParser; 716 friend class NetworkParser;
711 friend class NativeNetworkParser; 717 friend class NativeNetworkParser;
712 friend class NativeVirtualNetworkParser; 718 friend class NativeVirtualNetworkParser;
713 friend class OncNetworkParser; 719 friend class OncNetworkParser;
714 friend class OncVirtualNetworkParser; 720 friend class OncVirtualNetworkParser;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 795
790 // UI-level state that is opaque to the connection manager. It's kept in a 796 // 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 797 // DictionaryValue to allow for simple addition of new settings. The value is
792 // stored in JSON-serialized from in the connection manager. 798 // stored in JSON-serialized from in the connection manager.
793 DictionaryValue ui_data_; 799 DictionaryValue ui_data_;
794 800
795 // This is the parser we use to parse messages from the native 801 // This is the parser we use to parse messages from the native
796 // network layer. 802 // network layer.
797 scoped_ptr<NetworkParser> network_parser_; 803 scoped_ptr<NetworkParser> network_parser_;
798 804
805 // This map stores the set of properties for the network.
806 // Not all properties in this map are exposed via get methods.
807 PropertyMap property_map_;
808
799 DISALLOW_COPY_AND_ASSIGN(Network); 809 DISALLOW_COPY_AND_ASSIGN(Network);
800 }; 810 };
801 811
802 // Class for networks of TYPE_ETHERNET. 812 // Class for networks of TYPE_ETHERNET.
803 class EthernetNetwork : public Network { 813 class EthernetNetwork : public Network {
804 public: 814 public:
805 explicit EthernetNetwork(const std::string& service_path); 815 explicit EthernetNetwork(const std::string& service_path);
806 private: 816 private:
807 // This allows the implementation classes access to privates. 817 // This allows the implementation classes access to privates.
808 NETWORK_LIBRARY_IMPL_FRIENDS; 818 NETWORK_LIBRARY_IMPL_FRIENDS;
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 const std::string& service_path) = 0; 1751 const std::string& service_path) = 0;
1742 1752
1743 // Factory function, creates a new instance and returns ownership. 1753 // Factory function, creates a new instance and returns ownership.
1744 // For normal usage, access the singleton via CrosLibrary::Get(). 1754 // For normal usage, access the singleton via CrosLibrary::Get().
1745 static NetworkLibrary* GetImpl(bool stub); 1755 static NetworkLibrary* GetImpl(bool stub);
1746 }; 1756 };
1747 1757
1748 } // namespace chromeos 1758 } // namespace chromeos
1749 1759
1750 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ 1760 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698