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

Side by Side Diff: chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc

Issue 2087643003: Move web modal dialog manager files into the constrained_window component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to gyp files, IWYU for #ifdef (OS_MACOSX). Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_views_mac_browsertest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/captive_portal_window_proxy.h" 5 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "chrome/browser/chromeos/login/ui/captive_portal_view.h" 8 #include "chrome/browser/chromeos/login/ui/captive_portal_view.h"
9 #include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h" 9 #include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" 10 #include "chrome/browser/chromeos/profiles/profile_helper.h"
11 #include "components/constrained_window/constrained_window_views.h"
11 #include "components/web_modal/web_contents_modal_dialog_host.h" 12 #include "components/web_modal/web_contents_modal_dialog_host.h"
12 #include "components/web_modal/web_contents_modal_dialog_manager.h" 13 #include "components/web_modal/web_contents_modal_dialog_manager.h"
13 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 14 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 16
16 namespace { 17 namespace {
17 18
18 // The captive portal dialog is system-modal, but uses the web-content-modal 19 // The captive portal dialog is system-modal, but uses the web-content-modal
19 // dialog manager (odd) and requires this atypical dialog widget initialization. 20 // dialog manager (odd) and requires this atypical dialog widget initialization.
20 views::Widget* CreateWindowAsFramelessChild(views::WidgetDelegate* delegate, 21 views::Widget* CreateWindowAsFramelessChild(views::WidgetDelegate* delegate,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 InitCaptivePortalView(); 75 InitCaptivePortalView();
75 76
76 CaptivePortalView* portal = captive_portal_view_.release(); 77 CaptivePortalView* portal = captive_portal_view_.release();
77 auto* manager = 78 auto* manager =
78 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_); 79 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_);
79 widget_ = CreateWindowAsFramelessChild( 80 widget_ = CreateWindowAsFramelessChild(
80 portal, 81 portal,
81 manager->delegate()->GetWebContentsModalDialogHost()->GetHostView()); 82 manager->delegate()->GetWebContentsModalDialogHost()->GetHostView());
82 portal->Init(); 83 portal->Init();
83 widget_->AddObserver(this); 84 widget_->AddObserver(this);
84 manager->ShowModalDialog(widget_->GetNativeView()); 85 constrained_window::ShowModalDialog(widget_->GetNativeView(), web_contents_);
85 } 86 }
86 87
87 void CaptivePortalWindowProxy::Close() { 88 void CaptivePortalWindowProxy::Close() {
88 if (GetState() == STATE_DISPLAYED) 89 if (GetState() == STATE_DISPLAYED)
89 widget_->Close(); 90 widget_->Close();
90 captive_portal_view_.reset(); 91 captive_portal_view_.reset();
91 captive_portal_view_for_testing_ = NULL; 92 captive_portal_view_for_testing_ = NULL;
92 } 93 }
93 94
94 void CaptivePortalWindowProxy::OnRedirected() { 95 void CaptivePortalWindowProxy::OnRedirected() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 154 }
154 155
155 void CaptivePortalWindowProxy::DetachFromWidget(views::Widget* widget) { 156 void CaptivePortalWindowProxy::DetachFromWidget(views::Widget* widget) {
156 if (!widget_ || widget_ != widget) 157 if (!widget_ || widget_ != widget)
157 return; 158 return;
158 widget_->RemoveObserver(this); 159 widget_->RemoveObserver(this);
159 widget_ = NULL; 160 widget_ = NULL;
160 } 161 }
161 162
162 } // namespace chromeos 163 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_views_mac_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698