| 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 "chromeos/network/network_handler.h" |
| 11 #include "chromeos/network/network_state.h" |
| 12 #include "chromeos/network/network_state_handler.h" |
| 11 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 12 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 const char* CaptivePortalStartURL() { | 20 const char* CaptivePortalStartURL() { |
| 19 return captive_portal::CaptivePortalDetector::kDefaultURL; | 21 return captive_portal::CaptivePortalDetector::kDefaultURL; |
| 20 } | 22 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 bool CaptivePortalView::CanResize() const { | 42 bool CaptivePortalView::CanResize() const { |
| 41 return false; | 43 return false; |
| 42 } | 44 } |
| 43 | 45 |
| 44 ui::ModalType CaptivePortalView::GetModalType() const { | 46 ui::ModalType CaptivePortalView::GetModalType() const { |
| 45 return ui::MODAL_TYPE_SYSTEM; | 47 return ui::MODAL_TYPE_SYSTEM; |
| 46 } | 48 } |
| 47 | 49 |
| 48 string16 CaptivePortalView::GetWindowTitle() const { | 50 string16 CaptivePortalView::GetWindowTitle() const { |
| 49 string16 network_name; | 51 string16 network_name; |
| 50 ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); | 52 const NetworkState* default_network = |
| 51 std::string default_network_name = csh->DefaultNetworkName(); | 53 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
| 54 std::string default_network_name = |
| 55 default_network ? default_network->name() : std::string(); |
| 52 if (!default_network_name.empty()) { | 56 if (!default_network_name.empty()) { |
| 53 network_name = ASCIIToUTF16(default_network_name); | 57 network_name = ASCIIToUTF16(default_network_name); |
| 54 } else { | 58 } else { |
| 55 DLOG(ERROR) | 59 DLOG(ERROR) |
| 56 << "No active/default network, but captive portal window is shown."; | 60 << "No active/default network, but captive portal window is shown."; |
| 57 } | 61 } |
| 58 | 62 |
| 59 return l10n_util::GetStringFUTF16(IDS_LOGIN_CAPTIVE_PORTAL_WINDOW_TITLE, | 63 return l10n_util::GetStringFUTF16(IDS_LOGIN_CAPTIVE_PORTAL_WINDOW_TITLE, |
| 60 network_name); | 64 network_name); |
| 61 } | 65 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 83 void CaptivePortalView::LoadingStateChanged(content::WebContents* source) { | 87 void CaptivePortalView::LoadingStateChanged(content::WebContents* source) { |
| 84 SimpleWebViewDialog::LoadingStateChanged(source); | 88 SimpleWebViewDialog::LoadingStateChanged(source); |
| 85 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. | 89 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. |
| 86 // Disable this heuristic as it has false positives. | 90 // Disable this heuristic as it has false positives. |
| 87 // Relying on just shill portal check to close dialog is fine. | 91 // Relying on just shill portal check to close dialog is fine. |
| 88 // if (!is_loading && !redirected_) | 92 // if (!is_loading && !redirected_) |
| 89 // proxy_->OnOriginalURLLoaded(); | 93 // proxy_->OnOriginalURLLoaded(); |
| 90 } | 94 } |
| 91 | 95 |
| 92 } // namespace chromeos | 96 } // namespace chromeos |
| OLD | NEW |