#include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "components/update_client/update_query_params.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/warning_service.h"
#include "extensions/browser/warning_set.h"
#include "extensions/common/api/runtime.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest.h"
#include "net/base/backoff_entry.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/components/kiosk/kiosk_utils.h"
#include "chromeos/dbus/power/power_manager_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#endif
Extension;
ExtensionSystem;
ExtensionUpdater;
PlatformInfo;
namespace {
const int kFastReloadTime = …;
const int kUnpackedFastReloadTime = …;
class BackoffPolicy { … };
base::LazyInstance<BackoffPolicy>::DestructorAtExit g_backoff_policy = …;
BackoffPolicy::BackoffPolicy() { … }
BackoffPolicy::~BackoffPolicy() = default;
const net::BackoffEntry::Policy* BackoffPolicy::Get() { … }
const base::TickClock* g_test_clock = …;
}
struct ChromeRuntimeAPIDelegate::UpdateCheckInfo { … };
ChromeRuntimeAPIDelegate::ChromeRuntimeAPIDelegate(
content::BrowserContext* context)
: … { … }
ChromeRuntimeAPIDelegate::~ChromeRuntimeAPIDelegate() = default;
void ChromeRuntimeAPIDelegate::set_tick_clock_for_tests(
const base::TickClock* clock) { … }
void ChromeRuntimeAPIDelegate::AddUpdateObserver(
extensions::UpdateObserver* observer) { … }
void ChromeRuntimeAPIDelegate::RemoveUpdateObserver(
extensions::UpdateObserver* observer) { … }
void ChromeRuntimeAPIDelegate::ReloadExtension(
const extensions::ExtensionId& extension_id) { … }
bool ChromeRuntimeAPIDelegate::CheckForUpdates(
const extensions::ExtensionId& extension_id,
UpdateCheckCallback callback) { … }
void ChromeRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { … }
bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { … }
bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) { … }
bool ChromeRuntimeAPIDelegate::OpenOptionsPage(
const Extension* extension,
content::BrowserContext* browser_context) { … }
void ChromeRuntimeAPIDelegate::OnExtensionUpdateFound(
const extensions::ExtensionId& extension_id,
const base::Version& version) { … }
void ChromeRuntimeAPIDelegate::OnExtensionInstalled(
content::BrowserContext* browser_context,
const Extension* extension,
bool is_update) { … }
void ChromeRuntimeAPIDelegate::UpdateCheckComplete(
const extensions::ExtensionId& extension_id) { … }
void ChromeRuntimeAPIDelegate::CallUpdateCallbacks(
const extensions::ExtensionId& extension_id,
const UpdateCheckResult& result) { … }