feat: preliminary support for //extensions (#17440)
This commit is contained in:
parent
bd526f97a5
commit
95977291f7
54 changed files with 2483 additions and 36 deletions
|
@ -0,0 +1,55 @@
|
|||
// Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/api/runtime/atom_runtime_api_delegate.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "extensions/common/api/runtime.h"
|
||||
#include "shell/browser/extensions/atom_extension_system.h"
|
||||
|
||||
using extensions::api::runtime::PlatformInfo;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
AtomRuntimeAPIDelegate::AtomRuntimeAPIDelegate(
|
||||
content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context) {
|
||||
DCHECK(browser_context_);
|
||||
}
|
||||
|
||||
AtomRuntimeAPIDelegate::~AtomRuntimeAPIDelegate() = default;
|
||||
|
||||
void AtomRuntimeAPIDelegate::AddUpdateObserver(UpdateObserver* observer) {}
|
||||
|
||||
void AtomRuntimeAPIDelegate::RemoveUpdateObserver(UpdateObserver* observer) {}
|
||||
|
||||
void AtomRuntimeAPIDelegate::ReloadExtension(const std::string& extension_id) {
|
||||
static_cast<AtomExtensionSystem*>(ExtensionSystem::Get(browser_context_))
|
||||
->ReloadExtension(extension_id);
|
||||
}
|
||||
|
||||
bool AtomRuntimeAPIDelegate::CheckForUpdates(
|
||||
const std::string& extension_id,
|
||||
const UpdateCheckCallback& callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void AtomRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) {}
|
||||
|
||||
bool AtomRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
|
||||
// TODO(nornagon): put useful information here.
|
||||
#if defined(OS_LINUX)
|
||||
info->os = api::runtime::PLATFORM_OS_LINUX;
|
||||
#endif
|
||||
return true;
|
||||
} // namespace extensions
|
||||
|
||||
bool AtomRuntimeAPIDelegate::RestartDevice(std::string* error_message) {
|
||||
*error_message = "Restart is not supported in Electron";
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace extensions
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_API_RUNTIME_ATOM_RUNTIME_API_DELEGATE_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_API_RUNTIME_ATOM_RUNTIME_API_DELEGATE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
|
||||
|
||||
namespace content {
|
||||
class BrowserContext;
|
||||
} // namespace content
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class AtomRuntimeAPIDelegate : public RuntimeAPIDelegate {
|
||||
public:
|
||||
explicit AtomRuntimeAPIDelegate(content::BrowserContext* browser_context);
|
||||
~AtomRuntimeAPIDelegate() override;
|
||||
|
||||
// RuntimeAPIDelegate implementation.
|
||||
void AddUpdateObserver(UpdateObserver* observer) override;
|
||||
void RemoveUpdateObserver(UpdateObserver* observer) override;
|
||||
void ReloadExtension(const std::string& extension_id) override;
|
||||
bool CheckForUpdates(const std::string& extension_id,
|
||||
const UpdateCheckCallback& callback) override;
|
||||
void OpenURL(const GURL& uninstall_url) override;
|
||||
bool GetPlatformInfo(api::runtime::PlatformInfo* info) override;
|
||||
bool RestartDevice(std::string* error_message) override;
|
||||
|
||||
private:
|
||||
content::BrowserContext* browser_context_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomRuntimeAPIDelegate);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_API_RUNTIME_ATOM_RUNTIME_API_DELEGATE_H_
|
Loading…
Add table
Add a link
Reference in a new issue