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/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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(params.get()); | 607 EXTENSION_FUNCTION_VALIDATE(params.get()); |
608 | 608 |
609 bool show_confirm_dialog = false; | 609 bool show_confirm_dialog = true; |
610 if (params->options.get() && params->options->show_confirm_dialog.get()) | 610 // By default confirmation dialog isn't shown when uninstalling self, but this |
611 show_confirm_dialog = *params->options->show_confirm_dialog; | 611 // can be overridden with showConfirmDialog. |
612 if (extension_ && params->id == extension_->id()) { | |
not at google - send to devlin
2014/01/16 01:13:41
If you're worried about |extension_| being valid t
meacer
2014/01/16 01:59:19
Done.
| |
613 show_confirm_dialog = false; | |
614 if (params->options.get() && params->options->show_confirm_dialog.get()) | |
615 show_confirm_dialog = *params->options->show_confirm_dialog; | |
not at google - send to devlin
2014/01/16 01:13:41
nit: can you do the above 3 lines in a single expr
meacer
2014/01/16 01:59:19
Can't think of a better way that won't be confusin
not at google - send to devlin
2014/01/16 05:07:39
It could be like (inside the is-self check)
show_
meacer
2014/01/16 18:59:39
Makes sense.
| |
616 } | |
617 if (show_confirm_dialog && !user_gesture()) { | |
618 error_ = keys::kGestureNeededForUninstallError; | |
619 return false; | |
620 } | |
612 | 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 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |