| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow | 13 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow |
| 14 #include "ui/views/controls/button/button.h" // views::ButtonListener | 14 #include "ui/views/controls/button/button.h" // views::ButtonListener |
| 15 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class ImageSkia; | 18 class ImageSkia; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 class ImageView; | 22 class ImageView; |
| 23 struct WidgetParent; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace chromeos { | 26 namespace chromeos { |
| 26 | 27 |
| 27 class ChildNetworkConfigView; | 28 class ChildNetworkConfigView; |
| 28 class NetworkPropertyUIData; | 29 class NetworkPropertyUIData; |
| 29 class NetworkState; | 30 class NetworkState; |
| 30 | 31 |
| 31 // A dialog box for showing a password textfield. | 32 // A dialog box for showing a password textfield. |
| 32 class NetworkConfigView : public views::DialogDelegateView, | 33 class NetworkConfigView : public views::DialogDelegateView, |
| 33 public views::ButtonListener { | 34 public views::ButtonListener { |
| 34 public: | 35 public: |
| 35 class Delegate { | 36 class Delegate { |
| 36 public: | 37 public: |
| 37 // Called when dialog "OK" button is pressed. | 38 // Called when dialog "OK" button is pressed. |
| 38 virtual void OnDialogAccepted() = 0; | 39 virtual void OnDialogAccepted() = 0; |
| 39 | 40 |
| 40 // Called when dialog "Cancel" button is pressed. | 41 // Called when dialog "Cancel" button is pressed. |
| 41 virtual void OnDialogCancelled() = 0; | 42 virtual void OnDialogCancelled() = 0; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 virtual ~Delegate() {} | 45 virtual ~Delegate() {} |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 // Shows a network connection dialog if none is currently visible. | 48 // Shows a network connection dialog if none is currently visible. |
| 48 static void Show(const std::string& service_path, gfx::NativeWindow parent); | 49 static void Show(const std::string& service_path, |
| 50 const views::WidgetParent& widget_parent); |
| 51 |
| 49 // Shows a dialog to configure a new network. |type| must be a valid Shill | 52 // Shows a dialog to configure a new network. |type| must be a valid Shill |
| 50 // 'Type' property value. | 53 // 'Type' property value. |
| 51 static void ShowForType(const std::string& type, gfx::NativeWindow parent); | 54 static void ShowForType(const std::string& type, |
| 55 const views::WidgetParent& widget_parent); |
| 52 | 56 |
| 53 // Returns corresponding native window. | 57 // Returns corresponding native window. |
| 54 gfx::NativeWindow GetNativeWindow() const; | 58 gfx::NativeWindow GetNativeWindow() const; |
| 55 | 59 |
| 56 // views::DialogDelegate methods. | 60 // views::DialogDelegate methods. |
| 57 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 61 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 58 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 62 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 59 bool Cancel() override; | 63 bool Cancel() override; |
| 60 bool Accept() override; | 64 bool Accept() override; |
| 61 views::View* CreateExtraView() override; | 65 views::View* CreateExtraView() override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 85 private: | 89 private: |
| 86 NetworkConfigView(); | 90 NetworkConfigView(); |
| 87 ~NetworkConfigView() override; | 91 ~NetworkConfigView() override; |
| 88 | 92 |
| 89 // Login dialog for known networks. Returns true if successfully created. | 93 // Login dialog for known networks. Returns true if successfully created. |
| 90 bool InitWithNetworkState(const NetworkState* network); | 94 bool InitWithNetworkState(const NetworkState* network); |
| 91 // Login dialog for new/hidden networks. Returns true if successfully created. | 95 // Login dialog for new/hidden networks. Returns true if successfully created. |
| 92 bool InitWithType(const std::string& type); | 96 bool InitWithType(const std::string& type); |
| 93 | 97 |
| 94 // Creates and shows a dialog containing this view. | 98 // Creates and shows a dialog containing this view. |
| 95 void ShowDialog(gfx::NativeWindow parent); | 99 void ShowDialog(const views::WidgetParent& widget_parent); |
| 100 |
| 101 // Returns InitParams to place the dialog window in the correct parent. |
| 102 views::Widget::InitParams GetDialogWidgetInitParams( |
| 103 const views::WidgetParent& widget_parent); |
| 96 | 104 |
| 97 // Resets the underlying view to show advanced options. | 105 // Resets the underlying view to show advanced options. |
| 98 void ShowAdvancedView(); | 106 void ShowAdvancedView(); |
| 99 | 107 |
| 100 // There's always only one child view, which will get deleted when | 108 // There's always only one child view, which will get deleted when |
| 101 // NetworkConfigView gets cleaned up. | 109 // NetworkConfigView gets cleaned up. |
| 102 ChildNetworkConfigView* child_config_view_; | 110 ChildNetworkConfigView* child_config_view_; |
| 103 | 111 |
| 104 Delegate* delegate_; | 112 Delegate* delegate_; |
| 105 | 113 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 private: | 178 private: |
| 171 bool managed_; | 179 bool managed_; |
| 172 views::ImageView* image_view_; | 180 views::ImageView* image_view_; |
| 173 | 181 |
| 174 DISALLOW_COPY_AND_ASSIGN(ControlledSettingIndicatorView); | 182 DISALLOW_COPY_AND_ASSIGN(ControlledSettingIndicatorView); |
| 175 }; | 183 }; |
| 176 | 184 |
| 177 } // namespace chromeos | 185 } // namespace chromeos |
| 178 | 186 |
| 179 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ | 187 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ |
| OLD | NEW |