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

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

Issue 137793011: Require user confirmation for chrome.management.uninstall except when uninstalling self. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ExtensionManagementApiBrowserTest.LaunchApp Created 6 years, 11 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/extensions/api/management/management_api_browsertest.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) 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 ManagementUninstallFunction::ManagementUninstallFunction() { 598 ManagementUninstallFunction::ManagementUninstallFunction() {
599 } 599 }
600 600
601 ManagementUninstallFunction::~ManagementUninstallFunction() { 601 ManagementUninstallFunction::~ManagementUninstallFunction() {
602 } 602 }
603 603
604 bool ManagementUninstallFunction::RunImpl() { 604 bool ManagementUninstallFunction::RunImpl() {
605 scoped_ptr<management::Uninstall::Params> params( 605 scoped_ptr<management::Uninstall::Params> params(
606 management::Uninstall::Params::Create(*args_)); 606 management::Uninstall::Params::Create(*args_));
607 EXTENSION_FUNCTION_VALIDATE(extension_);
607 EXTENSION_FUNCTION_VALIDATE(params.get()); 608 EXTENSION_FUNCTION_VALIDATE(params.get());
608 609
609 bool show_confirm_dialog = false; 610 bool show_confirm_dialog = true;
610 if (params->options.get() && params->options->show_confirm_dialog.get()) 611 // By default confirmation dialog isn't shown when uninstalling self, but this
611 show_confirm_dialog = *params->options->show_confirm_dialog; 612 // can be overridden with showConfirmDialog.
612 613 if (params->id == extension_->id()) {
614 show_confirm_dialog = params->options.get() &&
615 params->options->show_confirm_dialog.get() &&
616 *params->options->show_confirm_dialog;
617 }
618 if (show_confirm_dialog && !user_gesture()) {
619 error_ = keys::kGestureNeededForUninstallError;
620 return false;
621 }
613 return Uninstall(params->id, show_confirm_dialog); 622 return Uninstall(params->id, show_confirm_dialog);
614 } 623 }
615 624
616 ManagementUninstallSelfFunction::ManagementUninstallSelfFunction() { 625 ManagementUninstallSelfFunction::ManagementUninstallSelfFunction() {
617 } 626 }
618 627
619 ManagementUninstallSelfFunction::~ManagementUninstallSelfFunction() { 628 ManagementUninstallSelfFunction::~ManagementUninstallSelfFunction() {
620 } 629 }
621 630
622 bool ManagementUninstallSelfFunction::RunImpl() { 631 bool ManagementUninstallSelfFunction::RunImpl() {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { 736 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() {
728 return &g_factory.Get(); 737 return &g_factory.Get();
729 } 738 }
730 739
731 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { 740 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) {
732 management_event_router_.reset(new ManagementEventRouter(profile_)); 741 management_event_router_.reset(new ManagementEventRouter(profile_));
733 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 742 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
734 } 743 }
735 744
736 } // namespace extensions 745 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/management/management_api_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698