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

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

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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/webui/chromeos/login/enterprise_oauth_enrollment_scr een_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/enterprise_oauth_enrollment_scr een_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 base::Unretained(this)); 380 base::Unretained(this));
381 ResetAuth(); 381 ResetAuth();
382 } 382 }
383 383
384 void EnterpriseOAuthEnrollmentScreenHandler::EnrollAfterLogin() { 384 void EnterpriseOAuthEnrollmentScreenHandler::EnrollAfterLogin() {
385 DCHECK(!user_.empty()); 385 DCHECK(!user_.empty());
386 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, 386 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment,
387 policy::kMetricEnrollmentStarted, 387 policy::kMetricEnrollmentStarted,
388 policy::kMetricEnrollmentSize); 388 policy::kMetricEnrollmentSize);
389 Profile* profile = Profile::FromBrowserContext( 389 Profile* profile = Profile::FromBrowserContext(
390 web_ui()->tab_contents()->GetBrowserContext()); 390 web_ui()->web_contents()->GetBrowserContext());
391 oauth_fetcher_.reset( 391 oauth_fetcher_.reset(
392 new GaiaOAuthFetcher(this, 392 new GaiaOAuthFetcher(this,
393 profile->GetRequestContext(), 393 profile->GetRequestContext(),
394 profile, 394 profile,
395 GaiaConstants::kDeviceManagementServiceOAuth)); 395 GaiaConstants::kDeviceManagementServiceOAuth));
396 oauth_fetcher_->SetAutoFetchLimit( 396 oauth_fetcher_->SetAutoFetchLimit(
397 GaiaOAuthFetcher::OAUTH2_SERVICE_ACCESS_TOKEN); 397 GaiaOAuthFetcher::OAUTH2_SERVICE_ACCESS_TOKEN);
398 oauth_fetcher_->StartGetOAuthTokenRequest(); 398 oauth_fetcher_->StartGetOAuthTokenRequest();
399 399
400 ShowWorking(IDS_ENTERPRISE_ENROLLMENT_WORKING); 400 ShowWorking(IDS_ENTERPRISE_ENROLLMENT_WORKING);
(...skipping 27 matching lines...) Expand all
428 message_value); 428 message_value);
429 } 429 }
430 430
431 void EnterpriseOAuthEnrollmentScreenHandler::ResetAuth() { 431 void EnterpriseOAuthEnrollmentScreenHandler::ResetAuth() {
432 oauth_fetcher_.reset(); 432 oauth_fetcher_.reset();
433 433
434 if (browsing_data_remover_) 434 if (browsing_data_remover_)
435 return; 435 return;
436 436
437 Profile* profile = Profile::FromBrowserContext( 437 Profile* profile = Profile::FromBrowserContext(
438 web_ui()->tab_contents()->GetBrowserContext()); 438 web_ui()->web_contents()->GetBrowserContext());
439 browsing_data_remover_ = 439 browsing_data_remover_ =
440 new BrowsingDataRemover(profile, 440 new BrowsingDataRemover(profile,
441 BrowsingDataRemover::EVERYTHING, 441 BrowsingDataRemover::EVERYTHING,
442 base::Time()); 442 base::Time());
443 browsing_data_remover_->AddObserver(this); 443 browsing_data_remover_->AddObserver(this);
444 browsing_data_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); 444 browsing_data_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA);
445 } 445 }
446 446
447 void EnterpriseOAuthEnrollmentScreenHandler::RevokeTokens() { 447 void EnterpriseOAuthEnrollmentScreenHandler::RevokeTokens() {
448 Profile* profile = Profile::FromBrowserContext( 448 Profile* profile = Profile::FromBrowserContext(
449 web_ui()->tab_contents()->GetBrowserContext()); 449 web_ui()->web_contents()->GetBrowserContext());
450 450
451 if (!access_token_.empty()) { 451 if (!access_token_.empty()) {
452 new TokenRevoker(access_token_, access_token_secret_, profile); 452 new TokenRevoker(access_token_, access_token_secret_, profile);
453 access_token_.clear(); 453 access_token_.clear();
454 } 454 }
455 455
456 if (!wrap_token_.empty()) { 456 if (!wrap_token_.empty()) {
457 new TokenRevoker(wrap_token_, "", profile); 457 new TokenRevoker(wrap_token_, "", profile);
458 wrap_token_.clear(); 458 wrap_token_.clear();
459 } 459 }
(...skipping 23 matching lines...) Expand all
483 } 483 }
484 484
485 if (!back_to_signin) { 485 if (!back_to_signin) {
486 // Show a progress spinner while profile creation is resuming. 486 // Show a progress spinner while profile creation is resuming.
487 ShowWorking(IDS_ENTERPRISE_ENROLLMENT_RESUMING_LOGIN); 487 ShowWorking(IDS_ENTERPRISE_ENROLLMENT_RESUMING_LOGIN);
488 } 488 }
489 controller_->OnConfirmationClosed(back_to_signin); 489 controller_->OnConfirmationClosed(back_to_signin);
490 } 490 }
491 491
492 } // namespace chromeos 492 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc ('k') | chrome/browser/ui/webui/chromeos/login/oobe_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698