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

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

Issue 168823004: Fix crash with --load-extension for extensions with plugins (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit_tests (load_extension_crash) Created 6 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/ui/extensions/extension_install_ui_default.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/unpacked_installer.h" 5 #include "chrome/browser/extensions/unpacked_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h"
9 #include "base/file_util.h" 10 #include "base/file_util.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
13 #include "chrome/browser/extensions/extension_install_prompt.h" 14 #include "chrome/browser/extensions/extension_install_prompt.h"
14 #include "chrome/browser/extensions/extension_install_ui.h" 15 #include "chrome/browser/extensions/extension_install_ui.h"
15 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/permissions_updater.h" 17 #include "chrome/browser/extensions/permissions_updater.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/extensions/api/plugins/plugins_handler.h" 20 #include "chrome/common/extensions/api/plugins/plugins_handler.h"
19 #include "chrome/common/extensions/extension_file_util.h" 21 #include "chrome/common/extensions/extension_file_util.h"
20 #include "chrome/common/extensions/extension_l10n_util.h" 22 #include "chrome/common/extensions/extension_l10n_util.h"
21 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
22 #include "extensions/browser/extension_prefs.h" 24 #include "extensions/browser/extension_prefs.h"
23 #include "extensions/browser/extension_registry.h" 25 #include "extensions/browser/extension_registry.h"
24 #include "extensions/common/extension.h" 26 #include "extensions/common/extension.h"
25 #include "extensions/common/id_util.h" 27 #include "extensions/common/id_util.h"
26 #include "extensions/common/manifest.h" 28 #include "extensions/common/manifest.h"
27 #include "sync/api/string_ordinal.h" 29 #include "sync/api/string_ordinal.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 : install_ui_(ExtensionInstallUI::CreateInstallPromptWithProfile( 63 : install_ui_(ExtensionInstallUI::CreateInstallPromptWithProfile(
62 profile)), 64 profile)),
63 extension_(extension), 65 extension_(extension),
64 callback_(callback) { 66 callback_(callback) {
65 } 67 }
66 68
67 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() { 69 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() {
68 } 70 }
69 71
70 void SimpleExtensionLoadPrompt::ShowPrompt() { 72 void SimpleExtensionLoadPrompt::ShowPrompt() {
73 std::string confirm = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
74 switches::kAppsGalleryInstallAutoConfirmForTests);
75 if (confirm == "accept") {
76 InstallUIProceed();
77 return;
78 }
79 if (confirm == "cancel") {
80 InstallUIAbort(false);
81 return;
82 }
83
71 install_ui_->ConfirmInstall( 84 install_ui_->ConfirmInstall(
72 this, 85 this,
73 extension_.get(), 86 extension_.get(),
74 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); 87 ExtensionInstallPrompt::GetDefaultShowDialogCallback());
75 } 88 }
76 89
77 void SimpleExtensionLoadPrompt::InstallUIProceed() { 90 void SimpleExtensionLoadPrompt::InstallUIProceed() {
78 callback_.Run(); 91 callback_.Run();
79 delete this; 92 delete this;
80 } 93 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 310
298 service_weak_->OnExtensionInstalled( 311 service_weak_->OnExtensionInstalled(
299 installer_.extension().get(), 312 installer_.extension().get(),
300 syncer::StringOrdinal(), 313 syncer::StringOrdinal(),
301 false /* no requirement errors */, 314 false /* no requirement errors */,
302 NOT_BLACKLISTED, 315 NOT_BLACKLISTED,
303 false /* don't wait for idle */); 316 false /* don't wait for idle */);
304 } 317 }
305 318
306 } // namespace extensions 319 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/extensions/extension_install_ui_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698