| 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_prompt.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_observer.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 ExtensionInstallPrompt::Delegate, | 41 public ExtensionInstallPrompt::Delegate, |
| 42 public WebstoreInstaller::Delegate, | 42 public WebstoreInstaller::Delegate, |
| 43 public BrowserList::Observer, | 43 public chrome::BrowserListObserver, |
| 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() {} |
| 52 virtual void OnBundleInstallCanceled(bool user_initiated) {} | 52 virtual void OnBundleInstallCanceled(bool user_initiated) {} |
| 53 virtual void OnBundleInstallCompleted() {} | 53 virtual void OnBundleInstallCompleted() {} |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 // ExtensionInstallPrompt::Delegate implementation: | 159 // ExtensionInstallPrompt::Delegate implementation: |
| 160 virtual void InstallUIProceed() OVERRIDE; | 160 virtual void InstallUIProceed() OVERRIDE; |
| 161 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 161 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
| 162 | 162 |
| 163 // WebstoreInstaller::Delegate implementation: | 163 // WebstoreInstaller::Delegate implementation: |
| 164 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; | 164 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; |
| 165 virtual void OnExtensionInstallFailure(const std::string& id, | 165 virtual void OnExtensionInstallFailure(const std::string& id, |
| 166 const std::string& error) OVERRIDE; | 166 const std::string& error) OVERRIDE; |
| 167 | 167 |
| 168 // BrowserList::observer implementation: | 168 // chrome::BrowserListObserver implementation: |
| 169 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; | 169 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; |
| 170 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 170 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; |
| 171 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; | 171 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; |
| 172 | 172 |
| 173 // Holds the Extensions used to generate the permission warnings. | 173 // Holds the Extensions used to generate the permission warnings. |
| 174 ExtensionList dummy_extensions_; | 174 ExtensionList dummy_extensions_; |
| 175 | 175 |
| 176 // Holds the parsed manifests, indexed by the extension ids. | 176 // Holds the parsed manifests, indexed by the extension ids. |
| 177 ManifestMap parsed_manifests_; | 177 ManifestMap parsed_manifests_; |
| 178 | 178 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 192 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 192 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
| 193 | 193 |
| 194 Delegate* delegate_; | 194 Delegate* delegate_; |
| 195 | 195 |
| 196 DISALLOW_COPY_AND_ASSIGN(BundleInstaller); | 196 DISALLOW_COPY_AND_ASSIGN(BundleInstaller); |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 } // namespace extensions | 199 } // namespace extensions |
| 200 | 200 |
| 201 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ | 201 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ |
| OLD | NEW |