Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: chrome/browser/captive_portal/captive_portal_tab_observer.h

Issue 10020051: Open a login tab on captive portal detection on SSL loads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_OBSERVER_H_
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_OBSERVER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "content/public/browser/web_contents_observer.h"
12
13 namespace captive_portal {
14
15 class CaptivePortalTabHelper;
16
17 // A WebContentsObserver that simplifies the messages a CaptivePortalTabHelper
18 // receives. It filters non-main-frame resource loads, and treats the commit
19 // of an error page as a single event, rather than as 3 (ProvisionalLoadFail,
20 // DidStartProvisionalLoad, DidCommit).
21 //
22 // TODO(mmenke): Support redirects. Probably won't cause us to succussfully
23 // detect captive portals we wouldn't have handled anyways, but
24 // may reduce the number of unnecessary captive portal checks we
25 // run.
26 class CaptivePortalTabObserver : public content::WebContentsObserver {
27 public:
28 CaptivePortalTabObserver(CaptivePortalTabHelper* tab_helper,
29 content::WebContents* web_contents);
30 virtual ~CaptivePortalTabObserver();
31
32 // content::WebContentsObserver:
33 virtual void DidStartProvisionalLoadForFrame(
34 int64 frame_id,
35 bool is_main_frame,
36 const GURL& validated_url,
37 bool is_error_page,
38 content::RenderViewHost* render_view_host) OVERRIDE;
39
40 virtual void DidCommitProvisionalLoadForFrame(
41 int64 frame_id,
42 bool is_main_frame,
43 const GURL& url,
44 content::PageTransition transition_type) OVERRIDE;
45
46 virtual void DidFailProvisionalLoad(
47 int64 frame_id,
48 bool is_main_frame,
49 const GURL& validated_url,
50 int error_code,
51 const string16& error_description) OVERRIDE;
52
53 virtual void DidStopLoading() OVERRIDE;
54
55 content::WebContents* web_contents() const {
56 return content::WebContentsObserver::web_contents();
57 }
58
59 private:
60 // Our owner.
61 CaptivePortalTabHelper* tab_helper_;
62
63 // If a load has failed, and we're loading an error page, the error code
64 // associated with the error page we're loading. net::OK, otherwise.
65 int pending_error_code_;
66
67 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabObserver);
68 };
69
70 } // namespace captive_portal
71
72 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698