Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1370)

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 7839009: BUG=94920 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl.cc
===================================================================
--- chrome/browser/profiles/profile_impl.cc (revision 100719)
+++ chrome/browser/profiles/profile_impl.cc (working copy)
@@ -26,6 +26,7 @@
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
+#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_devtools_manager.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
#include "chrome/browser/extensions/extension_event_router.h"
@@ -38,11 +39,13 @@
#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/favicon/favicon_service.h"
+#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/shortcuts_backend.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/instant/instant_controller.h"
+#include "chrome/browser/mac/keystone_glue.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/net/gaia/token_service.h"
@@ -87,6 +90,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/spellcheck_messages.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/browser_thread.h"
#include "content/browser/chrome_blob_storage_context.h"
@@ -500,6 +504,26 @@
extensions_enabled));
RegisterComponentExtensions();
+
+#if defined(GOOGLE_CHROME_BUILD)
+ // If first run and brand code not equal to ECDB, install default apps.
+#if defined(OS_WIN)
+ string16 brand;
+ GoogleUpdateSettings::GetBrand(&brand);
+#elif defined(OS_MACOSX)
+ std::string brand = keystone_glue::BrandCode();
+#else
+ std::string brand;
+#endif
+ // TODO(caitkp): when we move to multi-profiles (M16) we will want to change
+ // this check, as |FirstRun::IsChromeFirstRun()| checks for the first run
+ // ever, not first run per profile.
+ if (FirstRun::IsChromeFirstRun() &&
+ !LowerCaseEqualsASCII(brand, "ecdb")) {
+ InstallDefaultApps();
+ }
+#endif
+
extension_service_->Init();
if (extensions_enabled) {
@@ -536,6 +560,31 @@
}
}
+void ProfileImpl::InstallDefaultApps() {
+ 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);
+ }
+ }
+
+ for (std::list<FilePath>::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 ProfileImpl::RegisterComponentExtensions() {
// Register the component extensions.
//
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698