Index: chrome/browser/captive_portal/captive_portal_tab_helper.h |
=================================================================== |
--- chrome/browser/captive_portal/captive_portal_tab_helper.h (revision 151564) |
+++ chrome/browser/captive_portal/captive_portal_tab_helper.h (working copy) |
@@ -13,6 +13,7 @@ |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
#include "content/public/browser/web_contents_observer.h" |
+#include "webkit/glue/resource_type.h" |
class GURL; |
class Profile; |
@@ -35,9 +36,14 @@ |
// to inform the tab's CaptivePortalLoginDetector when the tab is at a captive |
// portal's login page. |
// |
-// TODO(mmenke): Support redirects. Needed for HSTS, which simulates redirects |
-// at the network layer. Also may reduce the number of |
-// unnecessary captive portal checks on high latency connections. |
+// The TabHelper assumes that a WebContents can only have one RenderViewHost |
+// with a provisional load at a time, and tracks only that navigation. This |
+// assumption can be violated in rare cases, for example, a same-site |
+// navigation interrupted by a cross-process navigation started from the |
+// omnibox, may commit before it can be cancelled. In these cases, this class |
+// may pass incorrect messages to the TabReloader, which will, at worst, result |
+// in not opening up a login tab until a second load fails or not automatically |
+// reloading a tab after logging in. |
// |
// For the design doc, see: |
// https://docs.google.com/document/d/1k-gP2sswzYNvryu9NcgN7q5XrsMlUdlUdoW9WRaEmfM/edit |
@@ -90,11 +96,15 @@ |
friend class CaptivePortalTabHelperTest; |
// Called by Observe in response to the corresponding event. |
- void OnRedirect(int64 frame_id, const GURL& new_url); |
+ void OnRedirect(int child_id, |
+ ResourceType::Type resource_type, |
+ const GURL& new_url); |
// Called by Observe in response to the corresponding event. |
void OnCaptivePortalResults(Result previous_result, Result result); |
+ void OnLoadAborted(); |
+ |
// Called to indicate a tab is at, or is navigating to, the captive portal |
// login page. |
void SetIsLoginTab(); |
@@ -102,6 +112,10 @@ |
// |this| takes ownership of |tab_reloader|. |
void SetTabReloaderForTest(CaptivePortalTabReloader* tab_reloader); |
+ const content::RenderViewHost* provisional_render_view_host() const { |
+ return provisional_render_view_host_; |
+ } |
+ |
CaptivePortalTabReloader* GetTabReloaderForTest(); |
// Opens a login tab if the profile's active window doesn't have one already. |
@@ -118,10 +132,11 @@ |
// net::OK, otherwise. |
int pending_error_code_; |
- // The ID of the main frame that's currently provisionally loaded, if there is |
- // one. -1 (unknown/invalid) when there is no such frame, or when an id of |
- // -1 is passed to DidStartProvisionalLoadForFrame. |
- int64 provisional_main_frame_id_; |
+ // The RenderViewHost with a provisional load, if any. Can either be |
+ // the currently displayed RenderViewHost or a pending RenderViewHost for |
+ // cross-process navitations. NULL when there's currently no provisional |
+ // load. |
+ content::RenderViewHost* provisional_render_view_host_; |
content::NotificationRegistrar registrar_; |