| 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_LOGIN_CAPTIVE_PORTAL_WINDOW_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_CAPTIVE_PORTAL_WINDOW_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CAPTIVE_PORTAL_WINDOW_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 66 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
| 67 virtual void OnWidgetDestroyed(views::Widget* widget) OVERRIDE; |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 friend class CaptivePortalWindowTest; | 70 friend class CaptivePortalWindowTest; |
| 69 | 71 |
| 70 // Possible transitions between states: | 72 // Possible transitions between states: |
| 71 // | 73 // |
| 72 // wp(ShowIfRedirected(), WAITING_FOR_REDIRECTION) = IDLE | 74 // wp(ShowIfRedirected(), WAITING_FOR_REDIRECTION) = IDLE |
| 73 // wp(Show(), DISPLAYED) = IDLE | WAITING_FOR_REDIRECTION | 75 // wp(Show(), DISPLAYED) = IDLE | WAITING_FOR_REDIRECTION |
| 74 // wp(Close(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED | 76 // wp(Close(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED |
| 75 // wp(OnRedirected(), DISPLAYED) = WAITING_FOR_REDIRECTION | 77 // wp(OnRedirected(), DISPLAYED) = WAITING_FOR_REDIRECTION |
| 76 // wp(OnOriginalURLLoaded(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED | 78 // wp(OnOriginalURLLoaded(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED |
| 77 // | 79 // |
| 78 // where wp(E, S) is a weakest precondition (initial state) such | 80 // where wp(E, S) is a weakest precondition (initial state) such |
| 79 // that after execution of E the system will be surely in the state S. | 81 // that after execution of E the system will be surely in the state S. |
| 80 enum State { | 82 enum State { |
| 81 STATE_IDLE = 0, | 83 STATE_IDLE = 0, |
| 82 STATE_WAITING_FOR_REDIRECTION, | 84 STATE_WAITING_FOR_REDIRECTION, |
| 83 STATE_DISPLAYED, | 85 STATE_DISPLAYED, |
| 84 STATE_UNKNOWN | 86 STATE_UNKNOWN |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 // Initializes |captive_portal_view_| if it is not initialized and | 89 // Initializes |captive_portal_view_| if it is not initialized and |
| 88 // starts loading Captive Portal redirect URL. | 90 // starts loading Captive Portal redirect URL. |
| 89 void InitCaptivePortalView(); | 91 void InitCaptivePortalView(); |
| 90 | 92 |
| 91 // Returns symbolic state name based on internal state. | 93 // Returns symbolic state name based on internal state. |
| 92 State GetState() const; | 94 State GetState() const; |
| 93 | 95 |
| 96 // When |widget| is not NULL and the same as |widget_| stops to observe |
| 97 // notifications from |widget_| and resets it. |
| 98 void DetachFromWidget(views::Widget* widget); |
| 99 |
| 94 // Not owned by this class. | 100 // Not owned by this class. |
| 95 Delegate* delegate_; | 101 Delegate* delegate_; |
| 96 // Not owned by this class. | 102 // Not owned by this class. |
| 97 views::Widget* widget_; | 103 views::Widget* widget_; |
| 98 scoped_ptr<CaptivePortalView> captive_portal_view_; | 104 scoped_ptr<CaptivePortalView> captive_portal_view_; |
| 99 | 105 |
| 100 // Not owned by this class. | 106 // Not owned by this class. |
| 101 content::WebContents* web_contents_; | 107 content::WebContents* web_contents_; |
| 102 | 108 |
| 103 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowProxy); | 109 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowProxy); |
| 104 }; | 110 }; |
| 105 | 111 |
| 106 } // namespace chromeos | 112 } // namespace chromeos |
| 107 | 113 |
| 108 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAPTIVE_PORTAL_WINDOW_PROXY_H_ | 114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAPTIVE_PORTAL_WINDOW_PROXY_H_ |
| OLD | NEW |