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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "chrome/browser/extensions/extension_install_ui.h" | 15 #include "chrome/browser/extensions/extension_install_prompt.h" |
16 #include "chrome/browser/extensions/webstore_installer.h" | 16 #include "chrome/browser/extensions/webstore_installer.h" |
17 #include "chrome/browser/extensions/webstore_install_helper.h" | 17 #include "chrome/browser/extensions/webstore_install_helper.h" |
18 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class DictionaryValue; | 22 class DictionaryValue; |
23 } // namespace base | 23 } // namespace base |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 class NavigationController; | 26 class NavigationController; |
27 } // namespace content | 27 } // namespace content |
28 | 28 |
29 class Browser; | 29 class Browser; |
30 class Profile; | 30 class Profile; |
31 | 31 |
32 namespace extensions { | 32 namespace extensions { |
33 | 33 |
34 // Manages the installation life cycle for extension bundles. | 34 // Manages the installation life cycle for extension bundles. |
35 // | 35 // |
36 // We install bundles in two steps: | 36 // We install bundles in two steps: |
37 // 1) PromptForApproval: parse manifests and prompt the user | 37 // 1) PromptForApproval: parse manifests and prompt the user |
38 // 2) CompleteInstall: install the CRXs and show confirmation bubble | 38 // 2) CompleteInstall: install the CRXs and show confirmation bubble |
39 // | 39 // |
40 class BundleInstaller : public WebstoreInstallHelper::Delegate, | 40 class BundleInstaller : public WebstoreInstallHelper::Delegate, |
41 public ExtensionInstallUI::Delegate, | 41 public ExtensionInstallPrompt::Delegate, |
42 public WebstoreInstaller::Delegate, | 42 public WebstoreInstaller::Delegate, |
43 public BrowserList::Observer, | 43 public BrowserList::Observer, |
44 public base::RefCountedThreadSafe<BundleInstaller> { | 44 public base::RefCountedThreadSafe<BundleInstaller> { |
45 public: | 45 public: |
46 // Auto approve or cancel the permission prompt. | 46 // Auto approve or cancel the permission prompt. |
47 static void SetAutoApproveForTesting(bool approve); | 47 static void SetAutoApproveForTesting(bool approve); |
48 | 48 |
49 class Delegate { | 49 class Delegate { |
50 public: | 50 public: |
51 virtual void OnBundleInstallApproved() {} | 51 virtual void OnBundleInstallApproved() {} |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // WebstoreInstallHelper::Delegate implementation: | 147 // WebstoreInstallHelper::Delegate implementation: |
148 virtual void OnWebstoreParseSuccess( | 148 virtual void OnWebstoreParseSuccess( |
149 const std::string& id, | 149 const std::string& id, |
150 const SkBitmap& icon, | 150 const SkBitmap& icon, |
151 base::DictionaryValue* parsed_manifest) OVERRIDE; | 151 base::DictionaryValue* parsed_manifest) OVERRIDE; |
152 virtual void OnWebstoreParseFailure( | 152 virtual void OnWebstoreParseFailure( |
153 const std::string& id, | 153 const std::string& id, |
154 InstallHelperResultCode result_code, | 154 InstallHelperResultCode result_code, |
155 const std::string& error_message) OVERRIDE; | 155 const std::string& error_message) OVERRIDE; |
156 | 156 |
157 // ExtensionInstallUI::Delegate implementation: | 157 // ExtensionInstallPrompt::Delegate implementation: |
158 virtual void InstallUIProceed() OVERRIDE; | 158 virtual void InstallUIProceed() OVERRIDE; |
159 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 159 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
160 | 160 |
161 // WebstoreInstaller::Delegate implementation: | 161 // WebstoreInstaller::Delegate implementation: |
162 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; | 162 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; |
163 virtual void OnExtensionInstallFailure(const std::string& id, | 163 virtual void OnExtensionInstallFailure(const std::string& id, |
164 const std::string& error) OVERRIDE; | 164 const std::string& error) OVERRIDE; |
165 | 165 |
166 // BrowserList::observer implementation: | 166 // BrowserList::observer implementation: |
167 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; | 167 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
180 // Holds the bundle's Items, indexed by their ids. | 180 // Holds the bundle's Items, indexed by their ids. |
181 ItemMap items_; | 181 ItemMap items_; |
182 | 182 |
183 // The browser to show the confirmation bubble for. | 183 // The browser to show the confirmation bubble for. |
184 Browser* browser_; | 184 Browser* browser_; |
185 | 185 |
186 // The profile that the bundle should be installed in. | 186 // The profile that the bundle should be installed in. |
187 Profile* profile_; | 187 Profile* profile_; |
188 | 188 |
189 // The UI that shows the confirmation prompt. | 189 // The UI that shows the confirmation prompt. |
190 scoped_ptr<ExtensionInstallUI> install_ui_; | 190 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
191 | 191 |
192 Delegate* delegate_; | 192 Delegate* delegate_; |
193 | 193 |
194 DISALLOW_COPY_AND_ASSIGN(BundleInstaller); | 194 DISALLOW_COPY_AND_ASSIGN(BundleInstaller); |
195 }; | 195 }; |
196 | 196 |
197 } // namespace extensions | 197 } // namespace extensions |
198 | 198 |
199 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ | 199 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ |
OLD | NEW |