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

Side by Side Diff: ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.cc

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_manager_impl.h" 5 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 ios::ChromeBrowserState* ChromeBrowserStateManagerImpl::GetBrowserState( 135 ios::ChromeBrowserState* ChromeBrowserStateManagerImpl::GetBrowserState(
136 const base::FilePath& path) { 136 const base::FilePath& path) {
137 // If the browser state is already loaded, just return it. 137 // If the browser state is already loaded, just return it.
138 auto iter = browser_states_.find(path); 138 auto iter = browser_states_.find(path);
139 if (iter != browser_states_.end()) { 139 if (iter != browser_states_.end()) {
140 DCHECK(iter->second.get()); 140 DCHECK(iter->second.get());
141 return iter->second.get(); 141 return iter->second.get();
142 } 142 }
143 143
144 scoped_ptr<ChromeBrowserStateImpl> browser_state_impl( 144 std::unique_ptr<ChromeBrowserStateImpl> browser_state_impl(
145 new ChromeBrowserStateImpl(path)); 145 new ChromeBrowserStateImpl(path));
146 DCHECK(!browser_state_impl->IsOffTheRecord()); 146 DCHECK(!browser_state_impl->IsOffTheRecord());
147 147
148 std::pair<ChromeBrowserStateImplPathMap::iterator, bool> insert_result = 148 std::pair<ChromeBrowserStateImplPathMap::iterator, bool> insert_result =
149 browser_states_.insert( 149 browser_states_.insert(
150 std::make_pair(path, std::move(browser_state_impl))); 150 std::make_pair(path, std::move(browser_state_impl)));
151 DCHECK(insert_result.second); 151 DCHECK(insert_result.second);
152 DCHECK(insert_result.first != browser_states_.end()); 152 DCHECK(insert_result.first != browser_states_.end());
153 153
154 DoFinalInit(insert_result.first->second.get()); 154 DoFinalInit(insert_result.first->second.get());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 cache->GetIndexOfBrowserStateWithPath(browser_state->GetStatePath()); 245 cache->GetIndexOfBrowserStateWithPath(browser_state->GetStatePath());
246 if (browser_state_index != std::string::npos) { 246 if (browser_state_index != std::string::npos) {
247 // The BrowserStateInfoCache's info must match the Signin Manager. 247 // The BrowserStateInfoCache's info must match the Signin Manager.
248 cache->SetAuthInfoOfBrowserStateAtIndex(browser_state_index, 248 cache->SetAuthInfoOfBrowserStateAtIndex(browser_state_index,
249 account_info.gaia, username); 249 account_info.gaia, username);
250 return; 250 return;
251 } 251 }
252 cache->AddBrowserState(browser_state->GetStatePath(), account_info.gaia, 252 cache->AddBrowserState(browser_state->GetStatePath(), account_info.gaia,
253 username); 253 username);
254 } 254 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698