| OLD | NEW |
| 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 #include "ios/chrome/browser/browser_state/chrome_browser_state_removal_controll
er.h" | 5 #include "ios/chrome/browser/browser_state/chrome_browser_state_removal_controll
er.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/mac/foundation_util.h" | 13 #include "base/mac/foundation_util.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 16 #include "google_apis/gaia/gaia_auth_util.h" | 16 #include "google_apis/gaia/gaia_auth_util.h" |
| 17 #include "ios/chrome/browser/application_context.h" | 17 #include "ios/chrome/browser/application_context.h" |
| 18 #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" | 18 #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" |
| 19 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" | 19 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" |
| 20 #include "ios/chrome/browser/chrome_constants.h" | 20 #include "ios/chrome/browser/chrome_constants.h" |
| 21 #include "ios/chrome/browser/chrome_paths_internal.h" | 21 #include "ios/chrome/browser/chrome_paths_internal.h" |
| 22 #include "ios/chrome/browser/pref_names.h" | 22 #include "ios/chrome/browser/pref_names.h" |
| 23 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 23 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 24 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" | 24 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" |
| 25 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | 25 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" |
| 26 #include "ios/web/public/web_thread.h" | 26 #include "ios/web/public/web_thread.h" |
| 27 | 27 |
| 28 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 29 #error "This file requires ARC support." |
| 30 #endif |
| 31 |
| 28 namespace { | 32 namespace { |
| 29 | 33 |
| 30 ChromeBrowserStateRemovalController* g_chrome_browser_state_removal_helper = | 34 ChromeBrowserStateRemovalController* g_chrome_browser_state_removal_helper = |
| 31 nullptr; | 35 nullptr; |
| 32 | 36 |
| 33 NSString* const kPathToBrowserStateToKeepKey = @"PathToBrowserStateToKeep"; | 37 NSString* const kPathToBrowserStateToKeepKey = @"PathToBrowserStateToKeep"; |
| 34 NSString* const kHasBrowserStateBeenRemovedKey = @"HasBrowserStateBeenRemoved"; | 38 NSString* const kHasBrowserStateBeenRemovedKey = @"HasBrowserStateBeenRemoved"; |
| 35 | 39 |
| 36 const char kGmailDomain[] = "gmail.com"; | 40 const char kGmailDomain[] = "gmail.com"; |
| 37 | 41 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 std::string ChromeBrowserStateRemovalController::GetLastBrowserStatePathUsed() { | 168 std::string ChromeBrowserStateRemovalController::GetLastBrowserStatePathUsed() { |
| 165 return GetApplicationContext()->GetLocalState()->GetString( | 169 return GetApplicationContext()->GetLocalState()->GetString( |
| 166 prefs::kBrowserStateLastUsed); | 170 prefs::kBrowserStateLastUsed); |
| 167 } | 171 } |
| 168 | 172 |
| 169 void ChromeBrowserStateRemovalController::SetLastBrowserStatePathUsed( | 173 void ChromeBrowserStateRemovalController::SetLastBrowserStatePathUsed( |
| 170 const std::string& browser_state_path) { | 174 const std::string& browser_state_path) { |
| 171 GetApplicationContext()->GetLocalState()->SetString( | 175 GetApplicationContext()->GetLocalState()->SetString( |
| 172 prefs::kBrowserStateLastUsed, browser_state_path); | 176 prefs::kBrowserStateLastUsed, browser_state_path); |
| 173 } | 177 } |
| OLD | NEW |