| 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_LOGIN_UI_CAPTIVE_PORTAL_WINDOW_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_CAPTIVE_PORTAL_WINDOW_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_CAPTIVE_PORTAL_WINDOW_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_CAPTIVE_PORTAL_WINDOW_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/views/widget/widget_observer.h" | 10 #include "ui/views/widget/widget_observer.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual ~CaptivePortalWindowProxyDelegate() {} | 31 virtual ~CaptivePortalWindowProxyDelegate() {} |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Proxy which manages showing of the window for CaptivePortal sign-in. | 34 // Proxy which manages showing of the window for CaptivePortal sign-in. |
| 35 class CaptivePortalWindowProxy : public views::WidgetObserver { | 35 class CaptivePortalWindowProxy : public views::WidgetObserver { |
| 36 public: | 36 public: |
| 37 typedef CaptivePortalWindowProxyDelegate Delegate; | 37 typedef CaptivePortalWindowProxyDelegate Delegate; |
| 38 | 38 |
| 39 CaptivePortalWindowProxy(Delegate* delegate, | 39 CaptivePortalWindowProxy(Delegate* delegate, |
| 40 content::WebContents* web_contents); | 40 content::WebContents* web_contents); |
| 41 virtual ~CaptivePortalWindowProxy(); | 41 ~CaptivePortalWindowProxy() override; |
| 42 | 42 |
| 43 // Shows captive portal window only after a redirection has happened. So it is | 43 // Shows captive portal window only after a redirection has happened. So it is |
| 44 // safe to call this method, when the caller isn't 100% sure that the network | 44 // safe to call this method, when the caller isn't 100% sure that the network |
| 45 // is in the captive portal state. | 45 // is in the captive portal state. |
| 46 // Subsequent call to this method would reuses existing view | 46 // Subsequent call to this method would reuses existing view |
| 47 // but reloads test page (generate_204). | 47 // but reloads test page (generate_204). |
| 48 void ShowIfRedirected(); | 48 void ShowIfRedirected(); |
| 49 | 49 |
| 50 // Forces captive portal window show. | 50 // Forces captive portal window show. |
| 51 void Show(); | 51 void Show(); |
| 52 | 52 |
| 53 // Closes the window. | 53 // Closes the window. |
| 54 void Close(); | 54 void Close(); |
| 55 | 55 |
| 56 // Called by CaptivePortalView when URL loading was redirected from the | 56 // Called by CaptivePortalView when URL loading was redirected from the |
| 57 // original URL. | 57 // original URL. |
| 58 void OnRedirected(); | 58 void OnRedirected(); |
| 59 | 59 |
| 60 // Called by CaptivePortalView when origin URL is loaded without any | 60 // Called by CaptivePortalView when origin URL is loaded without any |
| 61 // redirections. | 61 // redirections. |
| 62 void OnOriginalURLLoaded(); | 62 void OnOriginalURLLoaded(); |
| 63 | 63 |
| 64 // Overridden from views::WidgetObserver: | 64 // Overridden from views::WidgetObserver: |
| 65 virtual void OnWidgetClosing(views::Widget* widget) override; | 65 void OnWidgetClosing(views::Widget* widget) override; |
| 66 virtual void OnWidgetDestroying(views::Widget* widget) override; | 66 void OnWidgetDestroying(views::Widget* widget) override; |
| 67 virtual void OnWidgetDestroyed(views::Widget* widget) override; | 67 void OnWidgetDestroyed(views::Widget* widget) override; |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 friend class CaptivePortalWindowTest; | 70 friend class CaptivePortalWindowTest; |
| 71 friend class SimpleWebViewDialogTest; | 71 friend class SimpleWebViewDialogTest; |
| 72 | 72 |
| 73 // Possible transitions between states: | 73 // Possible transitions between states: |
| 74 // | 74 // |
| 75 // wp(ShowIfRedirected(), WAITING_FOR_REDIRECTION) = IDLE | 75 // wp(ShowIfRedirected(), WAITING_FOR_REDIRECTION) = IDLE |
| 76 // wp(Show(), DISPLAYED) = IDLE | WAITING_FOR_REDIRECTION | 76 // wp(Show(), DISPLAYED) = IDLE | WAITING_FOR_REDIRECTION |
| 77 // wp(Close(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED | 77 // wp(Close(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 content::WebContents* web_contents_; | 112 content::WebContents* web_contents_; |
| 113 | 113 |
| 114 CaptivePortalView* captive_portal_view_for_testing_; | 114 CaptivePortalView* captive_portal_view_for_testing_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowProxy); | 116 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowProxy); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 } // namespace chromeos | 119 } // namespace chromeos |
| 120 | 120 |
| 121 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_CAPTIVE_PORTAL_WINDOW_PROXY_H_ | 121 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_CAPTIVE_PORTAL_WINDOW_PROXY_H_ |
| OLD | NEW |