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