OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OPTIONS_NETWORK_CONFIG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Shows a network connection dialog if none is currently visible. | 47 // Shows a network connection dialog if none is currently visible. |
48 static void Show(const std::string& service_path, gfx::NativeWindow parent); | 48 static void Show(const std::string& service_path, gfx::NativeWindow parent); |
49 // Shows a dialog to configure a new network. |type| must be a valid Shill | 49 // Shows a dialog to configure a new network. |type| must be a valid Shill |
50 // 'Type' property value. | 50 // 'Type' property value. |
51 static void ShowForType(const std::string& type, gfx::NativeWindow parent); | 51 static void ShowForType(const std::string& type, gfx::NativeWindow parent); |
52 | 52 |
53 // Returns corresponding native window. | 53 // Returns corresponding native window. |
54 gfx::NativeWindow GetNativeWindow() const; | 54 gfx::NativeWindow GetNativeWindow() const; |
55 | 55 |
56 // views::DialogDelegate methods. | 56 // views::DialogDelegate methods. |
57 virtual base::string16 GetDialogButtonLabel( | 57 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
58 ui::DialogButton button) const override; | 58 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
59 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 59 bool Cancel() override; |
60 virtual bool Cancel() override; | 60 bool Accept() override; |
61 virtual bool Accept() override; | 61 views::View* CreateExtraView() override; |
62 virtual views::View* CreateExtraView() override; | 62 views::View* GetInitiallyFocusedView() override; |
63 virtual views::View* GetInitiallyFocusedView() override; | |
64 | 63 |
65 // views::WidgetDelegate methods. | 64 // views::WidgetDelegate methods. |
66 virtual base::string16 GetWindowTitle() const override; | 65 base::string16 GetWindowTitle() const override; |
67 virtual ui::ModalType GetModalType() const override; | 66 ui::ModalType GetModalType() const override; |
68 | 67 |
69 // views::View overrides. | 68 // views::View overrides. |
70 virtual void GetAccessibleState(ui::AXViewState* state) override; | 69 void GetAccessibleState(ui::AXViewState* state) override; |
71 | 70 |
72 // views::ButtonListener overrides. | 71 // views::ButtonListener overrides. |
73 virtual void ButtonPressed( | 72 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
74 views::Button* sender, const ui::Event& event) override; | |
75 | 73 |
76 void set_delegate(Delegate* delegate) { | 74 void set_delegate(Delegate* delegate) { |
77 delegate_ = delegate; | 75 delegate_ = delegate; |
78 } | 76 } |
79 | 77 |
80 protected: | 78 protected: |
81 // views::View overrides: | 79 // views::View overrides: |
82 virtual void Layout() override; | 80 void Layout() override; |
83 virtual gfx::Size GetPreferredSize() const override; | 81 gfx::Size GetPreferredSize() const override; |
84 virtual void ViewHierarchyChanged( | 82 void ViewHierarchyChanged( |
85 const ViewHierarchyChangedDetails& details) override; | 83 const ViewHierarchyChangedDetails& details) override; |
86 | 84 |
87 private: | 85 private: |
88 NetworkConfigView(); | 86 NetworkConfigView(); |
89 virtual ~NetworkConfigView(); | 87 ~NetworkConfigView() override; |
90 | 88 |
91 // Login dialog for known networks. Returns true if successfully created. | 89 // Login dialog for known networks. Returns true if successfully created. |
92 bool InitWithNetworkState(const NetworkState* network); | 90 bool InitWithNetworkState(const NetworkState* network); |
93 // Login dialog for new/hidden networks. Returns true if successfully created. | 91 // Login dialog for new/hidden networks. Returns true if successfully created. |
94 bool InitWithType(const std::string& type); | 92 bool InitWithType(const std::string& type); |
95 | 93 |
96 // Creates and shows a dialog containing this view. | 94 // Creates and shows a dialog containing this view. |
97 void ShowDialog(gfx::NativeWindow parent); | 95 void ShowDialog(gfx::NativeWindow parent); |
98 | 96 |
99 // Resets the underlying view to show advanced options. | 97 // Resets the underlying view to show advanced options. |
(...skipping 12 matching lines...) Expand all Loading... |
112 }; | 110 }; |
113 | 111 |
114 // Children of NetworkConfigView must subclass this and implement the virtual | 112 // Children of NetworkConfigView must subclass this and implement the virtual |
115 // methods, which are called by NetworkConfigView. | 113 // methods, which are called by NetworkConfigView. |
116 class ChildNetworkConfigView : public views::View { | 114 class ChildNetworkConfigView : public views::View { |
117 public: | 115 public: |
118 // If |service_path| is NULL, a dialog for configuring a new network will | 116 // If |service_path| is NULL, a dialog for configuring a new network will |
119 // be created. | 117 // be created. |
120 ChildNetworkConfigView(NetworkConfigView* parent, | 118 ChildNetworkConfigView(NetworkConfigView* parent, |
121 const std::string& service_path); | 119 const std::string& service_path); |
122 virtual ~ChildNetworkConfigView(); | 120 ~ChildNetworkConfigView() override; |
123 | 121 |
124 // Get the title to show for the dialog. | 122 // Get the title to show for the dialog. |
125 virtual base::string16 GetTitle() const = 0; | 123 virtual base::string16 GetTitle() const = 0; |
126 | 124 |
127 // Returns view that should be focused on dialog activation. | 125 // Returns view that should be focused on dialog activation. |
128 virtual views::View* GetInitiallyFocusedView() = 0; | 126 virtual views::View* GetInitiallyFocusedView() = 0; |
129 | 127 |
130 // Called to determine if "Connect" button should be enabled. | 128 // Called to determine if "Connect" button should be enabled. |
131 virtual bool CanLogin() = 0; | 129 virtual bool CanLogin() = 0; |
132 | 130 |
(...skipping 24 matching lines...) Expand all Loading... |
157 private: | 155 private: |
158 DISALLOW_COPY_AND_ASSIGN(ChildNetworkConfigView); | 156 DISALLOW_COPY_AND_ASSIGN(ChildNetworkConfigView); |
159 }; | 157 }; |
160 | 158 |
161 // Shows an icon with tooltip indicating whether a setting is under policy | 159 // Shows an icon with tooltip indicating whether a setting is under policy |
162 // control. | 160 // control. |
163 class ControlledSettingIndicatorView : public views::View { | 161 class ControlledSettingIndicatorView : public views::View { |
164 public: | 162 public: |
165 ControlledSettingIndicatorView(); | 163 ControlledSettingIndicatorView(); |
166 explicit ControlledSettingIndicatorView(const NetworkPropertyUIData& ui_data); | 164 explicit ControlledSettingIndicatorView(const NetworkPropertyUIData& ui_data); |
167 virtual ~ControlledSettingIndicatorView(); | 165 ~ControlledSettingIndicatorView() override; |
168 | 166 |
169 // Updates the view based on |ui_data|. | 167 // Updates the view based on |ui_data|. |
170 void Update(const NetworkPropertyUIData& ui_data); | 168 void Update(const NetworkPropertyUIData& ui_data); |
171 | 169 |
172 protected: | 170 protected: |
173 // views::View: | 171 // views::View: |
174 virtual gfx::Size GetPreferredSize() const override; | 172 gfx::Size GetPreferredSize() const override; |
175 virtual void Layout() override; | 173 void Layout() override; |
176 | 174 |
177 private: | 175 private: |
178 // Initializes the view. | 176 // Initializes the view. |
179 void Init(); | 177 void Init(); |
180 | 178 |
181 bool managed_; | 179 bool managed_; |
182 views::ImageView* image_view_; | 180 views::ImageView* image_view_; |
183 const gfx::ImageSkia* image_; | 181 const gfx::ImageSkia* image_; |
184 | 182 |
185 DISALLOW_COPY_AND_ASSIGN(ControlledSettingIndicatorView); | 183 DISALLOW_COPY_AND_ASSIGN(ControlledSettingIndicatorView); |
186 }; | 184 }; |
187 | 185 |
188 } // namespace chromeos | 186 } // namespace chromeos |
189 | 187 |
190 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ | 188 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ |
OLD | NEW |