OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_NET_NETWORK_PORTAL_WEB_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_WEB_DIALOG_H_ |
6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_WEB_DIALOG_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_WEB_DIALOG_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" | 10 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" |
11 #include "ui/web_dialogs/web_dialog_delegate.h" | 11 #include "ui/web_dialogs/web_dialog_delegate.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 class Widget; | 14 class Widget; |
15 } | 15 } |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 // This is the modal Web dialog to display captive portal login page. | 19 // This is the modal Web dialog to display captive portal login page. |
20 // It is automatically closed when successful authorization is detected. | 20 // It is automatically closed when successful authorization is detected. |
21 class NetworkPortalWebDialog : public ui::WebDialogDelegate { | 21 class NetworkPortalWebDialog : public ui::WebDialogDelegate { |
22 public: | 22 public: |
23 explicit NetworkPortalWebDialog( | 23 explicit NetworkPortalWebDialog( |
24 base::WeakPtr<NetworkPortalNotificationController> controller); | 24 base::WeakPtr<NetworkPortalNotificationController> controller); |
25 virtual ~NetworkPortalWebDialog(); | 25 ~NetworkPortalWebDialog() override; |
26 | 26 |
27 void SetWidget(views::Widget* widget); | 27 void SetWidget(views::Widget* widget); |
28 void Close(); | 28 void Close(); |
29 | 29 |
30 private: | 30 private: |
31 // ui::WebDialogDelegate: | 31 // ui::WebDialogDelegate: |
32 virtual ui::ModalType GetDialogModalType() const override; | 32 ui::ModalType GetDialogModalType() const override; |
33 virtual base::string16 GetDialogTitle() const override; | 33 base::string16 GetDialogTitle() const override; |
34 virtual GURL GetDialogContentURL() const override; | 34 GURL GetDialogContentURL() const override; |
35 virtual void GetWebUIMessageHandlers( | 35 void GetWebUIMessageHandlers( |
36 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 36 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
37 virtual void GetDialogSize(gfx::Size* size) const override; | 37 void GetDialogSize(gfx::Size* size) const override; |
38 virtual std::string GetDialogArgs() const override; | 38 std::string GetDialogArgs() const override; |
39 virtual bool CanResizeDialog() const override; | 39 bool CanResizeDialog() const override; |
40 virtual void OnDialogClosed(const std::string& json_retval) override; | 40 void OnDialogClosed(const std::string& json_retval) override; |
41 virtual void OnCloseContents(content::WebContents* source, | 41 void OnCloseContents(content::WebContents* source, |
42 bool* out_close_dialog) override; | 42 bool* out_close_dialog) override; |
43 virtual bool ShouldShowDialogTitle() const override; | 43 bool ShouldShowDialogTitle() const override; |
44 | 44 |
45 base::WeakPtr<NetworkPortalNotificationController> controller_; | 45 base::WeakPtr<NetworkPortalNotificationController> controller_; |
46 | 46 |
47 views::Widget* widget_; | 47 views::Widget* widget_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(NetworkPortalWebDialog); | 49 DISALLOW_COPY_AND_ASSIGN(NetworkPortalWebDialog); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace chromeos | 52 } // namespace chromeos |
53 | 53 |
54 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_WEB_DIALOG_H_ | 54 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_WEB_DIALOG_H_ |
OLD | NEW |