| 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_EXTENSION_INSTALL_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/string16.h" | 14 #include "base/string16.h" |
| 14 #include "chrome/browser/extensions/crx_installer_error.h" | 15 #include "chrome/browser/extensions/crx_installer_error.h" |
| 15 #include "chrome/browser/extensions/image_loading_tracker.h" | 16 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 16 #include "chrome/common/extensions/url_pattern.h" | 17 #include "chrome/common/extensions/url_pattern.h" |
| 17 #include "google_apis/gaia/oauth2_mint_token_flow.h" | 18 #include "google_apis/gaia/oauth2_mint_token_flow.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
| 20 #include "ui/gfx/image/image_skia.h" | 21 #include "ui/gfx/image/image_skia.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 virtual void InstallUIProceed() = 0; | 151 virtual void InstallUIProceed() = 0; |
| 151 | 152 |
| 152 // We call this method to signal that the installation should stop, with | 153 // We call this method to signal that the installation should stop, with |
| 153 // |user_initiated| true if the installation was stopped by the user. | 154 // |user_initiated| true if the installation was stopped by the user. |
| 154 virtual void InstallUIAbort(bool user_initiated) = 0; | 155 virtual void InstallUIAbort(bool user_initiated) = 0; |
| 155 | 156 |
| 156 protected: | 157 protected: |
| 157 virtual ~Delegate() {} | 158 virtual ~Delegate() {} |
| 158 }; | 159 }; |
| 159 | 160 |
| 161 typedef base::Callback<void(gfx::NativeWindow, |
| 162 content::PageNavigator*, |
| 163 ExtensionInstallPrompt::Delegate*, |
| 164 const ExtensionInstallPrompt::Prompt&)> |
| 165 ShowDialogCallback; |
| 166 |
| 160 // Creates a dummy extension from the |manifest|, replacing the name and | 167 // Creates a dummy extension from the |manifest|, replacing the name and |
| 161 // description with the localizations if provided. | 168 // description with the localizations if provided. |
| 162 static scoped_refptr<extensions::Extension> GetLocalizedExtensionForDisplay( | 169 static scoped_refptr<extensions::Extension> GetLocalizedExtensionForDisplay( |
| 163 const base::DictionaryValue* manifest, | 170 const base::DictionaryValue* manifest, |
| 164 int flags, // Extension::InitFromValueFlags | 171 int flags, // Extension::InitFromValueFlags |
| 165 const std::string& id, | 172 const std::string& id, |
| 166 const std::string& localized_name, | 173 const std::string& localized_name, |
| 167 const std::string& localized_description, | 174 const std::string& localized_description, |
| 168 std::string* error); | 175 std::string* error); |
| 169 | 176 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 200 // | 207 // |
| 201 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 208 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
| 202 virtual void ConfirmWebstoreInstall(Delegate* delegate, | 209 virtual void ConfirmWebstoreInstall(Delegate* delegate, |
| 203 const extensions::Extension* extension, | 210 const extensions::Extension* extension, |
| 204 const SkBitmap* icon); | 211 const SkBitmap* icon); |
| 205 | 212 |
| 206 // This is called by the installer to verify whether the installation should | 213 // This is called by the installer to verify whether the installation should |
| 207 // proceed. This is declared virtual for testing. | 214 // proceed. This is declared virtual for testing. |
| 208 // | 215 // |
| 209 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 216 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
| 210 virtual void ConfirmInstall(Delegate* delegate, | 217 virtual void ConfirmInstall( |
| 211 const extensions::Extension* extension); | 218 Delegate* delegate, |
| 219 const extensions::Extension* extension, |
| 220 const ShowDialogCallback& show_dialog_callback); |
| 212 | 221 |
| 213 // This is called by the app handler launcher to verify whether the app | 222 // This is called by the app handler launcher to verify whether the app |
| 214 // should be re-enabled. This is declared virtual for testing. | 223 // should be re-enabled. This is declared virtual for testing. |
| 215 // | 224 // |
| 216 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 225 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
| 217 virtual void ConfirmReEnable(Delegate* delegate, | 226 virtual void ConfirmReEnable(Delegate* delegate, |
| 218 const extensions::Extension* extension); | 227 const extensions::Extension* extension); |
| 219 | 228 |
| 220 // This is called by the extension permissions API to verify whether an | 229 // This is called by the extension permissions API to verify whether an |
| 221 // extension may be granted additional permissions. | 230 // extension may be granted additional permissions. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 Prompt prompt_; | 313 Prompt prompt_; |
| 305 | 314 |
| 306 // The type of prompt we are going to show. | 315 // The type of prompt we are going to show. |
| 307 PromptType prompt_type_; | 316 PromptType prompt_type_; |
| 308 | 317 |
| 309 scoped_ptr<OAuth2MintTokenFlow> token_flow_; | 318 scoped_ptr<OAuth2MintTokenFlow> token_flow_; |
| 310 | 319 |
| 311 // Keeps track of extension images being loaded on the File thread for the | 320 // Keeps track of extension images being loaded on the File thread for the |
| 312 // purpose of showing the install UI. | 321 // purpose of showing the install UI. |
| 313 ImageLoadingTracker tracker_; | 322 ImageLoadingTracker tracker_; |
| 323 |
| 324 ShowDialogCallback show_dialog_callback_; |
| 314 }; | 325 }; |
| 315 | 326 |
| 316 namespace chrome { | 327 namespace chrome { |
| 317 | 328 |
| 318 // Creates an ExtensionInstallPrompt from |browser|. Caller assumes ownership. | 329 // Creates an ExtensionInstallPrompt from |browser|. Caller assumes ownership. |
| 319 // TODO(beng): remove this once various extensions types are weaned from | 330 // TODO(beng): remove this once various extensions types are weaned from |
| 320 // Browser. | 331 // Browser. |
| 321 ExtensionInstallPrompt* CreateExtensionInstallPromptWithBrowser( | 332 ExtensionInstallPrompt* CreateExtensionInstallPromptWithBrowser( |
| 322 Browser* browser); | 333 Browser* browser); |
| 323 | 334 |
| 324 } // namespace chrome | 335 } // namespace chrome |
| 325 | 336 |
| 326 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 337 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| OLD | NEW |