Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/extensions/external_provider_impl.cc

Issue 1281313003: base: Remove using:: declaration from version.h header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (!path.IsAbsolute()) { 278 if (!path.IsAbsolute()) {
279 base::FilePath base_path = loader_->GetBaseCrxFilePath(); 279 base::FilePath base_path = loader_->GetBaseCrxFilePath();
280 if (base_path.empty()) { 280 if (base_path.empty()) {
281 LOG(WARNING) << "File path " << external_crx.c_str() 281 LOG(WARNING) << "File path " << external_crx.c_str()
282 << " is relative. An absolute path is required."; 282 << " is relative. An absolute path is required.";
283 continue; 283 continue;
284 } 284 }
285 path = base_path.Append(external_crx); 285 path = base_path.Append(external_crx);
286 } 286 }
287 287
288 Version version(external_version); 288 base::Version version(external_version);
289 if (!version.IsValid()) { 289 if (!version.IsValid()) {
290 LOG(WARNING) << "Malformed extension dictionary for extension: " 290 LOG(WARNING) << "Malformed extension dictionary for extension: "
291 << extension_id.c_str() << ". Invalid version string \"" 291 << extension_id.c_str() << ". Invalid version string \""
292 << external_version << "\"."; 292 << external_version << "\".";
293 continue; 293 continue;
294 } 294 }
295 service_->OnExternalExtensionFileFound(extension_id, &version, path, 295 service_->OnExternalExtensionFileFound(extension_id, &version, path,
296 crx_location_, creation_flags, 296 crx_location_, creation_flags,
297 auto_acknowledge_, 297 auto_acknowledge_,
298 install_immediately_); 298 install_immediately_);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 bool ExternalProviderImpl::HasExtension( 341 bool ExternalProviderImpl::HasExtension(
342 const std::string& id) const { 342 const std::string& id) const {
343 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 343 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
344 CHECK(prefs_.get()); 344 CHECK(prefs_.get());
345 CHECK(ready_); 345 CHECK(ready_);
346 return prefs_->HasKey(id); 346 return prefs_->HasKey(id);
347 } 347 }
348 348
349 bool ExternalProviderImpl::GetExtensionDetails( 349 bool ExternalProviderImpl::GetExtensionDetails(
350 const std::string& id, Manifest::Location* location, 350 const std::string& id,
351 scoped_ptr<Version>* version) const { 351 Manifest::Location* location,
352 scoped_ptr<base::Version>* version) const {
352 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 353 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
353 CHECK(prefs_.get()); 354 CHECK(prefs_.get());
354 CHECK(ready_); 355 CHECK(ready_);
355 base::DictionaryValue* extension = NULL; 356 base::DictionaryValue* extension = NULL;
356 if (!prefs_->GetDictionary(id, &extension)) 357 if (!prefs_->GetDictionary(id, &extension))
357 return false; 358 return false;
358 359
359 Manifest::Location loc = Manifest::INVALID_LOCATION; 360 Manifest::Location loc = Manifest::INVALID_LOCATION;
360 if (extension->HasKey(kExternalUpdateUrl)) { 361 if (extension->HasKey(kExternalUpdateUrl)) {
361 loc = download_location_; 362 loc = download_location_;
362 363
363 } else if (extension->HasKey(kExternalCrx)) { 364 } else if (extension->HasKey(kExternalCrx)) {
364 loc = crx_location_; 365 loc = crx_location_;
365 366
366 std::string external_version; 367 std::string external_version;
367 if (!extension->GetString(kExternalVersion, &external_version)) 368 if (!extension->GetString(kExternalVersion, &external_version))
368 return false; 369 return false;
369 370
370 if (version) 371 if (version)
371 version->reset(new Version(external_version)); 372 version->reset(new base::Version(external_version));
372 373
373 } else { 374 } else {
374 NOTREACHED(); // Chrome should not allow prefs to get into this state. 375 NOTREACHED(); // Chrome should not allow prefs to get into this state.
375 return false; 376 return false;
376 } 377 }
377 378
378 if (location) 379 if (location)
379 *location = loc; 380 *location = loc;
380 381
381 return true; 382 return true;
382 } 383 }
383 384
384 bool ExternalProviderImpl::HandleMinProfileVersion( 385 bool ExternalProviderImpl::HandleMinProfileVersion(
385 const base::DictionaryValue* extension, 386 const base::DictionaryValue* extension,
386 const std::string& extension_id, 387 const std::string& extension_id,
387 std::set<std::string>* unsupported_extensions) { 388 std::set<std::string>* unsupported_extensions) {
388 std::string min_profile_created_by_version; 389 std::string min_profile_created_by_version;
389 if (profile_ && 390 if (profile_ &&
390 extension->GetString(kMinProfileCreatedByVersion, 391 extension->GetString(kMinProfileCreatedByVersion,
391 &min_profile_created_by_version)) { 392 &min_profile_created_by_version)) {
392 Version profile_version( 393 base::Version profile_version(
393 profile_->GetPrefs()->GetString(prefs::kProfileCreatedByVersion)); 394 profile_->GetPrefs()->GetString(prefs::kProfileCreatedByVersion));
394 Version min_version(min_profile_created_by_version); 395 base::Version min_version(min_profile_created_by_version);
395 if (min_version.IsValid() && profile_version.CompareTo(min_version) < 0) { 396 if (min_version.IsValid() && profile_version.CompareTo(min_version) < 0) {
396 unsupported_extensions->insert(extension_id); 397 unsupported_extensions->insert(extension_id);
397 VLOG(1) << "Skip installing (or uninstall) external extension: " 398 VLOG(1) << "Skip installing (or uninstall) external extension: "
398 << extension_id 399 << extension_id
399 << " profile.created_by_version: " << profile_version.GetString() 400 << " profile.created_by_version: " << profile_version.GetString()
400 << " min_profile_created_by_version: " 401 << " min_profile_created_by_version: "
401 << min_profile_created_by_version; 402 << min_profile_created_by_version;
402 return false; 403 return false;
403 } 404 }
404 } 405 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 new ExternalProviderImpl( 665 new ExternalProviderImpl(
665 service, 666 service,
666 new ExternalComponentLoader(profile), 667 new ExternalComponentLoader(profile),
667 profile, 668 profile,
668 Manifest::INVALID_LOCATION, 669 Manifest::INVALID_LOCATION,
669 Manifest::EXTERNAL_COMPONENT, 670 Manifest::EXTERNAL_COMPONENT,
670 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); 671 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT)));
671 } 672 }
672 673
673 } // namespace extensions 674 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698