Chromium Code Reviews| 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/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 path = base_path.Append(external_crx); | 218 path = base_path.Append(external_crx); |
| 219 } | 219 } |
| 220 | 220 |
| 221 Version version(external_version); | 221 Version version(external_version); |
| 222 if (!version.IsValid()) { | 222 if (!version.IsValid()) { |
| 223 LOG(WARNING) << "Malformed extension dictionary for extension: " | 223 LOG(WARNING) << "Malformed extension dictionary for extension: " |
| 224 << extension_id.c_str() << ". Invalid version string \"" | 224 << extension_id.c_str() << ". Invalid version string \"" |
| 225 << external_version << "\"."; | 225 << external_version << "\"."; |
| 226 continue; | 226 continue; |
| 227 } | 227 } |
| 228 service_->OnExternalExtensionFileFound(extension_id, &version, path, | 228 // Don't install new default apps for existing users. |
| 229 crx_location_, creation_flags, | 229 // TODO(grv): remove after migration (Q1-2013). |
| 230 auto_acknowledge_); | 230 if ((!default_apps::isMigration) || IsOldDefaultApp(extension_id)) { |
|
Mihai Parparita -not on Chrome
2012/08/27 19:31:55
Reading global variables like this is a pretty big
| |
| 231 service_->OnExternalExtensionFileFound(extension_id, &version, path, | |
| 232 crx_location_, creation_flags, | |
| 233 auto_acknowledge_); | |
| 234 } else { | |
| 235 continue; | |
| 236 } | |
| 231 } else { // if (has_external_update_url) | 237 } else { // if (has_external_update_url) |
| 232 CHECK(has_external_update_url); // Checking of keys above ensures this. | 238 CHECK(has_external_update_url); // Checking of keys above ensures this. |
| 233 if (download_location_ == Extension::INVALID) { | 239 if (download_location_ == Extension::INVALID) { |
| 234 LOG(WARNING) << "This provider does not support installing external " | 240 LOG(WARNING) << "This provider does not support installing external " |
| 235 << "extensions from update URLs."; | 241 << "extensions from update URLs."; |
| 236 continue; | 242 continue; |
| 237 } | 243 } |
| 238 GURL update_url(external_update_url); | 244 GURL update_url(external_update_url); |
| 239 if (!update_url.is_valid()) { | 245 if (!update_url.is_valid()) { |
| 240 LOG(WARNING) << "Malformed extension dictionary for extension: " | 246 LOG(WARNING) << "Malformed extension dictionary for extension: " |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 251 for (std::set<std::string>::iterator it = unsupported_extensions.begin(); | 257 for (std::set<std::string>::iterator it = unsupported_extensions.begin(); |
| 252 it != unsupported_extensions.end(); ++it) { | 258 it != unsupported_extensions.end(); ++it) { |
| 253 // Remove extension for the list of know external extensions. The extension | 259 // Remove extension for the list of know external extensions. The extension |
| 254 // will be uninstalled later because provider doesn't provide it anymore. | 260 // will be uninstalled later because provider doesn't provide it anymore. |
| 255 prefs_->Remove(*it, NULL); | 261 prefs_->Remove(*it, NULL); |
| 256 } | 262 } |
| 257 | 263 |
| 258 service_->OnExternalProviderReady(this); | 264 service_->OnExternalProviderReady(this); |
| 259 } | 265 } |
| 260 | 266 |
| 267 bool ExternalProviderImpl::IsOldDefaultApp(const std::string& extension_id) { | |
| 268 const std::string gmail_id = "pjkljhegncpnkpknbcohdijeoejaedia"; | |
| 269 const std::string search_id = "coobgpohoikkiipiblmjeljniedjpjpf"; | |
| 270 const std::string youtube_id = "blpcfgokakmgnkcojhhkbfbldkacnbeo"; | |
| 271 return extension_id == gmail_id || extension_id == search_id | |
| 272 || extension_id == youtube_id; | |
| 273 } | |
| 274 | |
| 261 void ExternalProviderImpl::ServiceShutdown() { | 275 void ExternalProviderImpl::ServiceShutdown() { |
| 262 service_ = NULL; | 276 service_ = NULL; |
| 263 } | 277 } |
| 264 | 278 |
| 265 bool ExternalProviderImpl::IsReady() const { | 279 bool ExternalProviderImpl::IsReady() const { |
| 266 return ready_; | 280 return ready_; |
| 267 } | 281 } |
| 268 | 282 |
| 269 bool ExternalProviderImpl::HasExtension( | 283 bool ExternalProviderImpl::HasExtension( |
| 270 const std::string& id) const { | 284 const std::string& id) const { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 service, | 432 service, |
| 419 connector->GetAppPackUpdater()->CreateExternalLoader(), | 433 connector->GetAppPackUpdater()->CreateExternalLoader(), |
| 420 Extension::EXTERNAL_PREF, | 434 Extension::EXTERNAL_PREF, |
| 421 Extension::INVALID, | 435 Extension::INVALID, |
| 422 Extension::NO_FLAGS))); | 436 Extension::NO_FLAGS))); |
| 423 } | 437 } |
| 424 #endif | 438 #endif |
| 425 } | 439 } |
| 426 | 440 |
| 427 } // namespace extensions | 441 } // namespace extensions |
| OLD | NEW |