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

Side by Side Diff: chrome/browser/extensions/bundle_installer.h

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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_BUNDLE_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h"
17 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
18 #include "chrome/browser/extensions/extension_install_prompt.h" 19 #include "chrome/browser/extensions/extension_install_prompt.h"
19 #include "chrome/browser/extensions/webstore_install_helper.h" 20 #include "chrome/browser/extensions/webstore_install_helper.h"
20 #include "chrome/browser/extensions/webstore_installer.h" 21 #include "chrome/browser/extensions/webstore_installer.h"
21 #include "chrome/browser/ui/browser_list_observer.h" 22 #include "chrome/browser/ui/browser_list_observer.h"
22 #include "chrome/browser/ui/host_desktop.h" 23 #include "chrome/browser/ui/host_desktop.h"
23 #include "extensions/common/extension.h" 24 #include "extensions/common/extension.h"
24 #include "third_party/skia/include/core/SkBitmap.h" 25 #include "third_party/skia/include/core/SkBitmap.h"
25 #include "url/gurl.h" 26 #include "url/gurl.h"
26 27
(...skipping 10 matching lines...) Expand all
37 38
38 namespace extensions { 39 namespace extensions {
39 40
40 // Manages the installation life cycle for extension bundles. 41 // Manages the installation life cycle for extension bundles.
41 // 42 //
42 // We install bundles in two steps: 43 // We install bundles in two steps:
43 // 1) PromptForApproval: parse manifests and prompt the user 44 // 1) PromptForApproval: parse manifests and prompt the user
44 // 2) CompleteInstall: install the CRXs and show confirmation bubble 45 // 2) CompleteInstall: install the CRXs and show confirmation bubble
45 // 46 //
46 class BundleInstaller : public WebstoreInstallHelper::Delegate, 47 class BundleInstaller : public WebstoreInstallHelper::Delegate,
47 public ExtensionInstallPrompt::Delegate,
48 public WebstoreInstaller::Delegate, 48 public WebstoreInstaller::Delegate,
49 public chrome::BrowserListObserver { 49 public chrome::BrowserListObserver {
50 public: 50 public:
51 // Auto approve or cancel the permission prompt. 51 // Auto approve or cancel the permission prompt.
52 static void SetAutoApproveForTesting(bool approve); 52 static void SetAutoApproveForTesting(bool approve);
53 53
54 // Represents an individual member of the bundle. 54 // Represents an individual member of the bundle.
55 struct Item { 55 struct Item {
56 // Items are in the PENDING state until they've been installed, or the 56 // Items are in the PENDING state until they've been installed, or the
57 // install has failed or been canceled. 57 // install has failed or been canceled.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void ShowInstalledBubbleIfDone(); 151 void ShowInstalledBubbleIfDone();
152 152
153 // WebstoreInstallHelper::Delegate implementation: 153 // WebstoreInstallHelper::Delegate implementation:
154 void OnWebstoreParseSuccess(const std::string& id, 154 void OnWebstoreParseSuccess(const std::string& id,
155 const SkBitmap& icon, 155 const SkBitmap& icon,
156 base::DictionaryValue* parsed_manifest) override; 156 base::DictionaryValue* parsed_manifest) override;
157 void OnWebstoreParseFailure(const std::string& id, 157 void OnWebstoreParseFailure(const std::string& id,
158 InstallHelperResultCode result_code, 158 InstallHelperResultCode result_code,
159 const std::string& error_message) override; 159 const std::string& error_message) override;
160 160
161 // ExtensionInstallPrompt::Delegate implementation:
162 void InstallUIProceed() override;
163 void InstallUIAbort(bool user_initiated) override;
164
165 // WebstoreInstaller::Delegate implementation: 161 // WebstoreInstaller::Delegate implementation:
166 void OnExtensionInstallSuccess(const std::string& id) override; 162 void OnExtensionInstallSuccess(const std::string& id) override;
167 void OnExtensionInstallFailure( 163 void OnExtensionInstallFailure(
168 const std::string& id, 164 const std::string& id,
169 const std::string& error, 165 const std::string& error,
170 WebstoreInstaller::FailureReason reason) override; 166 WebstoreInstaller::FailureReason reason) override;
171 167
172 // chrome::BrowserListObserver implementation: 168 // chrome::BrowserListObserver implementation:
173 void OnBrowserRemoved(Browser* browser) override; 169 void OnBrowserRemoved(Browser* browser) override;
174 170
171 void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
172
175 // Holds the Extensions used to generate the permission warnings. 173 // Holds the Extensions used to generate the permission warnings.
176 ExtensionList dummy_extensions_; 174 ExtensionList dummy_extensions_;
177 175
178 // Holds the parsed manifests, indexed by the extension ids. 176 // Holds the parsed manifests, indexed by the extension ids.
179 ManifestMap parsed_manifests_; 177 ManifestMap parsed_manifests_;
180 178
181 // True if the user has approved the bundle. 179 // True if the user has approved the bundle.
182 bool approved_; 180 bool approved_;
183 181
184 // Holds the bundle's Items, indexed by their ids. 182 // Holds the bundle's Items, indexed by their ids.
(...skipping 21 matching lines...) Expand all
206 204
207 // The profile that the bundle should be installed in. 205 // The profile that the bundle should be installed in.
208 Profile* profile_; 206 Profile* profile_;
209 207
210 // The UI that shows the confirmation prompt. 208 // The UI that shows the confirmation prompt.
211 scoped_ptr<ExtensionInstallPrompt> install_ui_; 209 scoped_ptr<ExtensionInstallPrompt> install_ui_;
212 210
213 ApprovalCallback approval_callback_; 211 ApprovalCallback approval_callback_;
214 base::Closure install_callback_; 212 base::Closure install_callback_;
215 213
214 base::WeakPtrFactory<BundleInstaller> weak_factory_;
215
216 DISALLOW_COPY_AND_ASSIGN(BundleInstaller); 216 DISALLOW_COPY_AND_ASSIGN(BundleInstaller);
217 }; 217 };
218 218
219 } // namespace extensions 219 } // namespace extensions
220 220
221 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ 221 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/webstore_private/webstore_private_api.cc ('k') | chrome/browser/extensions/bundle_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698