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

Side by Side Diff: ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm

Issue 2920853006: Removes usage of signin APIs that return scoped_nsobjects. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/settings/accounts_collection_view_controller.h" 5 #import "ios/chrome/browser/ui/settings/accounts_collection_view_controller.h"
6 6
7 #import "base/mac/foundation_util.h" 7 #import "base/mac/foundation_util.h"
8 #include "base/metrics/user_metrics.h" 8 #include "base/metrics/user_metrics.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 441
442 - (void)showGoogleActivitySettings { 442 - (void)showGoogleActivitySettings {
443 if ([_alertCoordinator isVisible]) 443 if ([_alertCoordinator isVisible])
444 return; 444 return;
445 base::RecordAction(base::UserMetricsAction( 445 base::RecordAction(base::UserMetricsAction(
446 "Signin_AccountSettings_GoogleActivityControlsClicked")); 446 "Signin_AccountSettings_GoogleActivityControlsClicked"));
447 UINavigationController* settingsDetails = 447 UINavigationController* settingsDetails =
448 ios::GetChromeBrowserProvider() 448 ios::GetChromeBrowserProvider()
449 ->GetChromeIdentityService() 449 ->GetChromeIdentityService()
450 ->NewWebAndAppSettingDetails( 450 ->CreateWebAndAppSettingDetailsController(
451 [self authService]->GetAuthenticatedIdentity(), self); 451 [self authService]->GetAuthenticatedIdentity(), self);
452 UIImage* closeIcon = [ChromeIcon closeIcon]; 452 UIImage* closeIcon = [ChromeIcon closeIcon];
453 SEL action = @selector(closeGoogleActivitySettings:); 453 SEL action = @selector(closeGoogleActivitySettings:);
454 [settingsDetails.topViewController navigationItem].leftBarButtonItem = 454 [settingsDetails.topViewController navigationItem].leftBarButtonItem =
455 [ChromeIcon templateBarButtonItemWithImage:closeIcon 455 [ChromeIcon templateBarButtonItemWithImage:closeIcon
456 target:self 456 target:self
457 action:action]; 457 action:action];
458 [self presentViewController:settingsDetails animated:YES completion:nil]; 458 [self presentViewController:settingsDetails animated:YES completion:nil];
459 459
460 // Keep a weak reference on the settings details, to be able to dismiss it 460 // Keep a weak reference on the settings details, to be able to dismiss it
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 if (success && _closeSettingsOnAddAccount) { 502 if (success && _closeSettingsOnAddAccount) {
503 GenericChromeCommand* closeSettingsCommand = 503 GenericChromeCommand* closeSettingsCommand =
504 [[GenericChromeCommand alloc] initWithTag:IDC_CLOSE_SETTINGS]; 504 [[GenericChromeCommand alloc] initWithTag:IDC_CLOSE_SETTINGS];
505 [self chromeExecuteCommand:closeSettingsCommand]; 505 [self chromeExecuteCommand:closeSettingsCommand];
506 } 506 }
507 } 507 }
508 508
509 - (void)showAccountDetails:(ChromeIdentity*)identity { 509 - (void)showAccountDetails:(ChromeIdentity*)identity {
510 if ([_alertCoordinator isVisible]) 510 if ([_alertCoordinator isVisible])
511 return; 511 return;
512 UIViewController* accountDetails = ios::GetChromeBrowserProvider() 512 UIViewController* accountDetails =
513 ->GetChromeIdentityService() 513 ios::GetChromeBrowserProvider()
514 ->NewAccountDetails(identity, self); 514 ->GetChromeIdentityService()
515 ->CreateAccountDetailsController(identity, self);
515 if (!accountDetails) { 516 if (!accountDetails) {
516 // Failed to create a new account details. Ignored. 517 // Failed to create a new account details. Ignored.
517 return; 518 return;
518 } 519 }
519 [self presentViewController:accountDetails animated:YES completion:nil]; 520 [self presentViewController:accountDetails animated:YES completion:nil];
520 521
521 // Keep a weak reference on the account details, to be able to dismiss it 522 // Keep a weak reference on the account details, to be able to dismiss it
522 // when the primary account is removed. 523 // when the primary account is removed.
523 _settingsDetails = accountDetails; 524 _settingsDetails = accountDetails;
524 } 525 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 [self updateAccountItem:item withIdentity:identity]; 654 [self updateAccountItem:item withIdentity:identity];
654 NSIndexPath* indexPath = [self.collectionViewModel indexPathForItem:item]; 655 NSIndexPath* indexPath = [self.collectionViewModel indexPathForItem:item];
655 [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]]; 656 [self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]];
656 } 657 }
657 658
658 - (void)onChromeIdentityServiceWillBeDestroyed { 659 - (void)onChromeIdentityServiceWillBeDestroyed {
659 _identityServiceObserver.reset(); 660 _identityServiceObserver.reset();
660 } 661 }
661 662
662 @end 663 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698