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

Side by Side Diff: chrome/browser/ui/login/login_prompt.cc

Issue 8983010: Convert WebContents to return a content::NavigationController instead of the implementation. Upda... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 dialog_ = dialog; 271 dialog_ = dialog;
272 } 272 }
273 273
274 void LoginHandler::NotifyAuthNeeded() { 274 void LoginHandler::NotifyAuthNeeded() {
275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
276 if (WasAuthHandled()) 276 if (WasAuthHandled())
277 return; 277 return;
278 278
279 content::NotificationService* service = 279 content::NotificationService* service =
280 content::NotificationService::current(); 280 content::NotificationService::current();
281 NavigationController* controller = NULL; 281 content::NavigationController* controller = NULL;
282 282
283 TabContents* requesting_contents = GetTabContentsForLogin(); 283 TabContents* requesting_contents = GetTabContentsForLogin();
284 if (requesting_contents) 284 if (requesting_contents)
285 controller = &requesting_contents->GetController(); 285 controller = &requesting_contents->GetController();
286 286
287 LoginNotificationDetails details(this); 287 LoginNotificationDetails details(this);
288 288
289 service->Notify(chrome::NOTIFICATION_AUTH_NEEDED, 289 service->Notify(chrome::NOTIFICATION_AUTH_NEEDED,
290 content::Source<content::NavigationController>(controller), 290 content::Source<content::NavigationController>(controller),
291 content::Details<LoginNotificationDetails>(&details)); 291 content::Details<LoginNotificationDetails>(&details));
292 } 292 }
293 293
294 void LoginHandler::NotifyAuthCancelled() { 294 void LoginHandler::NotifyAuthCancelled() {
295 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 295 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
296 DCHECK(WasAuthHandled()); 296 DCHECK(WasAuthHandled());
297 297
298 content::NotificationService* service = 298 content::NotificationService* service =
299 content::NotificationService::current(); 299 content::NotificationService::current();
300 NavigationController* controller = NULL; 300 content::NavigationController* controller = NULL;
301 301
302 TabContents* requesting_contents = GetTabContentsForLogin(); 302 TabContents* requesting_contents = GetTabContentsForLogin();
303 if (requesting_contents) 303 if (requesting_contents)
304 controller = &requesting_contents->GetController(); 304 controller = &requesting_contents->GetController();
305 305
306 LoginNotificationDetails details(this); 306 LoginNotificationDetails details(this);
307 307
308 service->Notify(chrome::NOTIFICATION_AUTH_CANCELLED, 308 service->Notify(chrome::NOTIFICATION_AUTH_CANCELLED,
309 content::Source<content::NavigationController>(controller), 309 content::Source<content::NavigationController>(controller),
310 content::Details<LoginNotificationDetails>(&details)); 310 content::Details<LoginNotificationDetails>(&details));
311 } 311 }
312 312
313 void LoginHandler::NotifyAuthSupplied(const string16& username, 313 void LoginHandler::NotifyAuthSupplied(const string16& username,
314 const string16& password) { 314 const string16& password) {
315 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 315 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
316 DCHECK(WasAuthHandled()); 316 DCHECK(WasAuthHandled());
317 317
318 TabContents* requesting_contents = GetTabContentsForLogin(); 318 TabContents* requesting_contents = GetTabContentsForLogin();
319 if (!requesting_contents) 319 if (!requesting_contents)
320 return; 320 return;
321 321
322 content::NotificationService* service = 322 content::NotificationService* service =
323 content::NotificationService::current(); 323 content::NotificationService::current();
324 NavigationController* controller = &requesting_contents->GetController(); 324 content::NavigationController* controller =
325 &requesting_contents->GetController();
325 AuthSuppliedLoginNotificationDetails details(this, username, password); 326 AuthSuppliedLoginNotificationDetails details(this, username, password);
326 327
327 service->Notify( 328 service->Notify(
328 chrome::NOTIFICATION_AUTH_SUPPLIED, 329 chrome::NOTIFICATION_AUTH_SUPPLIED,
329 content::Source<content::NavigationController>(controller), 330 content::Source<content::NavigationController>(controller),
330 content::Details<AuthSuppliedLoginNotificationDetails>(&details)); 331 content::Details<AuthSuppliedLoginNotificationDetails>(&details));
331 } 332 }
332 333
333 void LoginHandler::ReleaseSoon() { 334 void LoginHandler::ReleaseSoon() {
334 if (!TestAndSetAuthHandled()) { 335 if (!TestAndSetAuthHandled()) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 481
481 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, 482 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
482 net::URLRequest* request) { 483 net::URLRequest* request) {
483 LoginHandler* handler = LoginHandler::Create(auth_info, request); 484 LoginHandler* handler = LoginHandler::Create(auth_info, request);
484 BrowserThread::PostTask( 485 BrowserThread::PostTask(
485 BrowserThread::UI, FROM_HERE, 486 BrowserThread::UI, FROM_HERE,
486 base::Bind(&LoginDialogCallback, request->url(), 487 base::Bind(&LoginDialogCallback, request->url(),
487 make_scoped_refptr(auth_info), make_scoped_refptr(handler))); 488 make_scoped_refptr(auth_info), make_scoped_refptr(handler)));
488 return handler; 489 return handler;
489 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698