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 "chrome/browser/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 } | 213 } |
214 | 214 |
215 FilePath GetCachePath(const FilePath& base) { | 215 FilePath GetCachePath(const FilePath& base) { |
216 return base.Append(chrome::kCacheDirname); | 216 return base.Append(chrome::kCacheDirname); |
217 } | 217 } |
218 | 218 |
219 FilePath GetMediaCachePath(const FilePath& base) { | 219 FilePath GetMediaCachePath(const FilePath& base) { |
220 return base.Append(chrome::kMediaCacheDirname); | 220 return base.Append(chrome::kMediaCacheDirname); |
221 } | 221 } |
222 | 222 |
223 void DoInstallDefaultAppsOnUIThread(const FilePath& profile_path, | |
pastarmovj
2011/10/05 09:47:16
Sorry this has crept in from the rebase not part o
| |
224 const std::list<FilePath>& crx_path_list) { | |
225 Profile* profile = | |
226 g_browser_process->profile_manager()->GetProfileByPath(profile_path); | |
227 if (profile) { | |
228 ExtensionService* extension_service = profile->GetExtensionService(); | |
229 for (std::list<FilePath>::const_iterator iter = crx_path_list.begin(); | |
230 iter != crx_path_list.end(); ++iter) { | |
231 scoped_refptr<CrxInstaller> crx_installer = | |
232 extension_service->MakeCrxInstaller(NULL); | |
233 crx_installer->set_allow_silent_install(true); | |
234 crx_installer->set_delete_source(false); | |
235 crx_installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); | |
236 crx_installer->InstallCrx(*iter); | |
237 } | |
238 } | |
239 } | |
240 | |
241 void InstallDefaultApps(const FilePath& profile_path) { | |
242 FilePath apps_dir; | |
243 FilePath file; | |
244 std::list<FilePath> crx_path_list; | |
245 | |
246 if (PathService::Get(chrome::DIR_DEFAULT_APPS, &apps_dir)) { | |
247 file_util::FileEnumerator file_enumerator(apps_dir, false, | |
248 file_util::FileEnumerator::FILES); | |
249 while (!(file = file_enumerator.Next()).value().empty()) { | |
250 if (LowerCaseEqualsASCII(file.Extension(), ".crx")) | |
251 crx_path_list.push_back(file); | |
252 } | |
253 } | |
254 // No need to post the task if nothing was there to install. | |
255 if (!crx_path_list.size()) | |
256 return; | |
257 | |
258 // Finish the install on the UI thread. | |
259 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
260 base::Bind(&DoInstallDefaultAppsOnUIThread, | |
261 profile_path, crx_path_list)); | |
262 } | |
263 | |
223 // Simple task to log the size of the current profile. | 264 // Simple task to log the size of the current profile. |
224 class ProfileSizeTask : public Task { | 265 class ProfileSizeTask : public Task { |
225 public: | 266 public: |
226 explicit ProfileSizeTask(const FilePath& path) : path_(path) {} | 267 explicit ProfileSizeTask(const FilePath& path) : path_(path) {} |
227 virtual ~ProfileSizeTask() {} | 268 virtual ~ProfileSizeTask() {} |
228 | 269 |
229 virtual void Run(); | 270 virtual void Run(); |
230 private: | 271 private: |
231 FilePath path_; | 272 FilePath path_; |
232 }; | 273 }; |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1780 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1821 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
1781 if (!spellcheck_profile_.get()) | 1822 if (!spellcheck_profile_.get()) |
1782 spellcheck_profile_.reset(new SpellCheckProfile()); | 1823 spellcheck_profile_.reset(new SpellCheckProfile()); |
1783 return spellcheck_profile_.get(); | 1824 return spellcheck_profile_.get(); |
1784 } | 1825 } |
1785 | 1826 |
1786 void ProfileImpl::SetDownloadManagerDelegate( | 1827 void ProfileImpl::SetDownloadManagerDelegate( |
1787 ChromeDownloadManagerDelegate* delegate) { | 1828 ChromeDownloadManagerDelegate* delegate) { |
1788 download_manager_delegate_ = delegate; | 1829 download_manager_delegate_ = delegate; |
1789 } | 1830 } |
OLD | NEW |