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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 ExtensionService::RecordPermissionMessagesHistogram( | 441 ExtensionService::RecordPermissionMessagesHistogram( |
442 dummy_extension_, histogram_name.c_str()); | 442 dummy_extension_, histogram_name.c_str()); |
443 | 443 |
444 // Matches the AddRef in RunImpl(). | 444 // Matches the AddRef in RunImpl(). |
445 Release(); | 445 Release(); |
446 } | 446 } |
447 | 447 |
448 bool CompleteInstallFunction::RunImpl() { | 448 bool CompleteInstallFunction::RunImpl() { |
449 std::string id; | 449 std::string id; |
450 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); | 450 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); |
451 if (!Extension::IdIsValid(id)) { | 451 if (!extensions::Extension::IdIsValid(id)) { |
452 error_ = kInvalidIdError; | 452 error_ = kInvalidIdError; |
453 return false; | 453 return false; |
454 } | 454 } |
455 | 455 |
456 scoped_ptr<WebstoreInstaller::Approval> approval( | 456 scoped_ptr<WebstoreInstaller::Approval> approval( |
457 g_pending_approvals.Get().PopApproval(profile(), id)); | 457 g_pending_approvals.Get().PopApproval(profile(), id)); |
458 if (!approval.get()) { | 458 if (!approval.get()) { |
459 error_ = ExtensionErrorUtils::FormatErrorMessage( | 459 error_ = ExtensionErrorUtils::FormatErrorMessage( |
460 kNoPreviousBeginInstallWithManifestError, id); | 460 kNoPreviousBeginInstallWithManifestError, id); |
461 return false; | 461 return false; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 SendResponse(true); | 629 SendResponse(true); |
630 } else { | 630 } else { |
631 // Matched with a Release in OnGpuInfoUpdate. | 631 // Matched with a Release in OnGpuInfoUpdate. |
632 AddRef(); | 632 AddRef(); |
633 | 633 |
634 manager->AddObserver(this); | 634 manager->AddObserver(this); |
635 manager->RequestCompleteGpuInfoIfNeeded(); | 635 manager->RequestCompleteGpuInfoIfNeeded(); |
636 } | 636 } |
637 return true; | 637 return true; |
638 } | 638 } |
OLD | NEW |