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

Side by Side Diff: chrome/browser/extensions/api/management/management_api.cc

Issue 282133008: Don't crash when two extension uninstall prompts are shown at the same time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | no next file » | 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) 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/extensions/api/management/management_api.h" 5 #include "chrome/browser/extensions/api/management/management_api.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 573 }
574 574
575 // static 575 // static
576 void ManagementUninstallFunctionBase::SetAutoConfirmForTest( 576 void ManagementUninstallFunctionBase::SetAutoConfirmForTest(
577 bool should_proceed) { 577 bool should_proceed) {
578 auto_confirm_for_test = should_proceed ? PROCEED : ABORT; 578 auto_confirm_for_test = should_proceed ? PROCEED : ABORT;
579 } 579 }
580 580
581 void ManagementUninstallFunctionBase::Finish(bool should_uninstall) { 581 void ManagementUninstallFunctionBase::Finish(bool should_uninstall) {
582 if (should_uninstall) { 582 if (should_uninstall) {
583 bool success = service()->UninstallExtension( 583 // The extension can be uninstalled in another window while the UI was
584 extension_id_, 584 // showing. Do nothing in that case.
not at google - send to devlin 2014/05/16 22:11:00 Do we have any tests which actually exercise the U
Marijn Kruisselbrink 2014/05/16 22:19:12 I think in tests we bypass the dialog, and behave
585 false, /* external uninstall */ 585 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile());
586 NULL); 586 const Extension* extension = registry->GetExtensionById(
587 extension_id_, ExtensionRegistry::EVERYTHING);
588 if (!extension) {
not at google - send to devlin 2014/05/16 22:11:00 emulate the extension not being there by using kNo
Marijn Kruisselbrink 2014/05/16 22:19:12 Done.
589 SendResponse(false);
590 } else {
591 bool success =
592 service()->UninstallExtension(extension_id_,
not at google - send to devlin 2014/05/16 22:11:00 what kind of behaviour do we have in ExtensionServ
Marijn Kruisselbrink 2014/05/16 22:19:12 It is a CHECK failure already.
593 false, /* external uninstall */
594 NULL);
587 595
588 // TODO set error_ if !success 596 // TODO set error_ if !success
589 SendResponse(success); 597 SendResponse(success);
598 }
590 } else { 599 } else {
591 error_ = ErrorUtils::FormatErrorMessage( 600 error_ = ErrorUtils::FormatErrorMessage(
592 keys::kUninstallCanceledError, extension_id_); 601 keys::kUninstallCanceledError, extension_id_);
593 SendResponse(false); 602 SendResponse(false);
594 } 603 }
595 604
596 } 605 }
597 606
598 void ManagementUninstallFunctionBase::ExtensionUninstallAccepted() { 607 void ManagementUninstallFunctionBase::ExtensionUninstallAccepted() {
599 Finish(true); 608 Finish(true);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 return g_factory.Pointer(); 823 return g_factory.Pointer();
815 } 824 }
816 825
817 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { 826 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) {
818 management_event_router_.reset( 827 management_event_router_.reset(
819 new ManagementEventRouter(Profile::FromBrowserContext(browser_context_))); 828 new ManagementEventRouter(Profile::FromBrowserContext(browser_context_)));
820 EventRouter::Get(browser_context_)->UnregisterObserver(this); 829 EventRouter::Get(browser_context_)->UnregisterObserver(this);
821 } 830 }
822 831
823 } // namespace extensions 832 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698