| 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/extension_webstore_private_api.h" | 5 #include "chrome/browser/extensions/extension_webstore_private_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 : use_app_installed_bubble_(false) {} | 252 : use_app_installed_bubble_(false) {} |
| 253 | 253 |
| 254 BeginInstallWithManifestFunction::~BeginInstallWithManifestFunction() {} | 254 BeginInstallWithManifestFunction::~BeginInstallWithManifestFunction() {} |
| 255 | 255 |
| 256 bool BeginInstallWithManifestFunction::RunImpl() { | 256 bool BeginInstallWithManifestFunction::RunImpl() { |
| 257 DictionaryValue* details = NULL; | 257 DictionaryValue* details = NULL; |
| 258 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); | 258 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); |
| 259 CHECK(details); | 259 CHECK(details); |
| 260 | 260 |
| 261 EXTENSION_FUNCTION_VALIDATE(details->GetString(kIdKey, &id_)); | 261 EXTENSION_FUNCTION_VALIDATE(details->GetString(kIdKey, &id_)); |
| 262 if (!Extension::IdIsValid(id_)) { | 262 if (!extensions::Extension::IdIsValid(id_)) { |
| 263 SetResult(INVALID_ID); | 263 SetResult(INVALID_ID); |
| 264 error_ = kInvalidIdError; | 264 error_ = kInvalidIdError; |
| 265 return false; | 265 return false; |
| 266 } | 266 } |
| 267 | 267 |
| 268 EXTENSION_FUNCTION_VALIDATE(details->GetString(kManifestKey, &manifest_)); | 268 EXTENSION_FUNCTION_VALIDATE(details->GetString(kManifestKey, &manifest_)); |
| 269 | 269 |
| 270 if (details->HasKey(kIconDataKey) && details->HasKey(kIconUrlKey)) { | 270 if (details->HasKey(kIconDataKey) && details->HasKey(kIconUrlKey)) { |
| 271 SetResult(ICON_ERROR); | 271 SetResult(ICON_ERROR); |
| 272 error_ = kCannotSpecifyIconDataAndUrlError; | 272 error_ = kCannotSpecifyIconDataAndUrlError; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 ExtensionService::RecordPermissionMessagesHistogram( | 443 ExtensionService::RecordPermissionMessagesHistogram( |
| 444 dummy_extension_, histogram_name.c_str()); | 444 dummy_extension_, histogram_name.c_str()); |
| 445 | 445 |
| 446 // Matches the AddRef in RunImpl(). | 446 // Matches the AddRef in RunImpl(). |
| 447 Release(); | 447 Release(); |
| 448 } | 448 } |
| 449 | 449 |
| 450 bool CompleteInstallFunction::RunImpl() { | 450 bool CompleteInstallFunction::RunImpl() { |
| 451 std::string id; | 451 std::string id; |
| 452 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); | 452 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); |
| 453 if (!Extension::IdIsValid(id)) { | 453 if (!extensions::Extension::IdIsValid(id)) { |
| 454 error_ = kInvalidIdError; | 454 error_ = kInvalidIdError; |
| 455 return false; | 455 return false; |
| 456 } | 456 } |
| 457 | 457 |
| 458 scoped_ptr<WebstoreInstaller::Approval> approval( | 458 scoped_ptr<WebstoreInstaller::Approval> approval( |
| 459 g_pending_approvals.Get().PopApproval(profile(), id)); | 459 g_pending_approvals.Get().PopApproval(profile(), id)); |
| 460 if (!approval.get()) { | 460 if (!approval.get()) { |
| 461 error_ = ExtensionErrorUtils::FormatErrorMessage( | 461 error_ = ExtensionErrorUtils::FormatErrorMessage( |
| 462 kNoPreviousBeginInstallWithManifestError, id); | 462 kNoPreviousBeginInstallWithManifestError, id); |
| 463 return false; | 463 return false; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 SendResponse(true); | 634 SendResponse(true); |
| 635 } else { | 635 } else { |
| 636 // Matched with a Release in OnGpuInfoUpdate. | 636 // Matched with a Release in OnGpuInfoUpdate. |
| 637 AddRef(); | 637 AddRef(); |
| 638 | 638 |
| 639 manager->AddObserver(this); | 639 manager->AddObserver(this); |
| 640 manager->RequestCompleteGpuInfoIfNeeded(); | 640 manager->RequestCompleteGpuInfoIfNeeded(); |
| 641 } | 641 } |
| 642 return true; | 642 return true; |
| 643 } | 643 } |
| OLD | NEW |