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

Side by Side Diff: chrome/browser/chromeos/login/captive_portal_view.cc

Issue 63343004: Remove DialogDelegate::UseNewStyle and unused code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore [D]CHECKs and loop scoping. Created 7 years, 1 month 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
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 "ash/wm/custom_frame_view_ash.h"
8 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/captive_portal/captive_portal_detector.h" 8 #include "chrome/browser/captive_portal/captive_portal_detector.h"
10 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" 9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h"
11 #include "chromeos/network/network_handler.h" 10 #include "chromeos/network/network_handler.h"
12 #include "chromeos/network/network_state.h" 11 #include "chromeos/network/network_state.h"
13 #include "chromeos/network/network_state_handler.h" 12 #include "chromeos/network/network_state_handler.h"
14 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
15 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/views/window/dialog_delegate.h" 16 #include "ui/views/window/dialog_delegate.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return l10n_util::GetStringFUTF16(IDS_LOGIN_CAPTIVE_PORTAL_WINDOW_TITLE, 64 return l10n_util::GetStringFUTF16(IDS_LOGIN_CAPTIVE_PORTAL_WINDOW_TITLE,
66 network_name); 65 network_name);
67 } 66 }
68 67
69 bool CaptivePortalView::ShouldShowWindowTitle() const { 68 bool CaptivePortalView::ShouldShowWindowTitle() const {
70 return true; 69 return true;
71 } 70 }
72 71
73 views::NonClientFrameView* CaptivePortalView::CreateNonClientFrameView( 72 views::NonClientFrameView* CaptivePortalView::CreateNonClientFrameView(
74 views::Widget* widget) { 73 views::Widget* widget) {
75 if (views::DialogDelegate::UseNewStyle()) { 74 return views::DialogDelegate::CreateDialogFrameView(widget);
76 const bool force_opaque_border = false;
77 return views::DialogDelegate::CreateNewStyleFrameView(widget,
78 force_opaque_border);
79 }
80 ash::CustomFrameViewAsh* frame = new ash::CustomFrameViewAsh(widget);
81 // Always use "active" look.
82 frame->SetInactiveRenderingDisabled(true);
83 return frame;
84 } 75 }
85 76
86 void CaptivePortalView::NavigationStateChanged( 77 void CaptivePortalView::NavigationStateChanged(
87 const content::WebContents* source, unsigned changed_flags) { 78 const content::WebContents* source, unsigned changed_flags) {
88 SimpleWebViewDialog::NavigationStateChanged(source, changed_flags); 79 SimpleWebViewDialog::NavigationStateChanged(source, changed_flags);
89 80
90 // 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
91 // detection will be done on the Chrome side. 82 // detection will be done on the Chrome side.
92 GURL url = source->GetLastCommittedURL(); 83 GURL url = source->GetLastCommittedURL();
93 // 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.
94 if (!redirected_ && url != GURL::EmptyGURL() && 85 if (!redirected_ && url != GURL::EmptyGURL() &&
95 url != GURL(CaptivePortalStartURL())) { 86 url != GURL(CaptivePortalStartURL())) {
96 DLOG(INFO) << CaptivePortalStartURL() << " vs " << url.spec(); 87 DLOG(INFO) << CaptivePortalStartURL() << " vs " << url.spec();
97 redirected_ = true; 88 redirected_ = true;
98 proxy_->OnRedirected(); 89 proxy_->OnRedirected();
99 } 90 }
100 } 91 }
101 92
102 void CaptivePortalView::LoadingStateChanged(content::WebContents* source) { 93 void CaptivePortalView::LoadingStateChanged(content::WebContents* source) {
103 SimpleWebViewDialog::LoadingStateChanged(source); 94 SimpleWebViewDialog::LoadingStateChanged(source);
104 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. 95 // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned.
105 // Disable this heuristic as it has false positives. 96 // Disable this heuristic as it has false positives.
106 // Relying on just shill portal check to close dialog is fine. 97 // Relying on just shill portal check to close dialog is fine.
107 // if (!is_loading && !redirected_) 98 // if (!is_loading && !redirected_)
108 // proxy_->OnOriginalURLLoaded(); 99 // proxy_->OnOriginalURLLoaded();
109 } 100 }
110 101
111 } // namespace chromeos 102 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698