| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" | 12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" |
| 12 #include "chrome/browser/extensions/bundle_installer.h" | 13 #include "chrome/browser/extensions/bundle_installer.h" |
| 13 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 14 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
| 14 #include "chrome/browser/extensions/extension_install_prompt.h" | 15 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 15 #include "chrome/browser/extensions/webstore_install_helper.h" | 16 #include "chrome/browser/extensions/webstore_install_helper.h" |
| 16 #include "chrome/common/extensions/api/dashboard_private.h" | 17 #include "chrome/common/extensions/api/dashboard_private.h" |
| 17 #include "extensions/browser/extension_function.h" | 18 #include "extensions/browser/extension_function.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 | 20 |
| 20 class GURL; | 21 class GURL; |
| 21 | 22 |
| 22 namespace chrome { | 23 namespace chrome { |
| 23 class BitmapFetcher; | 24 class BitmapFetcher; |
| 24 } // namespace chrome | 25 } // namespace chrome |
| 25 | 26 |
| 26 namespace extensions { | 27 namespace extensions { |
| 27 | 28 |
| 28 class Extension; | 29 class Extension; |
| 29 | 30 |
| 30 class DashboardPrivateShowPermissionPromptForDelegatedInstallFunction | 31 class DashboardPrivateShowPermissionPromptForDelegatedInstallFunction |
| 31 : public UIThreadExtensionFunction, | 32 : public UIThreadExtensionFunction, |
| 32 public ExtensionInstallPrompt::Delegate, | |
| 33 public WebstoreInstallHelper::Delegate { | 33 public WebstoreInstallHelper::Delegate { |
| 34 public: | 34 public: |
| 35 DECLARE_EXTENSION_FUNCTION( | 35 DECLARE_EXTENSION_FUNCTION( |
| 36 "dashboardPrivate.showPermissionPromptForDelegatedInstall", | 36 "dashboardPrivate.showPermissionPromptForDelegatedInstall", |
| 37 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL) | 37 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL) |
| 38 | 38 |
| 39 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction(); | 39 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction(); |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 using Params = | 42 using Params = |
| 43 api::dashboard_private::ShowPermissionPromptForDelegatedInstall::Params; | 43 api::dashboard_private::ShowPermissionPromptForDelegatedInstall::Params; |
| 44 | 44 |
| 45 ~DashboardPrivateShowPermissionPromptForDelegatedInstallFunction() override; | 45 ~DashboardPrivateShowPermissionPromptForDelegatedInstallFunction() override; |
| 46 | 46 |
| 47 // ExtensionFunction: | 47 // ExtensionFunction: |
| 48 ExtensionFunction::ResponseAction Run() override; | 48 ExtensionFunction::ResponseAction Run() override; |
| 49 | 49 |
| 50 // WebstoreInstallHelper::Delegate: | 50 // WebstoreInstallHelper::Delegate: |
| 51 void OnWebstoreParseSuccess(const std::string& id, | 51 void OnWebstoreParseSuccess(const std::string& id, |
| 52 const SkBitmap& icon, | 52 const SkBitmap& icon, |
| 53 base::DictionaryValue* parsed_manifest) override; | 53 base::DictionaryValue* parsed_manifest) override; |
| 54 void OnWebstoreParseFailure(const std::string& id, | 54 void OnWebstoreParseFailure(const std::string& id, |
| 55 InstallHelperResultCode result, | 55 InstallHelperResultCode result, |
| 56 const std::string& error_message) override; | 56 const std::string& error_message) override; |
| 57 | 57 |
| 58 // ExtensionInstallPrompt::Delegate: | 58 void OnInstallPromptDone(ExtensionInstallPrompt::Result result); |
| 59 void InstallUIProceed() override; | |
| 60 void InstallUIAbort(bool user_initiated) override; | |
| 61 | 59 |
| 62 ExtensionFunction::ResponseValue BuildResponse( | 60 ExtensionFunction::ResponseValue BuildResponse( |
| 63 api::dashboard_private::Result result, | 61 api::dashboard_private::Result result, |
| 64 const std::string& error); | 62 const std::string& error); |
| 65 scoped_ptr<base::ListValue> CreateResults( | 63 scoped_ptr<base::ListValue> CreateResults( |
| 66 api::dashboard_private::Result result) const; | 64 api::dashboard_private::Result result) const; |
| 67 | 65 |
| 68 const Params::Details& details() const { return params_->details; } | 66 const Params::Details& details() const { return params_->details; } |
| 69 | 67 |
| 70 scoped_ptr<Params> params_; | 68 scoped_ptr<Params> params_; |
| 71 | 69 |
| 72 // A dummy Extension object we create for the purposes of using | 70 // A dummy Extension object we create for the purposes of using |
| 73 // ExtensionInstallPrompt to prompt for confirmation of the install. | 71 // ExtensionInstallPrompt to prompt for confirmation of the install. |
| 74 scoped_refptr<Extension> dummy_extension_; | 72 scoped_refptr<Extension> dummy_extension_; |
| 75 | 73 |
| 76 scoped_ptr<ExtensionInstallPrompt> install_prompt_; | 74 scoped_ptr<ExtensionInstallPrompt> install_prompt_; |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN( |
| 77 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 class DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction | 80 class DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction |
| 80 : public UIThreadExtensionFunction, | 81 : public UIThreadExtensionFunction, |
| 81 public chrome::BitmapFetcherDelegate { | 82 public chrome::BitmapFetcherDelegate { |
| 82 public: | 83 public: |
| 83 DECLARE_EXTENSION_FUNCTION( | 84 DECLARE_EXTENSION_FUNCTION( |
| 84 "dashboardPrivate.showPermissionPromptForDelegatedBundleInstall", | 85 "dashboardPrivate.showPermissionPromptForDelegatedBundleInstall", |
| 85 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDBUNDLEINSTALL) | 86 DASHBOARDPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDBUNDLEINSTALL) |
| 86 | 87 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 108 scoped_ptr<Params> params_; | 109 scoped_ptr<Params> params_; |
| 109 | 110 |
| 110 scoped_ptr<extensions::BundleInstaller> bundle_; | 111 scoped_ptr<extensions::BundleInstaller> bundle_; |
| 111 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; | 112 scoped_ptr<chrome::BitmapFetcher> icon_fetcher_; |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 } // namespace extensions | 115 } // namespace extensions |
| 115 | 116 |
| 116 #endif // CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API
_H_ | 117 #endif // CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API
_H_ |
| 117 | 118 |
| OLD | NEW |