Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_api.h

Issue 10388252: Refactoring ExtenionInstallUI to abstract the Browser references. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced + mac fix Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/extensions/bundle_installer.h" 11 #include "chrome/browser/extensions/bundle_installer.h"
12 #include "chrome/browser/extensions/extension_function.h" 12 #include "chrome/browser/extensions/extension_function.h"
13 #include "chrome/browser/extensions/extension_install_ui.h" 13 #include "chrome/browser/extensions/extension_install_prompt.h"
14 #include "chrome/browser/extensions/webstore_install_helper.h" 14 #include "chrome/browser/extensions/webstore_install_helper.h"
15 #include "chrome/browser/extensions/webstore_installer.h" 15 #include "chrome/browser/extensions/webstore_installer.h"
16 #include "chrome/common/net/gaia/google_service_auth_error.h" 16 #include "chrome/common/net/gaia/google_service_auth_error.h"
17 #include "content/public/browser/gpu_data_manager_observer.h" 17 #include "content/public/browser/gpu_data_manager_observer.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 20
21 class ProfileSyncService; 21 class ProfileSyncService;
22 22
23 namespace content { 23 namespace content {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Reads the extension |details| into |items|. 68 // Reads the extension |details| into |items|.
69 bool ReadBundleInfo(base::ListValue* details, 69 bool ReadBundleInfo(base::ListValue* details,
70 extensions::BundleInstaller::ItemList* items); 70 extensions::BundleInstaller::ItemList* items);
71 71
72 private: 72 private:
73 scoped_refptr<extensions::BundleInstaller> bundle_; 73 scoped_refptr<extensions::BundleInstaller> bundle_;
74 }; 74 };
75 75
76 class BeginInstallWithManifestFunction 76 class BeginInstallWithManifestFunction
77 : public AsyncExtensionFunction, 77 : public AsyncExtensionFunction,
78 public ExtensionInstallUI::Delegate, 78 public ExtensionInstallPrompt::Delegate,
79 public WebstoreInstallHelper::Delegate { 79 public WebstoreInstallHelper::Delegate {
80 public: 80 public:
81 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest3"); 81 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest3");
82 82
83 // Result codes for the return value. If you change this, make sure to 83 // Result codes for the return value. If you change this, make sure to
84 // update the description for the beginInstallWithManifest3 callback in 84 // update the description for the beginInstallWithManifest3 callback in
85 // the extension API JSON. 85 // the extension API JSON.
86 enum ResultCode { 86 enum ResultCode {
87 ERROR_NONE = 0, 87 ERROR_NONE = 0,
88 88
(...skipping 24 matching lines...) Expand all
113 // WebstoreInstallHelper::Delegate: 113 // WebstoreInstallHelper::Delegate:
114 virtual void OnWebstoreParseSuccess( 114 virtual void OnWebstoreParseSuccess(
115 const std::string& id, 115 const std::string& id,
116 const SkBitmap& icon, 116 const SkBitmap& icon,
117 base::DictionaryValue* parsed_manifest) OVERRIDE; 117 base::DictionaryValue* parsed_manifest) OVERRIDE;
118 virtual void OnWebstoreParseFailure( 118 virtual void OnWebstoreParseFailure(
119 const std::string& id, 119 const std::string& id,
120 InstallHelperResultCode result_code, 120 InstallHelperResultCode result_code,
121 const std::string& error_message) OVERRIDE; 121 const std::string& error_message) OVERRIDE;
122 122
123 // ExtensionInstallUI::Delegate: 123 // ExtensionInstallPrompt::Delegate:
124 virtual void InstallUIProceed() OVERRIDE; 124 virtual void InstallUIProceed() OVERRIDE;
125 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; 125 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
126 126
127 protected: 127 protected:
128 virtual ~BeginInstallWithManifestFunction(); 128 virtual ~BeginInstallWithManifestFunction();
129 129
130 // ExtensionFunction: 130 // ExtensionFunction:
131 virtual bool RunImpl() OVERRIDE; 131 virtual bool RunImpl() OVERRIDE;
132 132
133 // Sets the result_ as a string based on |code|. 133 // Sets the result_ as a string based on |code|.
134 void SetResult(ResultCode code); 134 void SetResult(ResultCode code);
135 135
136 private: 136 private:
137 // These store the input parameters to the function. 137 // These store the input parameters to the function.
138 std::string id_; 138 std::string id_;
139 std::string manifest_; 139 std::string manifest_;
140 std::string icon_data_; 140 std::string icon_data_;
141 std::string localized_name_; 141 std::string localized_name_;
142 bool use_app_installed_bubble_; 142 bool use_app_installed_bubble_;
143 143
144 // The results of parsing manifest_ and icon_data_ go into these two. 144 // The results of parsing manifest_ and icon_data_ go into these two.
145 scoped_ptr<base::DictionaryValue> parsed_manifest_; 145 scoped_ptr<base::DictionaryValue> parsed_manifest_;
146 SkBitmap icon_; 146 SkBitmap icon_;
147 147
148 // A dummy Extension object we create for the purposes of using 148 // A dummy Extension object we create for the purposes of using
149 // ExtensionInstallUI to prompt for confirmation of the install. 149 // ExtensionInstallPrompt to prompt for confirmation of the install.
150 scoped_refptr<extensions::Extension> dummy_extension_; 150 scoped_refptr<extensions::Extension> dummy_extension_;
151 151
152 // The class that displays the install prompt. 152 // The class that displays the install prompt.
153 scoped_ptr<ExtensionInstallUI> install_ui_; 153 scoped_ptr<ExtensionInstallPrompt> install_prompt_;
154 }; 154 };
155 155
156 class CompleteInstallFunction : public SyncExtensionFunction { 156 class CompleteInstallFunction : public SyncExtensionFunction {
157 public: 157 public:
158 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall"); 158 DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.completeInstall");
159 159
160 protected: 160 protected:
161 virtual ~CompleteInstallFunction() {} 161 virtual ~CompleteInstallFunction() {}
162 162
163 // ExtensionFunction: 163 // ExtensionFunction:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void CreateResult(bool webgl_allowed); 251 void CreateResult(bool webgl_allowed);
252 252
253 // A false return value is always valid, but a true one is only valid if full 253 // A false return value is always valid, but a true one is only valid if full
254 // GPU info has been collected in a GPU process. 254 // GPU info has been collected in a GPU process.
255 static bool IsWebGLAllowed(content::GpuDataManager* manager); 255 static bool IsWebGLAllowed(content::GpuDataManager* manager);
256 }; 256 };
257 257
258 } // namespace extensions 258 } // namespace extensions
259 259
260 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _ 260 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698