| OLD | NEW | 
|    1 // Copyright 2016 The Chromium Authors. All rights reserved. |    1 // Copyright 2016 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/public/provider/chrome/browser/signin/fake_chrome_identity_service.
     h" |    5 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.
     h" | 
|    6  |    6  | 
|    7 #import <Foundation/Foundation.h> |    7 #import <Foundation/Foundation.h> | 
|    8  |    8  | 
|    9 #include "base/mac/scoped_block.h" |    9 #include "base/mac/scoped_block.h" | 
|   10 #include "base/strings/sys_string_conversions.h" |   10 #include "base/strings/sys_string_conversions.h" | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  135  |  135  | 
|  136 FakeChromeIdentityService::~FakeChromeIdentityService() {} |  136 FakeChromeIdentityService::~FakeChromeIdentityService() {} | 
|  137  |  137  | 
|  138 // static |  138 // static | 
|  139 FakeChromeIdentityService* |  139 FakeChromeIdentityService* | 
|  140 FakeChromeIdentityService::GetInstanceFromChromeProvider() { |  140 FakeChromeIdentityService::GetInstanceFromChromeProvider() { | 
|  141   return static_cast<ios::FakeChromeIdentityService*>( |  141   return static_cast<ios::FakeChromeIdentityService*>( | 
|  142       ios::GetChromeBrowserProvider()->GetChromeIdentityService()); |  142       ios::GetChromeBrowserProvider()->GetChromeIdentityService()); | 
|  143 } |  143 } | 
|  144  |  144  | 
|  145 base::scoped_nsobject<UINavigationController> |  145 UINavigationController* | 
|  146 FakeChromeIdentityService::NewAccountDetails( |  146 FakeChromeIdentityService::CreateAccountDetailsController( | 
|  147     ChromeIdentity* identity, |  147     ChromeIdentity* identity, | 
|  148     id<ChromeIdentityBrowserOpener> browser_opener) { |  148     id<ChromeIdentityBrowserOpener> browser_opener) { | 
|  149   base::scoped_nsobject<UIViewController> accountDetailsViewController( |  149   base::scoped_nsobject<UIViewController> accountDetailsViewController( | 
|  150       [[FakeAccountDetailsViewController alloc] initWithIdentity:identity]); |  150       [[FakeAccountDetailsViewController alloc] initWithIdentity:identity]); | 
|  151   base::scoped_nsobject<UINavigationController> navigationController( |  151   base::scoped_nsobject<UINavigationController> navigationController( | 
|  152       [[UINavigationController alloc] |  152       [[UINavigationController alloc] | 
|  153           initWithRootViewController:accountDetailsViewController]); |  153           initWithRootViewController:accountDetailsViewController]); | 
|  154   return navigationController; |  154   return navigationController; | 
|  155 } |  155 } | 
|  156  |  156  | 
|  157 base::scoped_nsobject<ChromeIdentityInteractionManager> |  157 ChromeIdentityInteractionManager* | 
|  158 FakeChromeIdentityService::NewChromeIdentityInteractionManager( |  158 FakeChromeIdentityService::CreateChromeIdentityInteractionManager( | 
|  159     ios::ChromeBrowserState* browser_state, |  159     ios::ChromeBrowserState* browser_state, | 
|  160     id<ChromeIdentityInteractionManagerDelegate> delegate) const { |  160     id<ChromeIdentityInteractionManagerDelegate> delegate) const { | 
|  161   base::scoped_nsobject<ChromeIdentityInteractionManager> manager( |  161   ChromeIdentityInteractionManager* manager = | 
|  162       [[FakeChromeIdentityInteractionManager alloc] init]); |  162       [[[FakeChromeIdentityInteractionManager alloc] init] autorelease]; | 
|  163   manager.get().delegate = delegate; |  163   manager.delegate = delegate; | 
|  164   return manager; |  164   return manager; | 
|  165 } |  165 } | 
|  166  |  166  | 
|  167 bool FakeChromeIdentityService::IsValidIdentity( |  167 bool FakeChromeIdentityService::IsValidIdentity( | 
|  168     ChromeIdentity* identity) const { |  168     ChromeIdentity* identity) const { | 
|  169   return [identities_ indexOfObject:identity] != NSNotFound; |  169   return [identities_ indexOfObject:identity] != NSNotFound; | 
|  170 } |  170 } | 
|  171  |  171  | 
|  172 ChromeIdentity* FakeChromeIdentityService::GetIdentityWithGaiaID( |  172 ChromeIdentity* FakeChromeIdentityService::GetIdentityWithGaiaID( | 
|  173     const std::string& gaia_id) const { |  173     const std::string& gaia_id) const { | 
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  254 } |  254 } | 
|  255  |  255  | 
|  256 void FakeChromeIdentityService::RemoveIdentity(ChromeIdentity* identity) { |  256 void FakeChromeIdentityService::RemoveIdentity(ChromeIdentity* identity) { | 
|  257   if ([identities_ indexOfObject:identity] != NSNotFound) { |  257   if ([identities_ indexOfObject:identity] != NSNotFound) { | 
|  258     [identities_ removeObject:identity]; |  258     [identities_ removeObject:identity]; | 
|  259     FireIdentityListChanged(); |  259     FireIdentityListChanged(); | 
|  260   } |  260   } | 
|  261 } |  261 } | 
|  262  |  262  | 
|  263 }  // namespace ios |  263 }  // namespace ios | 
| OLD | NEW |