OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 if (cache.IsDefaultAvatarIconUrl(icon_url_std, &icon_index)) { | 459 if (cache.IsDefaultAvatarIconUrl(icon_url_std, &icon_index)) { |
460 // add profile to cache with user selected name and avatar | 460 // add profile to cache with user selected name and avatar |
461 cache.AddProfileToCache(profile_path, name, string16(), icon_index, | 461 cache.AddProfileToCache(profile_path, name, string16(), icon_index, |
462 is_managed); | 462 is_managed); |
463 } | 463 } |
464 info->callbacks.push_back(callback); | 464 info->callbacks.push_back(callback); |
465 } | 465 } |
466 } | 466 } |
467 | 467 |
468 // static | 468 // static |
469 void ProfileManager::CreateDefaultProfileAsync(const CreateCallback& callback) { | 469 void ProfileManager::CreateDefaultProfileAsync(const CreateCallback& callback, |
470 bool is_managed) { | |
470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 471 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
471 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 472 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
472 | 473 |
473 FilePath default_profile_dir = profile_manager->user_data_dir_; | 474 FilePath default_profile_dir = profile_manager->user_data_dir_; |
474 // TODO(mirandac): current directory will not always be default in the future | 475 // TODO(mirandac): current directory will not always be default in the future |
475 default_profile_dir = default_profile_dir.Append( | 476 default_profile_dir = default_profile_dir.Append( |
476 profile_manager->GetInitialProfileDir()); | 477 profile_manager->GetInitialProfileDir()); |
477 | 478 |
479 // Chrome OS specific note: since we pass string16() here as the icon_url, | |
Dmitry Polukhin
2013/02/08 17:26:53
Why do we need this change in this case??? If all
Nikita (slow)
2013/02/08 21:55:05
I agree that we could always pass false here for |
rpetterson
2013/02/08 22:37:56
nit: The comment could be a bit clearer: which pro
Nikita (slow)
2013/02/11 09:42:12
Done.
| |
480 // profile cache information will not get updated with the is_managed value. | |
481 // But on Chrome OS this property will get initialized in | |
482 // Profile::CREATE_STATUS_CREATED callback. | |
478 profile_manager->CreateProfileAsync( | 483 profile_manager->CreateProfileAsync( |
479 default_profile_dir, callback, string16(), string16(), false); | 484 default_profile_dir, callback, string16(), string16(), is_managed); |
480 } | 485 } |
481 | 486 |
482 bool ProfileManager::AddProfile(Profile* profile) { | 487 bool ProfileManager::AddProfile(Profile* profile) { |
483 DCHECK(profile); | 488 DCHECK(profile); |
484 | 489 |
485 // Make sure that we're not loading a profile with the same ID as a profile | 490 // Make sure that we're not loading a profile with the same ID as a profile |
486 // that's already loaded. | 491 // that's already loaded. |
487 if (GetProfileByPath(profile->GetPath())) { | 492 if (GetProfileByPath(profile->GetPath())) { |
488 NOTREACHED() << "Attempted to add profile with the same path (" << | 493 NOTREACHED() << "Attempted to add profile with the same path (" << |
489 profile->GetPath().value() << | 494 profile->GetPath().value() << |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 ProfileManager::ProfileInfo::ProfileInfo( | 1097 ProfileManager::ProfileInfo::ProfileInfo( |
1093 Profile* profile, | 1098 Profile* profile, |
1094 bool created) | 1099 bool created) |
1095 : profile(profile), | 1100 : profile(profile), |
1096 created(created) { | 1101 created(created) { |
1097 } | 1102 } |
1098 | 1103 |
1099 ProfileManager::ProfileInfo::~ProfileInfo() { | 1104 ProfileManager::ProfileInfo::~ProfileInfo() { |
1100 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1105 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1101 } | 1106 } |
OLD | NEW |