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 "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" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 profile_->GetPrefs()->GetString(prefs::kDefaultApps) == "install"; | 68 profile_->GetPrefs()->GetString(prefs::kDefaultApps) == "install"; |
69 | 69 |
70 InstallState state = | 70 InstallState state = |
71 static_cast<InstallState>(profile_->GetPrefs()->GetInteger( | 71 static_cast<InstallState>(profile_->GetPrefs()->GetInteger( |
72 prefs::kDefaultAppsInstallState)); | 72 prefs::kDefaultAppsInstallState)); |
73 | 73 |
74 is_migration_ = (state == kProvideLegacyDefaultApps); | 74 is_migration_ = (state == kProvideLegacyDefaultApps); |
75 | 75 |
76 switch (state) { | 76 switch (state) { |
77 case kUnknown: { | 77 case kUnknown: { |
78 // Only new installations and profiles get default apps. In theory the | 78 // This is the first time the default apps feature runs on this profile. |
79 // new profile checks should catch new installations, but that is not | 79 // Determine if we want to install them or not. |
80 // always the case (http:/crbug.com/145351). | |
81 chrome::VersionInfo version_info; | 80 chrome::VersionInfo version_info; |
82 bool is_new_profile = | 81 if (!profile_->WasCreatedByVersionOrLater(version_info.Version().c_str())) |
83 profile_->WasCreatedByVersionOrLater(version_info.Version().c_str()); | |
84 bool is_first_run = first_run::IsChromeFirstRun(); | |
85 if (!is_first_run && !is_new_profile) | |
86 install_apps = false; | 82 install_apps = false; |
87 break; | 83 break; |
88 } | 84 } |
89 | 85 |
90 // The old default apps were provided as external extensions and were | 86 // The old default apps were provided as external extensions and were |
91 // installed everytime Chrome was run. Thus, changing the list of default | 87 // installed everytime Chrome was run. Thus, changing the list of default |
92 // apps affected all users. Migrate old default apps to new mechanism where | 88 // apps affected all users. Migrate old default apps to new mechanism where |
93 // they are installed only once as INTERNAL. | 89 // they are installed only once as INTERNAL. |
94 // TODO(grv) : remove after Q1-2013. | 90 // TODO(grv) : remove after Q1-2013. |
95 case kProvideLegacyDefaultApps: | 91 case kProvideLegacyDefaultApps: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 for (std::set<std::string>::iterator it = new_default_apps.begin(); | 168 for (std::set<std::string>::iterator it = new_default_apps.begin(); |
173 it != new_default_apps.end(); ++it) { | 169 it != new_default_apps.end(); ++it) { |
174 prefs->Remove(*it, NULL); | 170 prefs->Remove(*it, NULL); |
175 } | 171 } |
176 } | 172 } |
177 | 173 |
178 ExternalProviderImpl::SetPrefs(prefs); | 174 ExternalProviderImpl::SetPrefs(prefs); |
179 } | 175 } |
180 | 176 |
181 } // namespace default_apps | 177 } // namespace default_apps |
OLD | NEW |