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/api/webstore_private/webstore_private_api.h" | 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
6 | 6 |
7 #include "apps/app_launcher.h" | 7 #include "apps/app_launcher.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // The response is sent asynchronously in OnWebstoreParseSuccess/ | 350 // The response is sent asynchronously in OnWebstoreParseSuccess/ |
351 // OnWebstoreParseFailure. | 351 // OnWebstoreParseFailure. |
352 return true; | 352 return true; |
353 } | 353 } |
354 | 354 |
355 | 355 |
356 void WebstorePrivateBeginInstallWithManifest3Function::SetResultCode( | 356 void WebstorePrivateBeginInstallWithManifest3Function::SetResultCode( |
357 ResultCode code) { | 357 ResultCode code) { |
358 switch (code) { | 358 switch (code) { |
359 case ERROR_NONE: | 359 case ERROR_NONE: |
360 SetResult(Value::CreateStringValue(std::string())); | 360 SetResult(new base::StringValue(std::string())); |
361 break; | 361 break; |
362 case UNKNOWN_ERROR: | 362 case UNKNOWN_ERROR: |
363 SetResult(Value::CreateStringValue("unknown_error")); | 363 SetResult(new base::StringValue("unknown_error")); |
364 break; | 364 break; |
365 case USER_CANCELLED: | 365 case USER_CANCELLED: |
366 SetResult(Value::CreateStringValue("user_cancelled")); | 366 SetResult(new base::StringValue("user_cancelled")); |
367 break; | 367 break; |
368 case MANIFEST_ERROR: | 368 case MANIFEST_ERROR: |
369 SetResult(Value::CreateStringValue("manifest_error")); | 369 SetResult(new base::StringValue("manifest_error")); |
370 break; | 370 break; |
371 case ICON_ERROR: | 371 case ICON_ERROR: |
372 SetResult(Value::CreateStringValue("icon_error")); | 372 SetResult(new base::StringValue("icon_error")); |
373 break; | 373 break; |
374 case INVALID_ID: | 374 case INVALID_ID: |
375 SetResult(Value::CreateStringValue("invalid_id")); | 375 SetResult(new base::StringValue("invalid_id")); |
376 break; | 376 break; |
377 case PERMISSION_DENIED: | 377 case PERMISSION_DENIED: |
378 SetResult(Value::CreateStringValue("permission_denied")); | 378 SetResult(new base::StringValue("permission_denied")); |
379 break; | 379 break; |
380 case INVALID_ICON_URL: | 380 case INVALID_ICON_URL: |
381 SetResult(Value::CreateStringValue("invalid_icon_url")); | 381 SetResult(new base::StringValue("invalid_icon_url")); |
382 break; | 382 break; |
383 case SIGNIN_FAILED: | 383 case SIGNIN_FAILED: |
384 SetResult(Value::CreateStringValue("signin_failed")); | 384 SetResult(new base::StringValue("signin_failed")); |
385 break; | 385 break; |
386 case ALREADY_INSTALLED: | 386 case ALREADY_INSTALLED: |
387 SetResult(Value::CreateStringValue("already_installed")); | 387 SetResult(new base::StringValue("already_installed")); |
388 break; | 388 break; |
389 default: | 389 default: |
390 CHECK(false); | 390 CHECK(false); |
391 } | 391 } |
392 } | 392 } |
393 | 393 |
394 void WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess( | 394 void WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess( |
395 const std::string& id, | 395 const std::string& id, |
396 const SkBitmap& icon, | 396 const SkBitmap& icon, |
397 base::DictionaryValue* parsed_manifest) { | 397 base::DictionaryValue* parsed_manifest) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 SendResponse(true); | 633 SendResponse(true); |
634 return true; | 634 return true; |
635 } | 635 } |
636 | 636 |
637 bool WebstorePrivateGetBrowserLoginFunction::RunImpl() { | 637 bool WebstorePrivateGetBrowserLoginFunction::RunImpl() { |
638 SetResult(CreateLoginResult(profile_->GetOriginalProfile())); | 638 SetResult(CreateLoginResult(profile_->GetOriginalProfile())); |
639 return true; | 639 return true; |
640 } | 640 } |
641 | 641 |
642 bool WebstorePrivateGetStoreLoginFunction::RunImpl() { | 642 bool WebstorePrivateGetStoreLoginFunction::RunImpl() { |
643 SetResult(Value::CreateStringValue(GetWebstoreLogin(profile_))); | 643 SetResult(new base::StringValue(GetWebstoreLogin(profile_))); |
644 return true; | 644 return true; |
645 } | 645 } |
646 | 646 |
647 bool WebstorePrivateSetStoreLoginFunction::RunImpl() { | 647 bool WebstorePrivateSetStoreLoginFunction::RunImpl() { |
648 std::string login; | 648 std::string login; |
649 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login)); | 649 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login)); |
650 SetWebstoreLogin(profile_, login); | 650 SetWebstoreLogin(profile_, login); |
651 return true; | 651 return true; |
652 } | 652 } |
653 | 653 |
654 WebstorePrivateGetWebGLStatusFunction::WebstorePrivateGetWebGLStatusFunction() { | 654 WebstorePrivateGetWebGLStatusFunction::WebstorePrivateGetWebGLStatusFunction() { |
655 feature_checker_ = new GPUFeatureChecker( | 655 feature_checker_ = new GPUFeatureChecker( |
656 gpu::GPU_FEATURE_TYPE_WEBGL, | 656 gpu::GPU_FEATURE_TYPE_WEBGL, |
657 base::Bind(&WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck, | 657 base::Bind(&WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck, |
658 base::Unretained(this))); | 658 base::Unretained(this))); |
659 } | 659 } |
660 | 660 |
661 WebstorePrivateGetWebGLStatusFunction:: | 661 WebstorePrivateGetWebGLStatusFunction:: |
662 ~WebstorePrivateGetWebGLStatusFunction() {} | 662 ~WebstorePrivateGetWebGLStatusFunction() {} |
663 | 663 |
664 void WebstorePrivateGetWebGLStatusFunction::CreateResult(bool webgl_allowed) { | 664 void WebstorePrivateGetWebGLStatusFunction::CreateResult(bool webgl_allowed) { |
665 SetResult(Value::CreateStringValue( | 665 SetResult(new base::StringValue( |
666 webgl_allowed ? "webgl_allowed" : "webgl_blocked")); | 666 webgl_allowed ? "webgl_allowed" : "webgl_blocked")); |
667 } | 667 } |
668 | 668 |
669 bool WebstorePrivateGetWebGLStatusFunction::RunImpl() { | 669 bool WebstorePrivateGetWebGLStatusFunction::RunImpl() { |
670 feature_checker_->CheckGPUFeatureAvailability(); | 670 feature_checker_->CheckGPUFeatureAvailability(); |
671 return true; | 671 return true; |
672 } | 672 } |
673 | 673 |
674 void WebstorePrivateGetWebGLStatusFunction:: | 674 void WebstorePrivateGetWebGLStatusFunction:: |
675 OnFeatureCheck(bool feature_allowed) { | 675 OnFeatureCheck(bool feature_allowed) { |
676 CreateResult(feature_allowed); | 676 CreateResult(feature_allowed); |
677 SendResponse(true); | 677 SendResponse(true); |
678 } | 678 } |
679 | 679 |
680 bool WebstorePrivateGetIsLauncherEnabledFunction::RunImpl() { | 680 bool WebstorePrivateGetIsLauncherEnabledFunction::RunImpl() { |
681 SetResult(Value::CreateBooleanValue(apps::IsAppLauncherEnabled())); | 681 SetResult(new base::FundamentalValue(apps::IsAppLauncherEnabled())); |
682 SendResponse(true); | 682 SendResponse(true); |
683 return true; | 683 return true; |
684 } | 684 } |
685 | 685 |
686 bool WebstorePrivateIsInIncognitoModeFunction::RunImpl() { | 686 bool WebstorePrivateIsInIncognitoModeFunction::RunImpl() { |
687 SetResult( | 687 SetResult( |
688 Value::CreateBooleanValue(profile_ != profile_->GetOriginalProfile())); | 688 new base::FundamentalValue(profile_ != profile_->GetOriginalProfile())); |
689 SendResponse(true); | 689 SendResponse(true); |
690 return true; | 690 return true; |
691 } | 691 } |
692 | 692 |
693 } // namespace extensions | 693 } // namespace extensions |
OLD | NEW |