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 // showing. Do nothing in that case. | 640 // showing. Do nothing in that case. |
641 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); | 641 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); |
642 const Extension* extension = registry->GetExtensionById( | 642 const Extension* extension = registry->GetExtensionById( |
643 extension_id_, ExtensionRegistry::EVERYTHING); | 643 extension_id_, ExtensionRegistry::EVERYTHING); |
644 if (!extension) { | 644 if (!extension) { |
645 error_ = ErrorUtils::FormatErrorMessage(keys::kNoExtensionError, | 645 error_ = ErrorUtils::FormatErrorMessage(keys::kNoExtensionError, |
646 extension_id_); | 646 extension_id_); |
647 SendResponse(false); | 647 SendResponse(false); |
648 } else { | 648 } else { |
649 bool success = service()->UninstallExtension( | 649 bool success = service()->UninstallExtension( |
650 extension_id_, | 650 extension_id_, UninstalledExtensionInfo::REASON_MANAGEMENT_API, NULL); |
651 ExtensionService::UNINSTALL_REASON_MANAGEMENT_API, | |
652 NULL); | |
653 | 651 |
654 // TODO set error_ if !success | 652 // TODO set error_ if !success |
655 SendResponse(success); | 653 SendResponse(success); |
656 } | 654 } |
657 } else { | 655 } else { |
658 error_ = ErrorUtils::FormatErrorMessage( | 656 error_ = ErrorUtils::FormatErrorMessage( |
659 keys::kUninstallCanceledError, extension_id_); | 657 keys::kUninstallCanceledError, extension_id_); |
660 SendResponse(false); | 658 SendResponse(false); |
661 } | 659 } |
662 } | 660 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 ManagementAPI::GetFactoryInstance() { | 996 ManagementAPI::GetFactoryInstance() { |
999 return g_factory.Pointer(); | 997 return g_factory.Pointer(); |
1000 } | 998 } |
1001 | 999 |
1002 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { | 1000 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { |
1003 management_event_router_.reset(new ManagementEventRouter(browser_context_)); | 1001 management_event_router_.reset(new ManagementEventRouter(browser_context_)); |
1004 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 1002 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
1005 } | 1003 } |
1006 | 1004 |
1007 } // namespace extensions | 1005 } // namespace extensions |
OLD | NEW |