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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 // The extension can be uninstalled in another window while the UI was | 640 // The extension can be uninstalled in another window while the UI was |
641 // showing. Do nothing in that case. | 641 // showing. Do nothing in that case. |
642 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); | 642 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); |
643 const Extension* extension = registry->GetExtensionById( | 643 const Extension* extension = registry->GetExtensionById( |
644 extension_id_, ExtensionRegistry::EVERYTHING); | 644 extension_id_, ExtensionRegistry::EVERYTHING); |
645 if (!extension) { | 645 if (!extension) { |
646 error_ = ErrorUtils::FormatErrorMessage(keys::kNoExtensionError, | 646 error_ = ErrorUtils::FormatErrorMessage(keys::kNoExtensionError, |
647 extension_id_); | 647 extension_id_); |
648 SendResponse(false); | 648 SendResponse(false); |
649 } else { | 649 } else { |
650 bool success = | 650 bool success = service()->UninstallExtension( |
651 service()->UninstallExtension(extension_id_, | 651 extension_id_, |
652 false, /* external uninstall */ | 652 ExtensionService::UNINSTALL_REASON_MANAGEMENT_API, |
653 NULL); | 653 NULL); |
654 | 654 |
655 // TODO set error_ if !success | 655 // TODO set error_ if !success |
656 SendResponse(success); | 656 SendResponse(success); |
657 } | 657 } |
658 } else { | 658 } else { |
659 error_ = ErrorUtils::FormatErrorMessage( | 659 error_ = ErrorUtils::FormatErrorMessage( |
660 keys::kUninstallCanceledError, extension_id_); | 660 keys::kUninstallCanceledError, extension_id_); |
661 SendResponse(false); | 661 SendResponse(false); |
662 } | 662 } |
663 } | 663 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 ManagementAPI::GetFactoryInstance() { | 1000 ManagementAPI::GetFactoryInstance() { |
1001 return g_factory.Pointer(); | 1001 return g_factory.Pointer(); |
1002 } | 1002 } |
1003 | 1003 |
1004 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { | 1004 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { |
1005 management_event_router_.reset(new ManagementEventRouter(browser_context_)); | 1005 management_event_router_.reset(new ManagementEventRouter(browser_context_)); |
1006 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 1006 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
1007 } | 1007 } |
1008 | 1008 |
1009 } // namespace extensions | 1009 } // namespace extensions |
OLD | NEW |