| 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 #include "chrome/browser/download/download_crx_util.h" | 5 #include "chrome/browser/download/download_crx_util.h" |
| 6 #include "chrome/browser/download/download_service.h" | 6 #include "chrome/browser/download/download_service.h" |
| 7 #include "chrome/browser/download/download_service_factory.h" | 7 #include "chrome/browser/download/download_service_factory.h" |
| 8 #include "chrome/browser/extensions/crx_installer.h" | 8 #include "chrome/browser/extensions/crx_installer.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 confirmation_requested_(false), | 39 confirmation_requested_(false), |
| 40 extension_(NULL) {} | 40 extension_(NULL) {} |
| 41 | 41 |
| 42 bool did_succeed() const { return !!extension_; } | 42 bool did_succeed() const { return !!extension_; } |
| 43 const Extension* extension() const { return extension_; } | 43 const Extension* extension() const { return extension_; } |
| 44 bool confirmation_requested() const { return confirmation_requested_; } | 44 bool confirmation_requested() const { return confirmation_requested_; } |
| 45 const string16& error() const { return error_; } | 45 const string16& error() const { return error_; } |
| 46 void set_record_oauth2_grant(bool record) { record_oauth2_grant_ = record; } | 46 void set_record_oauth2_grant(bool record) { record_oauth2_grant_ = record; } |
| 47 | 47 |
| 48 // Overriding some of the ExtensionInstallUI API. | 48 // Overriding some of the ExtensionInstallUI API. |
| 49 void ConfirmInstall(Delegate* delegate, | 49 virtual void ConfirmInstall( |
| 50 const Extension* extension, | 50 Delegate* delegate, |
| 51 const ShowDialogCallback& show_dialog_callback) { | 51 const Extension* extension, |
| 52 const ShowDialogCallback& show_dialog_callback) OVERRIDE { |
| 52 confirmation_requested_ = true; | 53 confirmation_requested_ = true; |
| 53 delegate->InstallUIProceed(); | 54 delegate->InstallUIProceed(); |
| 54 } | 55 } |
| 55 void OnInstallSuccess(const Extension* extension, | 56 virtual void OnInstallSuccess(const Extension* extension, |
| 56 SkBitmap* icon) { | 57 SkBitmap* icon) OVERRIDE { |
| 57 extension_ = extension; | 58 extension_ = extension; |
| 58 MessageLoopForUI::current()->Quit(); | 59 MessageLoopForUI::current()->Quit(); |
| 59 } | 60 } |
| 60 void OnInstallFailure(const CrxInstallerError& error) { | 61 virtual void OnInstallFailure(const CrxInstallerError& error) OVERRIDE { |
| 61 error_ = error.message(); | 62 error_ = error.message(); |
| 62 MessageLoopForUI::current()->Quit(); | 63 MessageLoopForUI::current()->Quit(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 bool confirmation_requested_; | 67 bool confirmation_requested_; |
| 67 string16 error_; | 68 string16 error_; |
| 68 const Extension* extension_; | 69 const Extension* extension_; |
| 69 }; | 70 }; |
| 70 | 71 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; | 278 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; |
| 278 } else { | 279 } else { |
| 279 EXPECT_EQ(l10n_util::GetStringUTF16( | 280 EXPECT_EQ(l10n_util::GetStringUTF16( |
| 280 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), | 281 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), |
| 281 mock_prompt->error()) << kTestData[i]; | 282 mock_prompt->error()) << kTestData[i]; |
| 282 } | 283 } |
| 283 } | 284 } |
| 284 } | 285 } |
| 285 | 286 |
| 286 } // namespace extensions | 287 } // namespace extensions |
| OLD | NEW |