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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 #include "chrome/browser/chromeos/login/user_manager.h" | 70 #include "chrome/browser/chromeos/login/user_manager.h" |
71 #include "chromeos/dbus/cryptohome_client.h" | 71 #include "chromeos/dbus/cryptohome_client.h" |
72 #include "chromeos/dbus/dbus_thread_manager.h" | 72 #include "chromeos/dbus/dbus_thread_manager.h" |
73 #endif | 73 #endif |
74 | 74 |
75 using content::BrowserThread; | 75 using content::BrowserThread; |
76 using content::UserMetricsAction; | 76 using content::UserMetricsAction; |
77 | 77 |
78 namespace { | 78 namespace { |
79 | 79 |
80 static bool did_perform_profile_import = false; | |
81 | |
82 // Profiles that should be deleted on shutdown. | 80 // Profiles that should be deleted on shutdown. |
83 std::vector<base::FilePath>& ProfilesToDelete() { | 81 std::vector<base::FilePath>& ProfilesToDelete() { |
84 CR_DEFINE_STATIC_LOCAL(std::vector<base::FilePath>, profiles_to_delete, ()); | 82 CR_DEFINE_STATIC_LOCAL(std::vector<base::FilePath>, profiles_to_delete, ()); |
85 return profiles_to_delete; | 83 return profiles_to_delete; |
86 } | 84 } |
87 | 85 |
88 // Simple task to log the size of the current profile. | 86 // Simple task to log the size of the current profile. |
89 void ProfileSizeTask(const base::FilePath& path, int extension_count) { | 87 void ProfileSizeTask(const base::FilePath& path, int extension_count) { |
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
91 | 89 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 } | 652 } |
655 } | 653 } |
656 } | 654 } |
657 | 655 |
658 // static | 656 // static |
659 bool ProfileManager::IsImportProcess(const CommandLine& command_line) { | 657 bool ProfileManager::IsImportProcess(const CommandLine& command_line) { |
660 return (command_line.HasSwitch(switches::kImport) || | 658 return (command_line.HasSwitch(switches::kImport) || |
661 command_line.HasSwitch(switches::kImportFromFile)); | 659 command_line.HasSwitch(switches::kImportFromFile)); |
662 } | 660 } |
663 | 661 |
664 // static | |
665 bool ProfileManager::DidPerformProfileImport() { | |
666 return did_perform_profile_import; | |
667 } | |
668 | |
669 void ProfileManager::SetWillImport() { | 662 void ProfileManager::SetWillImport() { |
670 will_import_ = true; | 663 will_import_ = true; |
671 } | 664 } |
672 | 665 |
673 void ProfileManager::OnImportFinished(Profile* profile) { | 666 void ProfileManager::OnImportFinished(Profile* profile) { |
674 will_import_ = false; | 667 will_import_ = false; |
675 did_perform_profile_import = true; | |
676 DCHECK(profile); | 668 DCHECK(profile); |
677 | 669 |
678 #if !defined(OS_CHROMEOS) | 670 #if !defined(OS_CHROMEOS) |
679 // If the import process was not run, it means this branch was not called, | 671 // If the import process was not run, it means this branch was not called, |
680 // and it was handled by ProfileImpl::DoFinalInit(). | 672 // and it was handled by ProfileImpl::DoFinalInit(). |
681 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); | 673 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); |
682 model->AddObserver(new BookmarkModelLoadedObserver(profile)); | 674 model->AddObserver(new BookmarkModelLoadedObserver(profile)); |
683 #endif | 675 #endif |
684 | 676 |
685 content::NotificationService::current()->Notify( | 677 content::NotificationService::current()->Notify( |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 ProfileManager::ProfileInfo::ProfileInfo( | 1098 ProfileManager::ProfileInfo::ProfileInfo( |
1107 Profile* profile, | 1099 Profile* profile, |
1108 bool created) | 1100 bool created) |
1109 : profile(profile), | 1101 : profile(profile), |
1110 created(created) { | 1102 created(created) { |
1111 } | 1103 } |
1112 | 1104 |
1113 ProfileManager::ProfileInfo::~ProfileInfo() { | 1105 ProfileManager::ProfileInfo::~ProfileInfo() { |
1114 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1106 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1115 } | 1107 } |
OLD | NEW |