Index: chrome/browser/profiles/profile_impl.cc |
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
index 851022756648df3bd84c966399f91b2c19c63914..72fa56efac5b7878379d4bcda27d80c00f4f6828 100644 |
--- a/chrome/browser/profiles/profile_impl.cc |
+++ b/chrome/browser/profiles/profile_impl.cc |
@@ -220,6 +220,47 @@ FilePath GetMediaCachePath(const FilePath& base) { |
return base.Append(chrome::kMediaCacheDirname); |
} |
+void DoInstallDefaultAppsOnUIThread(const FilePath& profile_path, |
pastarmovj
2011/10/05 09:47:16
Sorry this has crept in from the rebase not part o
|
+ const std::list<FilePath>& crx_path_list) { |
+ Profile* profile = |
+ g_browser_process->profile_manager()->GetProfileByPath(profile_path); |
+ if (profile) { |
+ ExtensionService* extension_service = profile->GetExtensionService(); |
+ for (std::list<FilePath>::const_iterator iter = crx_path_list.begin(); |
+ iter != crx_path_list.end(); ++iter) { |
+ scoped_refptr<CrxInstaller> crx_installer = |
+ extension_service->MakeCrxInstaller(NULL); |
+ crx_installer->set_allow_silent_install(true); |
+ crx_installer->set_delete_source(false); |
+ crx_installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); |
+ crx_installer->InstallCrx(*iter); |
+ } |
+ } |
+} |
+ |
+void InstallDefaultApps(const FilePath& profile_path) { |
+ FilePath apps_dir; |
+ FilePath file; |
+ std::list<FilePath> crx_path_list; |
+ |
+ if (PathService::Get(chrome::DIR_DEFAULT_APPS, &apps_dir)) { |
+ file_util::FileEnumerator file_enumerator(apps_dir, false, |
+ file_util::FileEnumerator::FILES); |
+ while (!(file = file_enumerator.Next()).value().empty()) { |
+ if (LowerCaseEqualsASCII(file.Extension(), ".crx")) |
+ crx_path_list.push_back(file); |
+ } |
+ } |
+ // No need to post the task if nothing was there to install. |
+ if (!crx_path_list.size()) |
+ return; |
+ |
+ // Finish the install on the UI thread. |
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
+ base::Bind(&DoInstallDefaultAppsOnUIThread, |
+ profile_path, crx_path_list)); |
+} |
+ |
// Simple task to log the size of the current profile. |
class ProfileSizeTask : public Task { |
public: |