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/extensions/default_apps.h" | 5 #include "chrome/browser/extensions/default_apps.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
11 #include "chrome/browser/extensions/default_apps_trial.h" | 11 #include "chrome/browser/extensions/default_apps_trial.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/extensions/extension.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 | 18 |
18 static bool ShouldInstallInProfile(Profile* profile) { | 19 static bool ShouldInstallInProfile(Profile* profile) { |
19 // We decide to install or not install default apps based on the following | 20 // We decide to install or not install default apps based on the following |
20 // criteria, from highest priority to lowest priority: | 21 // criteria, from highest priority to lowest priority: |
21 // | 22 // |
22 // - If this instance of chrome is participating in the default apps | 23 // - If this instance of chrome is participating in the default apps |
23 // field trial, then install apps based on the group. | 24 // field trial, then install apps based on the group. |
24 // - The command line option. Tests use this option to disable installation | 25 // - The command line option. Tests use this option to disable installation |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 namespace default_apps { | 111 namespace default_apps { |
111 | 112 |
112 void RegisterUserPrefs(PrefService* prefs) { | 113 void RegisterUserPrefs(PrefService* prefs) { |
113 prefs->RegisterIntegerPref(prefs::kDefaultAppsInstallState, kUnknown, | 114 prefs->RegisterIntegerPref(prefs::kDefaultAppsInstallState, kUnknown, |
114 PrefService::UNSYNCABLE_PREF); | 115 PrefService::UNSYNCABLE_PREF); |
115 } | 116 } |
116 | 117 |
117 Provider::Provider(Profile* profile, | 118 Provider::Provider(Profile* profile, |
118 VisitorInterface* service, | 119 VisitorInterface* service, |
119 ExternalExtensionLoader* loader, | 120 ExternalExtensionLoader* loader, |
120 Extension::Location crx_location, | 121 extensions::Extension::Location crx_location, |
121 Extension::Location download_location, | 122 extensions::Extension::Location download_location, |
122 int creation_flags) | 123 int creation_flags) |
123 : ExternalExtensionProviderImpl(service, loader, crx_location, | 124 : ExternalExtensionProviderImpl(service, loader, crx_location, |
124 download_location, creation_flags), | 125 download_location, creation_flags), |
125 profile_(profile) { | 126 profile_(profile) { |
126 DCHECK(profile); | 127 DCHECK(profile); |
127 set_auto_acknowledge(true); | 128 set_auto_acknowledge(true); |
128 } | 129 } |
129 | 130 |
130 void Provider::VisitRegisteredExtension() { | 131 void Provider::VisitRegisteredExtension() { |
131 if (!profile_ || !ShouldInstallInProfile(profile_)) { | 132 if (!profile_ || !ShouldInstallInProfile(profile_)) { |
132 base::DictionaryValue* prefs = new base::DictionaryValue; | 133 base::DictionaryValue* prefs = new base::DictionaryValue; |
133 SetPrefs(prefs); | 134 SetPrefs(prefs); |
134 return; | 135 return; |
135 } | 136 } |
136 | 137 |
137 ExternalExtensionProviderImpl::VisitRegisteredExtension(); | 138 ExternalExtensionProviderImpl::VisitRegisteredExtension(); |
138 } | 139 } |
139 | 140 |
140 } // namespace default_apps | 141 } // namespace default_apps |
OLD | NEW |