| 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 "chromeos/network/network_handler.h" | 10 #include "chromeos/network/network_handler.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void CaptivePortalView::NavigationStateChanged( | 77 void CaptivePortalView::NavigationStateChanged( |
| 78 const content::WebContents* source, unsigned changed_flags) { | 78 const content::WebContents* source, unsigned changed_flags) { |
| 79 SimpleWebViewDialog::NavigationStateChanged(source, changed_flags); | 79 SimpleWebViewDialog::NavigationStateChanged(source, changed_flags); |
| 80 | 80 |
| 81 // Naive way to determine the redirection. This won't be needed after portal | 81 // Naive way to determine the redirection. This won't be needed after portal |
| 82 // detection will be done on the Chrome side. | 82 // detection will be done on the Chrome side. |
| 83 GURL url = source->GetLastCommittedURL(); | 83 GURL url = source->GetLastCommittedURL(); |
| 84 // Note, |url| will be empty for "client3.google.com/generate_204" page. | 84 // Note, |url| will be empty for "client3.google.com/generate_204" page. |
| 85 if (!redirected_ && url != GURL::EmptyGURL() && | 85 if (!redirected_ && url != GURL::EmptyGURL() && |
| 86 url != GURL(CaptivePortalStartURL())) { | 86 url != GURL(CaptivePortalStartURL())) { |
| 87 DLOG(INFO) << CaptivePortalStartURL() << " vs " << url.spec(); | |
| 88 redirected_ = true; | 87 redirected_ = true; |
| 89 proxy_->OnRedirected(); | 88 proxy_->OnRedirected(); |
| 90 } | 89 } |
| 91 } | 90 } |
| 92 | 91 |
| 93 void CaptivePortalView::LoadingStateChanged(content::WebContents* source) { | 92 void CaptivePortalView::LoadingStateChanged(content::WebContents* source, |
| 94 SimpleWebViewDialog::LoadingStateChanged(source); | 93 bool to_different_document) { |
| 94 SimpleWebViewDialog::LoadingStateChanged(source, to_different_document); |
| 95 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. | 95 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. |
| 96 // Disable this heuristic as it has false positives. | 96 // Disable this heuristic as it has false positives. |
| 97 // Relying on just shill portal check to close dialog is fine. | 97 // Relying on just shill portal check to close dialog is fine. |
| 98 // if (!is_loading && !redirected_) | 98 // if (!is_loading && !redirected_) |
| 99 // proxy_->OnOriginalURLLoaded(); | 99 // proxy_->OnOriginalURLLoaded(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace chromeos | 102 } // namespace chromeos |
| OLD | NEW |