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 #include "chrome/browser/chromeos/login/captive_portal_view.h" | 5 #include "chrome/browser/chromeos/login/captive_portal_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/captive_portal/captive_portal_detector.h" | 8 #include "chrome/browser/captive_portal/captive_portal_detector.h" |
9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" | 9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" |
10 #include "chrome/browser/chromeos/net/connectivity_state_helper.h" | 10 #include "chrome/browser/chromeos/net/connectivity_state_helper.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 bool CaptivePortalView::ShouldShowWindowTitle() const { | 63 bool CaptivePortalView::ShouldShowWindowTitle() const { |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 void CaptivePortalView::NavigationStateChanged( | 67 void CaptivePortalView::NavigationStateChanged( |
68 const content::WebContents* source, unsigned changed_flags) { | 68 const content::WebContents* source, unsigned changed_flags) { |
69 SimpleWebViewDialog::NavigationStateChanged(source, changed_flags); | 69 SimpleWebViewDialog::NavigationStateChanged(source, changed_flags); |
70 | 70 |
71 // Naive way to determine the redirection. This won't be needed after portal | 71 // Naive way to determine the redirection. This won't be needed after portal |
72 // detection will be done on the Chrome side. | 72 // detection will be done on the Chrome side. |
73 GURL url = source->GetURL(); | 73 GURL url = source->GetLastCommittedURL(); |
74 // Note, |url| will be empty for "client3.google.com/generate_204" page. | 74 // Note, |url| will be empty for "client3.google.com/generate_204" page. |
75 if (!redirected_ && url != GURL::EmptyGURL() && | 75 if (!redirected_ && url != GURL::EmptyGURL() && |
76 url != GURL(CaptivePortalStartURL())) { | 76 url != GURL(CaptivePortalStartURL())) { |
77 DLOG(INFO) << CaptivePortalStartURL() << " vs " << url.spec(); | 77 DLOG(INFO) << CaptivePortalStartURL() << " vs " << url.spec(); |
78 redirected_ = true; | 78 redirected_ = true; |
79 proxy_->OnRedirected(); | 79 proxy_->OnRedirected(); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 void CaptivePortalView::LoadingStateChanged(content::WebContents* source) { | 83 void CaptivePortalView::LoadingStateChanged(content::WebContents* source) { |
84 SimpleWebViewDialog::LoadingStateChanged(source); | 84 SimpleWebViewDialog::LoadingStateChanged(source); |
85 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. | 85 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. |
86 // Disable this heuristic as it has false positives. | 86 // Disable this heuristic as it has false positives. |
87 // Relying on just shill portal check to close dialog is fine. | 87 // Relying on just shill portal check to close dialog is fine. |
88 // if (!is_loading && !redirected_) | 88 // if (!is_loading && !redirected_) |
89 // proxy_->OnOriginalURLLoaded(); | 89 // proxy_->OnOriginalURLLoaded(); |
90 } | 90 } |
91 | 91 |
92 } // namespace chromeos | 92 } // namespace chromeos |
OLD | NEW |