| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 // Matches the AddRef in RunImpl(). | 624 // Matches the AddRef in RunImpl(). |
| 625 Release(); | 625 Release(); |
| 626 } | 626 } |
| 627 | 627 |
| 628 WebstorePrivateEnableAppLauncherFunction:: | 628 WebstorePrivateEnableAppLauncherFunction:: |
| 629 WebstorePrivateEnableAppLauncherFunction() {} | 629 WebstorePrivateEnableAppLauncherFunction() {} |
| 630 | 630 |
| 631 WebstorePrivateEnableAppLauncherFunction:: | 631 WebstorePrivateEnableAppLauncherFunction:: |
| 632 ~WebstorePrivateEnableAppLauncherFunction() {} | 632 ~WebstorePrivateEnableAppLauncherFunction() {} |
| 633 | 633 |
| 634 bool WebstorePrivateEnableAppLauncherFunction::RunImpl() { | 634 bool WebstorePrivateEnableAppLauncherFunction::RunSync() { |
| 635 AppListService::Get(GetCurrentBrowser()->host_desktop_type()) | 635 AppListService::Get(GetCurrentBrowser()->host_desktop_type()) |
| 636 ->EnableAppList(GetProfile(), AppListService::ENABLE_VIA_WEBSTORE_LINK); | 636 ->EnableAppList(GetProfile(), AppListService::ENABLE_VIA_WEBSTORE_LINK); |
| 637 return true; | 637 return true; |
| 638 } | 638 } |
| 639 | 639 |
| 640 bool WebstorePrivateGetBrowserLoginFunction::RunImpl() { | 640 bool WebstorePrivateGetBrowserLoginFunction::RunSync() { |
| 641 GetBrowserLogin::Results::Info info; | 641 GetBrowserLogin::Results::Info info; |
| 642 info.login = GetProfile()->GetOriginalProfile()->GetPrefs()->GetString( | 642 info.login = GetProfile()->GetOriginalProfile()->GetPrefs()->GetString( |
| 643 prefs::kGoogleServicesUsername); | 643 prefs::kGoogleServicesUsername); |
| 644 results_ = GetBrowserLogin::Results::Create(info); | 644 results_ = GetBrowserLogin::Results::Create(info); |
| 645 return true; | 645 return true; |
| 646 } | 646 } |
| 647 | 647 |
| 648 bool WebstorePrivateGetStoreLoginFunction::RunImpl() { | 648 bool WebstorePrivateGetStoreLoginFunction::RunSync() { |
| 649 results_ = GetStoreLogin::Results::Create(GetWebstoreLogin(GetProfile())); | 649 results_ = GetStoreLogin::Results::Create(GetWebstoreLogin(GetProfile())); |
| 650 return true; | 650 return true; |
| 651 } | 651 } |
| 652 | 652 |
| 653 bool WebstorePrivateSetStoreLoginFunction::RunImpl() { | 653 bool WebstorePrivateSetStoreLoginFunction::RunSync() { |
| 654 scoped_ptr<SetStoreLogin::Params> params( | 654 scoped_ptr<SetStoreLogin::Params> params( |
| 655 SetStoreLogin::Params::Create(*args_)); | 655 SetStoreLogin::Params::Create(*args_)); |
| 656 EXTENSION_FUNCTION_VALIDATE(params); | 656 EXTENSION_FUNCTION_VALIDATE(params); |
| 657 SetWebstoreLogin(GetProfile(), params->login); | 657 SetWebstoreLogin(GetProfile(), params->login); |
| 658 return true; | 658 return true; |
| 659 } | 659 } |
| 660 | 660 |
| 661 WebstorePrivateGetWebGLStatusFunction::WebstorePrivateGetWebGLStatusFunction() { | 661 WebstorePrivateGetWebGLStatusFunction::WebstorePrivateGetWebGLStatusFunction() { |
| 662 feature_checker_ = new GPUFeatureChecker( | 662 feature_checker_ = new GPUFeatureChecker( |
| 663 gpu::GPU_FEATURE_TYPE_WEBGL, | 663 gpu::GPU_FEATURE_TYPE_WEBGL, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 677 feature_checker_->CheckGPUFeatureAvailability(); | 677 feature_checker_->CheckGPUFeatureAvailability(); |
| 678 return true; | 678 return true; |
| 679 } | 679 } |
| 680 | 680 |
| 681 void WebstorePrivateGetWebGLStatusFunction:: | 681 void WebstorePrivateGetWebGLStatusFunction:: |
| 682 OnFeatureCheck(bool feature_allowed) { | 682 OnFeatureCheck(bool feature_allowed) { |
| 683 CreateResult(feature_allowed); | 683 CreateResult(feature_allowed); |
| 684 SendResponse(true); | 684 SendResponse(true); |
| 685 } | 685 } |
| 686 | 686 |
| 687 bool WebstorePrivateGetIsLauncherEnabledFunction::RunImpl() { | 687 bool WebstorePrivateGetIsLauncherEnabledFunction::RunSync() { |
| 688 results_ = GetIsLauncherEnabled::Results::Create(IsAppLauncherEnabled()); | 688 results_ = GetIsLauncherEnabled::Results::Create(IsAppLauncherEnabled()); |
| 689 return true; | 689 return true; |
| 690 } | 690 } |
| 691 | 691 |
| 692 bool WebstorePrivateIsInIncognitoModeFunction::RunImpl() { | 692 bool WebstorePrivateIsInIncognitoModeFunction::RunSync() { |
| 693 results_ = IsInIncognitoMode::Results::Create( | 693 results_ = IsInIncognitoMode::Results::Create( |
| 694 GetProfile() != GetProfile()->GetOriginalProfile()); | 694 GetProfile() != GetProfile()->GetOriginalProfile()); |
| 695 return true; | 695 return true; |
| 696 } | 696 } |
| 697 | 697 |
| 698 WebstorePrivateSignInFunction::WebstorePrivateSignInFunction() | 698 WebstorePrivateSignInFunction::WebstorePrivateSignInFunction() |
| 699 : signin_manager_(NULL) {} | 699 : signin_manager_(NULL) {} |
| 700 WebstorePrivateSignInFunction::~WebstorePrivateSignInFunction() {} | 700 WebstorePrivateSignInFunction::~WebstorePrivateSignInFunction() {} |
| 701 | 701 |
| 702 bool WebstorePrivateSignInFunction::RunImpl() { | 702 bool WebstorePrivateSignInFunction::RunImpl() { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 } else { | 786 } else { |
| 787 error_ = "merge_session_failed"; | 787 error_ = "merge_session_failed"; |
| 788 SendResponse(false); | 788 SendResponse(false); |
| 789 } | 789 } |
| 790 | 790 |
| 791 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 791 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
| 792 Release(); // Balanced in RunImpl(). | 792 Release(); // Balanced in RunImpl(). |
| 793 } | 793 } |
| 794 | 794 |
| 795 } // namespace extensions | 795 } // namespace extensions |
| OLD | NEW |