OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 ASH_SYSTEM_NETWORK_NETWORK_LIST_VIEW_BASE_H_ | 5 #ifndef ASH_SYSTEM_NETWORK_NETWORK_LIST_VIEW_BASE_H_ |
6 #define ASH_SYSTEM_NETWORK_NETWORK_LIST_VIEW_BASE_H_ | 6 #define ASH_SYSTEM_NETWORK_NETWORK_LIST_VIEW_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 class View; | 13 class View; |
14 } | 14 } |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
| 17 namespace tray { |
| 18 class NetworkStateListDetailedView; |
| 19 } |
17 | 20 |
18 // Base class for a list of available networks (and, in the case of VPNs, the | 21 // Base class for a list of available networks (and, in the case of VPNs, the |
19 // list of available VPN providers). | 22 // list of available VPN providers). |
20 class NetworkListViewBase { | 23 class NetworkListViewBase { |
21 public: | 24 public: |
22 NetworkListViewBase(); | |
23 virtual ~NetworkListViewBase(); | 25 virtual ~NetworkListViewBase(); |
24 | 26 |
25 void set_container(views::View* container) { container_ = container; } | 27 void set_container(views::View* container) { container_ = container; } |
26 | 28 |
27 // Refreshes the network list. | 29 // Refreshes the network list. |
28 virtual void Update() = 0; | 30 virtual void Update() = 0; |
29 | 31 |
30 // Checks whether |view| represents a network in the list. If yes, sets | 32 // Checks whether |view| represents a network in the list. If yes, sets |
31 // |guid| to the network's guid and returns |true|. Otherwise, | 33 // |guid| to the network's guid and returns |true|. Otherwise, |
32 // leaves |guid| unchanged and returns |false|. | 34 // leaves |guid| unchanged and returns |false|. |
33 virtual bool IsNetworkEntry(views::View* view, std::string* guid) const = 0; | 35 virtual bool IsNetworkEntry(views::View* view, std::string* guid) const = 0; |
34 | 36 |
35 protected: | 37 protected: |
36 views::View* container() { return container_; } | 38 explicit NetworkListViewBase( |
| 39 tray::NetworkStateListDetailedView* detailed_view); |
| 40 |
| 41 tray::NetworkStateListDetailedView* detailed_view() const { |
| 42 return detailed_view_; |
| 43 } |
| 44 |
| 45 views::View* container() const { return container_; } |
37 | 46 |
38 private: | 47 private: |
| 48 tray::NetworkStateListDetailedView* const detailed_view_; |
| 49 |
39 // The container that holds the actual list entries. | 50 // The container that holds the actual list entries. |
40 views::View* container_ = nullptr; | 51 views::View* container_ = nullptr; |
41 | 52 |
42 DISALLOW_COPY_AND_ASSIGN(NetworkListViewBase); | 53 DISALLOW_COPY_AND_ASSIGN(NetworkListViewBase); |
43 }; | 54 }; |
44 | 55 |
45 } // namespace ash | 56 } // namespace ash |
46 | 57 |
47 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_VIEW_BASE_H_ | 58 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_VIEW_BASE_H_ |
OLD | NEW |