| 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 "extensions/browser/api/management/management_api.h" | 5 #include "extensions/browser/api/management/management_api.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/ptr_util.h" | |
| 18 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 19 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 22 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 23 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
| 24 #include "extensions/browser/api/extensions_api_client.h" | 23 #include "extensions/browser/api/extensions_api_client.h" |
| 25 #include "extensions/browser/api/management/management_api_constants.h" | 24 #include "extensions/browser/api/management/management_api_constants.h" |
| 26 #include "extensions/browser/event_router.h" | 25 #include "extensions/browser/event_router.h" |
| 27 #include "extensions/browser/extension_prefs.h" | 26 #include "extensions/browser/extension_prefs.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 473 |
| 475 return RespondNow(NoArguments()); | 474 return RespondNow(NoArguments()); |
| 476 } | 475 } |
| 477 | 476 |
| 478 void ManagementSetEnabledFunction::OnInstallPromptDone(bool did_accept) { | 477 void ManagementSetEnabledFunction::OnInstallPromptDone(bool did_accept) { |
| 479 if (did_accept) { | 478 if (did_accept) { |
| 480 ManagementAPI::GetFactoryInstance() | 479 ManagementAPI::GetFactoryInstance() |
| 481 ->Get(browser_context()) | 480 ->Get(browser_context()) |
| 482 ->GetDelegate() | 481 ->GetDelegate() |
| 483 ->EnableExtension(browser_context(), extension_id_); | 482 ->EnableExtension(browser_context(), extension_id_); |
| 484 Respond(OneArgument(base::MakeUnique<base::FundamentalValue>(true))); | 483 Respond(OneArgument(new base::FundamentalValue(true))); |
| 485 } else { | 484 } else { |
| 486 Respond(Error(keys::kUserDidNotReEnableError)); | 485 Respond(Error(keys::kUserDidNotReEnableError)); |
| 487 } | 486 } |
| 488 | 487 |
| 489 Release(); // Balanced in Run(). | 488 Release(); // Balanced in Run(). |
| 490 } | 489 } |
| 491 | 490 |
| 492 void ManagementSetEnabledFunction::OnRequirementsChecked( | 491 void ManagementSetEnabledFunction::OnRequirementsChecked( |
| 493 const std::vector<std::string>& requirements_errors) { | 492 const std::vector<std::string>& requirements_errors) { |
| 494 if (requirements_errors.empty()) { | 493 if (requirements_errors.empty()) { |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 ManagementAPI::GetFactoryInstance() { | 899 ManagementAPI::GetFactoryInstance() { |
| 901 return g_factory.Pointer(); | 900 return g_factory.Pointer(); |
| 902 } | 901 } |
| 903 | 902 |
| 904 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { | 903 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 905 management_event_router_.reset(new ManagementEventRouter(browser_context_)); | 904 management_event_router_.reset(new ManagementEventRouter(browser_context_)); |
| 906 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 905 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 907 } | 906 } |
| 908 | 907 |
| 909 } // namespace extensions | 908 } // namespace extensions |
| OLD | NEW |