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

Side by Side Diff: chrome/browser/extensions/crx_installer_browsertest.cc

Issue 11087071: Making ShowExtensionInstallDialog a callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 2 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 | Annotate | Revision Log
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 #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 29 matching lines...) Expand all
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 void ConfirmInstall(Delegate* delegate,
50 const Extension* extension) { 50 const Extension* extension,
51 const ShowDialogCallback& show_dialog_callback) {
51 confirmation_requested_ = true; 52 confirmation_requested_ = true;
52 delegate->InstallUIProceed(); 53 delegate->InstallUIProceed();
53 } 54 }
54 void OnInstallSuccess(const Extension* extension, 55 void OnInstallSuccess(const Extension* extension,
55 SkBitmap* icon) { 56 SkBitmap* icon) {
56 extension_ = extension; 57 extension_ = extension;
57 MessageLoopForUI::current()->Quit(); 58 MessageLoopForUI::current()->Quit();
58 } 59 }
59 void OnInstallFailure(const CrxInstallerError& error) { 60 void OnInstallFailure(const CrxInstallerError& error) {
60 error_ = error.message(); 61 error_ = error.message();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; 274 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i];
274 } else { 275 } else {
275 EXPECT_EQ(l10n_util::GetStringUTF16( 276 EXPECT_EQ(l10n_util::GetStringUTF16(
276 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), 277 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE),
277 mock_prompt->error()) << kTestData[i]; 278 mock_prompt->error()) << kTestData[i];
278 } 279 }
279 } 280 }
280 } 281 }
281 282
282 } // namespace extensions 283 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698