| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Called when dialog "Cancel" button is pressed. | 40 // Called when dialog "Cancel" button is pressed. |
| 41 virtual void OnDialogCancelled() = 0; | 41 virtual void OnDialogCancelled() = 0; |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 virtual ~Delegate() {} | 44 virtual ~Delegate() {} |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // Shows a network connection dialog if none is currently visible. The dialog | 47 // Shows a network connection dialog if none is currently visible. The dialog |
| 48 // will be a child of |parent| (e.g. the webui settings window) which ensures | 48 // will be a child of |parent| (e.g. the webui settings window) which ensures |
| 49 // it appears on the display the user is looking at. | 49 // it appears on the display the user is looking at. If |parent| is null and |
| 50 static void ShowInParent(const std::string& network_id, | 50 // no fallback parent can be found then the dialog will be placed on the |
| 51 gfx::NativeWindow parent); | 51 // primary display. |
| 52 | 52 static void ShowForNetworkId(const std::string& network_id, |
| 53 // Same as above but places the dialog in the given container on the primary | 53 gfx::NativeWindow parent); |
| 54 // display. Used as a fallback when no parent is available. | |
| 55 static void ShowInContainer(const std::string& network_id, int container_id); | |
| 56 | 54 |
| 57 // Shows a dialog to configure a new network. |type| must be a valid Shill | 55 // Shows a dialog to configure a new network. |type| must be a valid Shill |
| 58 // 'Type' property value. | 56 // 'Type' property value. See above regarding |parent|. |
| 59 static void ShowForType(const std::string& type, gfx::NativeWindow parent); | 57 static void ShowForType(const std::string& type, gfx::NativeWindow parent); |
| 60 | 58 |
| 61 // As above but places the dialog in the given ash window container on the | |
| 62 // primary display. Used as a fallback when no parent is available. | |
| 63 static void ShowForTypeInContainer(const std::string& type, int container_id); | |
| 64 | |
| 65 // Returns corresponding native window. | 59 // Returns corresponding native window. |
| 66 gfx::NativeWindow GetNativeWindow() const; | 60 gfx::NativeWindow GetNativeWindow() const; |
| 67 | 61 |
| 68 // views::DialogDelegate methods. | 62 // views::DialogDelegate methods. |
| 69 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 63 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 70 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 64 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 71 bool Cancel() override; | 65 bool Cancel() override; |
| 72 bool Accept() override; | 66 bool Accept() override; |
| 73 views::View* CreateExtraView() override; | 67 views::View* CreateExtraView() override; |
| 74 views::View* GetInitiallyFocusedView() override; | 68 views::View* GetInitiallyFocusedView() override; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 91 // views::View overrides: | 85 // views::View overrides: |
| 92 void Layout() override; | 86 void Layout() override; |
| 93 gfx::Size GetPreferredSize() const override; | 87 gfx::Size GetPreferredSize() const override; |
| 94 void ViewHierarchyChanged( | 88 void ViewHierarchyChanged( |
| 95 const ViewHierarchyChangedDetails& details) override; | 89 const ViewHierarchyChangedDetails& details) override; |
| 96 | 90 |
| 97 private: | 91 private: |
| 98 NetworkConfigView(); | 92 NetworkConfigView(); |
| 99 ~NetworkConfigView() override; | 93 ~NetworkConfigView() override; |
| 100 | 94 |
| 101 // Returns null for invalid network or if dialog is already showing. | |
| 102 static NetworkConfigView* CreateForNetworkId(const std::string& network_id); | |
| 103 | |
| 104 // Returns null for invalid network type or if dialog is already showing. | |
| 105 static NetworkConfigView* CreateForType(const std::string& type); | |
| 106 | |
| 107 // Login dialog for known networks. Returns true if successfully created. | 95 // Login dialog for known networks. Returns true if successfully created. |
| 108 bool InitWithNetworkState(const NetworkState* network); | 96 bool InitWithNetworkState(const NetworkState* network); |
| 109 // Login dialog for new/hidden networks. Returns true if successfully created. | 97 // Login dialog for new/hidden networks. Returns true if successfully created. |
| 110 bool InitWithType(const std::string& type); | 98 bool InitWithType(const std::string& type); |
| 111 | 99 |
| 112 // Creates and shows a dialog containing this view. | 100 // Creates and shows a dialog containing this view. |
| 113 void ShowDialog(gfx::NativeWindow parent); | 101 void ShowDialog(gfx::NativeWindow parent); |
| 114 void ShowDialogInContainer(int container_id); | |
| 115 | 102 |
| 116 // Resets the underlying view to show advanced options. | 103 // Resets the underlying view to show advanced options. |
| 117 void ShowAdvancedView(); | 104 void ShowAdvancedView(); |
| 118 | 105 |
| 119 // There's always only one child view, which will get deleted when | 106 // There's always only one child view, which will get deleted when |
| 120 // NetworkConfigView gets cleaned up. | 107 // NetworkConfigView gets cleaned up. |
| 121 ChildNetworkConfigView* child_config_view_; | 108 ChildNetworkConfigView* child_config_view_; |
| 122 | 109 |
| 123 Delegate* delegate_; | 110 Delegate* delegate_; |
| 124 | 111 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 private: | 176 private: |
| 190 bool managed_; | 177 bool managed_; |
| 191 views::ImageView* image_view_; | 178 views::ImageView* image_view_; |
| 192 | 179 |
| 193 DISALLOW_COPY_AND_ASSIGN(ControlledSettingIndicatorView); | 180 DISALLOW_COPY_AND_ASSIGN(ControlledSettingIndicatorView); |
| 194 }; | 181 }; |
| 195 | 182 |
| 196 } // namespace chromeos | 183 } // namespace chromeos |
| 197 | 184 |
| 198 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ | 185 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_NETWORK_CONFIG_VIEW_H_ |
| OLD | NEW |