OLD | NEW |
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 <set> | 5 #include <set> |
6 | 6 |
7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/stl_util-inl.h" |
13 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
18 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 19 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
19 #include "chrome/browser/profiles/profile_info_cache.h" | 20 #include "chrome/browser/profiles/profile_info_cache.h" |
20 #include "chrome/browser/sessions/session_service_factory.h" | 21 #include "chrome/browser/sessions/session_service_factory.h" |
21 #include "chrome/browser/sync/profile_sync_service.h" | 22 #include "chrome/browser/sync/profile_sync_service.h" |
22 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 403 } |
403 | 404 |
404 std::vector<ProfileManagerObserver*> observers_to_delete; | 405 std::vector<ProfileManagerObserver*> observers_to_delete; |
405 | 406 |
406 for (size_t i = 0; i < observers.size(); ++i) { | 407 for (size_t i = 0; i < observers.size(); ++i) { |
407 observers[i]->OnProfileCreated(profile); | 408 observers[i]->OnProfileCreated(profile); |
408 if (observers[i]->DeleteAfterCreation()) | 409 if (observers[i]->DeleteAfterCreation()) |
409 observers_to_delete.push_back(observers[i]); | 410 observers_to_delete.push_back(observers[i]); |
410 } | 411 } |
411 | 412 |
412 observers_to_delete.clear(); | 413 STLDeleteElements(&observers_to_delete); |
413 } | 414 } |
414 | 415 |
415 // static | 416 // static |
416 void ProfileManager::CreateMultiProfileAsync() { | 417 void ProfileManager::CreateMultiProfileAsync() { |
417 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 418 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
418 | 419 |
419 // Create the next profile in the next available directory slot. | 420 // Create the next profile in the next available directory slot. |
420 PrefService* local_state = g_browser_process->local_state(); | 421 PrefService* local_state = g_browser_process->local_state(); |
421 DCHECK(local_state); | 422 DCHECK(local_state); |
422 | 423 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 551 } |
551 | 552 |
552 // static | 553 // static |
553 bool ProfileManager::IsMultipleProfilesEnabled() { | 554 bool ProfileManager::IsMultipleProfilesEnabled() { |
554 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) | 555 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) |
555 return true; | 556 return true; |
556 #else | 557 #else |
557 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); | 558 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); |
558 #endif | 559 #endif |
559 } | 560 } |
OLD | NEW |