| 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 "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 "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 9 #if !defined(OS_ANDROID) | 10 #if !defined(OS_ANDROID) |
| 10 #include "chrome/browser/first_run/first_run.h" | 11 #include "chrome/browser/first_run/first_run.h" |
| 11 #endif | 12 #endif |
| 12 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/chrome_version_info.h" | 16 #include "chrome/common/chrome_version_info.h" |
| 16 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 41 return false; | 42 return false; |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 return true; | 45 return true; |
| 45 } | 46 } |
| 46 | 47 |
| 47 } // namespace | 48 } // namespace |
| 48 | 49 |
| 49 namespace default_apps { | 50 namespace default_apps { |
| 50 | 51 |
| 51 void RegisterUserPrefs(PrefServiceSyncable* prefs) { | 52 void RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 52 prefs->RegisterIntegerPref(prefs::kDefaultAppsInstallState, kUnknown, | 53 registry->RegisterIntegerPref(prefs::kDefaultAppsInstallState, kUnknown, |
| 53 PrefServiceSyncable::UNSYNCABLE_PREF); | 54 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 54 } | 55 } |
| 55 | 56 |
| 56 bool Provider::ShouldInstallInProfile() { | 57 bool Provider::ShouldInstallInProfile() { |
| 57 // We decide to install or not install default apps based on the following | 58 // We decide to install or not install default apps based on the following |
| 58 // criteria, from highest priority to lowest priority: | 59 // criteria, from highest priority to lowest priority: |
| 59 // | 60 // |
| 60 // - The command line option. Tests use this option to disable installation | 61 // - The command line option. Tests use this option to disable installation |
| 61 // of default apps in some cases. | 62 // of default apps in some cases. |
| 62 // - If the locale is not compatible with the defaults, don't install them. | 63 // - If the locale is not compatible with the defaults, don't install them. |
| 63 // - The kDefaultApps preferences value in the profile. This value is | 64 // - The kDefaultApps preferences value in the profile. This value is |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 for (std::set<std::string>::iterator it = new_default_apps.begin(); | 167 for (std::set<std::string>::iterator it = new_default_apps.begin(); |
| 167 it != new_default_apps.end(); ++it) { | 168 it != new_default_apps.end(); ++it) { |
| 168 prefs->Remove(*it, NULL); | 169 prefs->Remove(*it, NULL); |
| 169 } | 170 } |
| 170 } | 171 } |
| 171 | 172 |
| 172 ExternalProviderImpl::SetPrefs(prefs); | 173 ExternalProviderImpl::SetPrefs(prefs); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace default_apps | 176 } // namespace default_apps |
| OLD | NEW |