| 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/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Called by CaptivePortalView when URL loading was redirected from the | 52 // Called by CaptivePortalView when URL loading was redirected from the |
| 53 // original URL. | 53 // original URL. |
| 54 void OnRedirected(); | 54 void OnRedirected(); |
| 55 | 55 |
| 56 // Called by CaptivePortalView when origin URL is loaded without any | 56 // Called by CaptivePortalView when origin URL is loaded without any |
| 57 // redirections. | 57 // redirections. |
| 58 void OnOriginalURLLoaded(); | 58 void OnOriginalURLLoaded(); |
| 59 | 59 |
| 60 // Overridden from views::WidgetObserver: | 60 // Overridden from views::WidgetObserver: |
| 61 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 61 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 friend class CaptivePortalWindowTest; |
| 65 |
| 66 // Possible transitions between states: |
| 67 // |
| 68 // wp(ShowIfRedirected(), WAITING_FOR_REDIRECTION) = IDLE |
| 69 // wp(Show(), DISPLAYED) = IDLE | WAITING_FOR_REDIRECTION |
| 70 // wp(Close(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED |
| 71 // wp(OnRedirected(), DISPLAYED) = WAITING_FOR_REDIRECTION |
| 72 // wp(OnOriginalURLLoaded(), IDLE) = WAITING_FOR_REDIRECTION | DISPLAYED |
| 73 // |
| 74 // where wp(E, S) is a weakest precondition (initial state) such |
| 75 // that after execution of E the system will be surely in the state S. |
| 76 enum State { |
| 77 STATE_IDLE = 0, |
| 78 STATE_WAITING_FOR_REDIRECTION, |
| 79 STATE_DISPLAYED, |
| 80 STATE_UNKNOWN |
| 81 }; |
| 82 |
| 83 // Initializes |captive_portal_view_| if it is not initialized and |
| 84 // starts loading Captive Portal redirect URL. |
| 85 void InitCaptivePortalView(); |
| 86 |
| 87 // Returns symbolic state name based on internal state. |
| 88 State GetState() const; |
| 89 |
| 64 Delegate* delegate_; | 90 Delegate* delegate_; |
| 65 views::Widget* widget_; | 91 views::Widget* widget_; |
| 66 scoped_ptr<CaptivePortalView> captive_portal_view_; | 92 scoped_ptr<CaptivePortalView> captive_portal_view_; |
| 67 gfx::NativeWindow parent_; | 93 gfx::NativeWindow parent_; |
| 68 | 94 |
| 69 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowProxy); | 95 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowProxy); |
| 70 }; | 96 }; |
| 71 | 97 |
| 72 } // namespace chromeos | 98 } // namespace chromeos |
| 73 | 99 |
| 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAPTIVE_PORTAL_WINDOW_PROXY_H_ | 100 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CAPTIVE_PORTAL_WINDOW_PROXY_H_ |
| OLD | NEW |