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

Side by Side Diff: chrome/browser/ui/views/login_prompt_views.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/ui/login/login_prompt.h" 5 #include "chrome/browser/ui/login/login_prompt.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/password_manager/password_manager.h" 9 #include "chrome/browser/password_manager/password_manager.h"
10 #include "chrome/browser/tab_contents/tab_util.h" 10 #include "chrome/browser/tab_contents/tab_util.h"
11 #include "chrome/browser/ui/views/constrained_window_views.h" 11 #include "chrome/browser/ui/views/constrained_window_views.h"
12 #include "chrome/browser/ui/views/login_view.h" 12 #include "chrome/browser/ui/views/login_view.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "components/web_modal/web_contents_modal_dialog_host.h" 14 #include "components/web_modal/web_contents_modal_dialog_host.h"
15 #include "components/web_modal/web_contents_modal_dialog_manager.h" 15 #include "components/web_modal/web_contents_modal_dialog_manager.h"
16 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 16 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_view.h"
21 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
22 #include "net/url_request/url_request.h" 21 #include "net/url_request/url_request.h"
23 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
25 #include "ui/views/window/dialog_delegate.h" 24 #include "ui/views/window/dialog_delegate.h"
26 25
27 using autofill::PasswordForm; 26 using autofill::PasswordForm;
28 using content::BrowserThread; 27 using content::BrowserThread;
29 using content::WebContents; 28 using content::WebContents;
30 using web_modal::WebContentsModalDialogManager; 29 using web_modal::WebContentsModalDialogManager;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // control). However, that's OK since any UI interaction in those functions 151 // control). However, that's OK since any UI interaction in those functions
153 // will occur via an InvokeLater on the UI thread, which is guaranteed 152 // will occur via an InvokeLater on the UI thread, which is guaranteed
154 // to happen after this is called (since this was InvokeLater'd first). 153 // to happen after this is called (since this was InvokeLater'd first).
155 WebContents* requesting_contents = GetWebContentsForLogin(); 154 WebContents* requesting_contents = GetWebContentsForLogin();
156 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 155 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
157 WebContentsModalDialogManager::FromWebContents(requesting_contents); 156 WebContentsModalDialogManager::FromWebContents(requesting_contents);
158 WebContentsModalDialogManagerDelegate* modal_delegate = 157 WebContentsModalDialogManagerDelegate* modal_delegate =
159 web_contents_modal_dialog_manager->delegate(); 158 web_contents_modal_dialog_manager->delegate();
160 CHECK(modal_delegate); 159 CHECK(modal_delegate);
161 dialog_ = views::Widget::CreateWindowAsFramelessChild( 160 dialog_ = views::Widget::CreateWindowAsFramelessChild(
162 this, 161 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView());
163 requesting_contents->GetView()->GetNativeView(),
164 modal_delegate->GetWebContentsModalDialogHost()->GetHostView());
165 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); 162 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView());
166 NotifyAuthNeeded(); 163 NotifyAuthNeeded();
167 } 164 }
168 165
169 virtual void CloseDialog() OVERRIDE { 166 virtual void CloseDialog() OVERRIDE {
170 // The hosting widget may have been freed. 167 // The hosting widget may have been freed.
171 if (dialog_) 168 if (dialog_)
172 dialog_->Close(); 169 dialog_->Close();
173 } 170 }
174 171
175 private: 172 private:
176 friend class base::RefCountedThreadSafe<LoginHandlerViews>; 173 friend class base::RefCountedThreadSafe<LoginHandlerViews>;
177 friend class LoginPrompt; 174 friend class LoginPrompt;
178 175
179 virtual ~LoginHandlerViews() {} 176 virtual ~LoginHandlerViews() {}
180 177
181 // The LoginView that contains the user's login information 178 // The LoginView that contains the user's login information
182 LoginView* login_view_; 179 LoginView* login_view_;
183 180
184 views::Widget* dialog_; 181 views::Widget* dialog_;
185 182
186 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews); 183 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews);
187 }; 184 };
188 185
189 // static 186 // static
190 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, 187 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info,
191 net::URLRequest* request) { 188 net::URLRequest* request) {
192 return new LoginHandlerViews(auth_info, request); 189 return new LoginHandlerViews(auth_info, request);
193 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/importer/import_lock_dialog_view.cc ('k') | chrome/browser/ui/views/pdf_password_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698