feat: enable native extensions support (#21814)
This commit is contained in:
parent
bdf65a75d0
commit
a061c87e56
61 changed files with 1054 additions and 941 deletions
|
@ -12,13 +12,13 @@
|
|||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "shell/browser/atom_browser_context.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/common/deprecate_util.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_converters/net_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "shell/common/process_util.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
namespace {
|
||||
|
@ -217,12 +217,11 @@ bool Protocol::IsProtocolIntercepted(const std::string& scheme) {
|
|||
v8::Local<v8::Promise> Protocol::IsProtocolHandled(const std::string& scheme,
|
||||
gin::Arguments* args) {
|
||||
node::Environment* env = node::Environment::GetCurrent(args->isolate());
|
||||
EmitDeprecationWarning(
|
||||
env,
|
||||
"The protocol.isProtocolHandled API is deprecated, use "
|
||||
"protocol.isProtocolRegistered or protocol.isProtocolIntercepted "
|
||||
"instead.",
|
||||
"ProtocolDeprecateIsProtocolHandled");
|
||||
EmitWarning(env,
|
||||
"The protocol.isProtocolHandled API is deprecated, use "
|
||||
"protocol.isProtocolRegistered or protocol.isProtocolIntercepted "
|
||||
"instead.",
|
||||
"ProtocolDeprecateIsProtocolHandled");
|
||||
return gin_helper::Promise<bool>::ResolvedPromise(
|
||||
isolate(), IsProtocolRegistered(scheme) ||
|
||||
IsProtocolIntercepted(scheme) ||
|
||||
|
@ -241,7 +240,7 @@ void Protocol::HandleOptionalCallback(gin::Arguments* args,
|
|||
CompletionCallback callback;
|
||||
if (args->GetNext(&callback)) {
|
||||
node::Environment* env = node::Environment::GetCurrent(args->isolate());
|
||||
EmitDeprecationWarning(
|
||||
EmitWarning(
|
||||
env,
|
||||
"The callback argument of protocol module APIs is no longer needed.",
|
||||
"ProtocolDeprecateCallback");
|
||||
|
|
|
@ -63,11 +63,12 @@
|
|||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "shell/common/process_util.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "shell/browser/extensions/atom_extension_system.h"
|
||||
#include "shell/browser/extensions/electron_extension_system.h"
|
||||
#include "shell/common/gin_converters/extension_converter.h"
|
||||
#endif
|
||||
|
||||
|
@ -613,19 +614,23 @@ v8::Local<v8::Promise> Session::LoadExtension(
|
|||
gin_helper::Promise<const extensions::Extension*> promise(isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto* extension_system = static_cast<extensions::AtomExtensionSystem*>(
|
||||
auto* extension_system = static_cast<extensions::ElectronExtensionSystem*>(
|
||||
extensions::ExtensionSystem::Get(browser_context()));
|
||||
extension_system->LoadExtension(
|
||||
extension_path,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<const extensions::Extension*> promise,
|
||||
const extensions::Extension* extension) {
|
||||
const extensions::Extension* extension,
|
||||
const std::string& error_msg) {
|
||||
if (extension) {
|
||||
if (!error_msg.empty()) {
|
||||
node::Environment* env =
|
||||
node::Environment::GetCurrent(v8::Isolate::GetCurrent());
|
||||
EmitWarning(env, error_msg, "ExtensionLoadWarning");
|
||||
}
|
||||
promise.Resolve(extension);
|
||||
} else {
|
||||
// TODO(nornagon): plumb through error message from extension
|
||||
// loader.
|
||||
promise.RejectWithErrorMessage("Failed to load extension");
|
||||
promise.RejectWithErrorMessage(error_msg);
|
||||
}
|
||||
},
|
||||
std::move(promise)));
|
||||
|
@ -634,7 +639,7 @@ v8::Local<v8::Promise> Session::LoadExtension(
|
|||
}
|
||||
|
||||
void Session::RemoveExtension(const std::string& extension_id) {
|
||||
auto* extension_system = static_cast<extensions::AtomExtensionSystem*>(
|
||||
auto* extension_system = static_cast<extensions::ElectronExtensionSystem*>(
|
||||
extensions::ExtensionSystem::Get(browser_context()));
|
||||
extension_system->RemoveExtension(extension_id);
|
||||
}
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#include "shell/browser/mac/atom_application.h"
|
||||
#include "shell/browser/mac/dict_util.h"
|
||||
#include "shell/browser/ui/cocoa/NSColor+Hex.h"
|
||||
#include "shell/common/deprecate_util.h"
|
||||
#include "shell/common/gin_converters/gurl_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/process_util.h"
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
|
||||
namespace gin {
|
||||
|
@ -504,7 +504,7 @@ std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower,
|
|||
NSColor* sysColor = nil;
|
||||
if (color == "alternate-selected-control-text") {
|
||||
sysColor = [NSColor alternateSelectedControlTextColor];
|
||||
EmitDeprecationWarning(
|
||||
EmitWarning(
|
||||
node::Environment::GetCurrent(thrower.isolate()),
|
||||
"'alternate-selected-control-text' is deprecated as an input to "
|
||||
"getColor. Use 'selected-content-background' instead.",
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
#include "shell/browser/extensions/atom_extension_web_contents_observer.h"
|
||||
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
|
||||
#endif
|
||||
|
||||
namespace gin {
|
||||
|
@ -385,7 +385,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
AttachAsUserData(web_contents);
|
||||
InitZoomController(web_contents, gin::Dictionary::CreateEmpty(isolate));
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions::AtomExtensionWebContentsObserver::CreateForWebContents(
|
||||
extensions::ElectronExtensionWebContentsObserver::CreateForWebContents(
|
||||
web_contents);
|
||||
script_executor_.reset(new extensions::ScriptExecutor(web_contents));
|
||||
#endif
|
||||
|
@ -546,7 +546,7 @@ void WebContents::InitWithSessionAndOptions(
|
|||
SecurityStateTabHelper::CreateForWebContents(web_contents());
|
||||
InitZoomController(web_contents(), options);
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions::AtomExtensionWebContentsObserver::CreateForWebContents(
|
||||
extensions::ElectronExtensionWebContentsObserver::CreateForWebContents(
|
||||
web_contents());
|
||||
script_executor_.reset(new extensions::ScriptExecutor(web_contents()));
|
||||
#endif
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
#include "extensions/browser/info_map.h"
|
||||
#include "extensions/browser/process_map.h"
|
||||
#include "extensions/common/extension.h"
|
||||
#include "shell/browser/extensions/atom_extension_system.h"
|
||||
#include "shell/browser/extensions/electron_extension_system.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
|
|
@ -56,11 +56,11 @@
|
|||
#include "extensions/browser/extension_prefs.h"
|
||||
#include "extensions/browser/pref_names.h"
|
||||
#include "extensions/common/extension_api.h"
|
||||
#include "shell/browser/extensions/atom_browser_context_keyed_service_factories.h"
|
||||
#include "shell/browser/extensions/atom_extension_system.h"
|
||||
#include "shell/browser/extensions/atom_extension_system_factory.h"
|
||||
#include "shell/browser/extensions/atom_extensions_browser_client.h"
|
||||
#include "shell/common/extensions/atom_extensions_client.h"
|
||||
#include "shell/browser/extensions/electron_browser_context_keyed_service_factories.h"
|
||||
#include "shell/browser/extensions/electron_extension_system.h"
|
||||
#include "shell/browser/extensions/electron_extension_system_factory.h"
|
||||
#include "shell/browser/extensions/electron_extensions_browser_client.h"
|
||||
#include "shell/common/extensions/electron_extensions_client.h"
|
||||
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) || \
|
||||
|
@ -136,7 +136,7 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
|
|||
BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
|
||||
this);
|
||||
|
||||
extension_system_ = static_cast<extensions::AtomExtensionSystem*>(
|
||||
extension_system_ = static_cast<extensions::ElectronExtensionSystem*>(
|
||||
extensions::ExtensionSystem::Get(this));
|
||||
extension_system_->InitForRegularProfile(true /* extensions_enabled */);
|
||||
extension_system_->FinishInitialization();
|
||||
|
|
|
@ -35,7 +35,7 @@ class SpecialStoragePolicy;
|
|||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
namespace extensions {
|
||||
class AtomExtensionSystem;
|
||||
class ElectronExtensionSystem;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -142,7 +142,7 @@ class AtomBrowserContext
|
|||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions::AtomExtensionSystem* extension_system() {
|
||||
extensions::ElectronExtensionSystem* extension_system() {
|
||||
return extension_system_;
|
||||
}
|
||||
#endif
|
||||
|
@ -192,7 +192,7 @@ class AtomBrowserContext
|
|||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
// Owned by the KeyedService system.
|
||||
extensions::AtomExtensionSystem* extension_system_;
|
||||
extensions::ElectronExtensionSystem* extension_system_;
|
||||
#endif
|
||||
|
||||
// Shared URLLoaderFactory.
|
||||
|
|
|
@ -97,9 +97,9 @@
|
|||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "extensions/browser/browser_context_keyed_service_factories.h"
|
||||
#include "extensions/common/extension_api.h"
|
||||
#include "shell/browser/extensions/atom_browser_context_keyed_service_factories.h"
|
||||
#include "shell/browser/extensions/atom_extensions_browser_client.h"
|
||||
#include "shell/common/extensions/atom_extensions_client.h"
|
||||
#include "shell/browser/extensions/electron_browser_context_keyed_service_factories.h"
|
||||
#include "shell/browser/extensions/electron_extensions_browser_client.h"
|
||||
#include "shell/common/extensions/electron_extensions_client.h"
|
||||
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
|
@ -437,11 +437,12 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
|||
node_bindings_->RunMessageLoop();
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions_client_ = std::make_unique<AtomExtensionsClient>();
|
||||
extensions_client_ = std::make_unique<ElectronExtensionsClient>();
|
||||
extensions::ExtensionsClient::Set(extensions_client_.get());
|
||||
|
||||
// BrowserContextKeyedAPIServiceFactories require an ExtensionsBrowserClient.
|
||||
extensions_browser_client_ = std::make_unique<AtomExtensionsBrowserClient>();
|
||||
extensions_browser_client_ =
|
||||
std::make_unique<ElectronExtensionsBrowserClient>();
|
||||
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
|
||||
|
||||
extensions::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||
|
|
|
@ -41,8 +41,8 @@ class NodeEnvironment;
|
|||
class BridgeTaskRunner;
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
class AtomExtensionsClient;
|
||||
class AtomExtensionsBrowserClient;
|
||||
class ElectronExtensionsClient;
|
||||
class ElectronExtensionsBrowserClient;
|
||||
#endif
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
|
@ -139,8 +139,8 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
|
|||
std::unique_ptr<base::FieldTrialList> field_trial_list_;
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
std::unique_ptr<AtomExtensionsClient> extensions_client_;
|
||||
std::unique_ptr<AtomExtensionsBrowserClient> extensions_browser_client_;
|
||||
std::unique_ptr<ElectronExtensionsClient> extensions_client_;
|
||||
std::unique_ptr<ElectronExtensionsBrowserClient> extensions_browser_client_;
|
||||
#endif
|
||||
|
||||
base::RepeatingTimer gc_timer_;
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
// 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,57 @@
|
|||
// 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/electron_runtime_api_delegate.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "extensions/common/api/runtime.h"
|
||||
#include "shell/browser/extensions/electron_extension_system.h"
|
||||
|
||||
using extensions::api::runtime::PlatformInfo;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
ElectronRuntimeAPIDelegate::ElectronRuntimeAPIDelegate(
|
||||
content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context) {
|
||||
DCHECK(browser_context_);
|
||||
}
|
||||
|
||||
ElectronRuntimeAPIDelegate::~ElectronRuntimeAPIDelegate() = default;
|
||||
|
||||
void ElectronRuntimeAPIDelegate::AddUpdateObserver(UpdateObserver* observer) {}
|
||||
|
||||
void ElectronRuntimeAPIDelegate::RemoveUpdateObserver(
|
||||
UpdateObserver* observer) {}
|
||||
|
||||
void ElectronRuntimeAPIDelegate::ReloadExtension(
|
||||
const std::string& extension_id) {
|
||||
static_cast<ElectronExtensionSystem*>(ExtensionSystem::Get(browser_context_))
|
||||
->ReloadExtension(extension_id);
|
||||
}
|
||||
|
||||
bool ElectronRuntimeAPIDelegate::CheckForUpdates(
|
||||
const std::string& extension_id,
|
||||
const UpdateCheckCallback& callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ElectronRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) {}
|
||||
|
||||
bool ElectronRuntimeAPIDelegate::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 ElectronRuntimeAPIDelegate::RestartDevice(std::string* error_message) {
|
||||
*error_message = "Restart is not supported in Electron";
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace extensions
|
|
@ -2,8 +2,8 @@
|
|||
// 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_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_API_RUNTIME_ELECTRON_RUNTIME_API_DELEGATE_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_API_RUNTIME_ELECTRON_RUNTIME_API_DELEGATE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -16,10 +16,10 @@ class BrowserContext;
|
|||
|
||||
namespace extensions {
|
||||
|
||||
class AtomRuntimeAPIDelegate : public RuntimeAPIDelegate {
|
||||
class ElectronRuntimeAPIDelegate : public RuntimeAPIDelegate {
|
||||
public:
|
||||
explicit AtomRuntimeAPIDelegate(content::BrowserContext* browser_context);
|
||||
~AtomRuntimeAPIDelegate() override;
|
||||
explicit ElectronRuntimeAPIDelegate(content::BrowserContext* browser_context);
|
||||
~ElectronRuntimeAPIDelegate() override;
|
||||
|
||||
// RuntimeAPIDelegate implementation.
|
||||
void AddUpdateObserver(UpdateObserver* observer) override;
|
||||
|
@ -34,9 +34,9 @@ class AtomRuntimeAPIDelegate : public RuntimeAPIDelegate {
|
|||
private:
|
||||
content::BrowserContext* browser_context_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomRuntimeAPIDelegate);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronRuntimeAPIDelegate);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_API_RUNTIME_ATOM_RUNTIME_API_DELEGATE_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_API_RUNTIME_ELECTRON_RUNTIME_API_DELEGATE_H_
|
|
@ -1,23 +0,0 @@
|
|||
// 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_ATOM_DISPLAY_INFO_PROVIDER_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_DISPLAY_INFO_PROVIDER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "extensions/browser/api/system_display/display_info_provider.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class AtomDisplayInfoProvider : public DisplayInfoProvider {
|
||||
public:
|
||||
AtomDisplayInfoProvider();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomDisplayInfoProvider);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_DISPLAY_INFO_PROVIDER_H_
|
|
@ -2,11 +2,11 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_browser_context_keyed_service_factories.h"
|
||||
#include "shell/browser/extensions/electron_browser_context_keyed_service_factories.h"
|
||||
|
||||
#include "extensions/browser/updater/update_service_factory.h"
|
||||
// #include "extensions/shell/browser/api/identity/identity_api.h"
|
||||
#include "shell/browser/extensions/atom_extension_system_factory.h"
|
||||
#include "shell/browser/extensions/electron_extension_system_factory.h"
|
||||
|
||||
namespace extensions {
|
||||
namespace electron {
|
||||
|
@ -18,7 +18,7 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
|||
// extensions embedders (and namely chrome.)
|
||||
UpdateServiceFactory::GetInstance();
|
||||
|
||||
AtomExtensionSystemFactory::GetInstance();
|
||||
ElectronExtensionSystemFactory::GetInstance();
|
||||
}
|
||||
|
||||
} // namespace electron
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
|
||||
namespace extensions {
|
||||
namespace electron {
|
||||
|
@ -15,4 +15,4 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
|||
} // namespace electron
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
|
@ -2,10 +2,10 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_display_info_provider.h"
|
||||
#include "shell/browser/extensions/electron_display_info_provider.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
AtomDisplayInfoProvider::AtomDisplayInfoProvider() = default;
|
||||
ElectronDisplayInfoProvider::ElectronDisplayInfoProvider() = default;
|
||||
|
||||
} // namespace extensions
|
23
shell/browser/extensions/electron_display_info_provider.h
Normal file
23
shell/browser/extensions/electron_display_info_provider.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
// 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_ELECTRON_DISPLAY_INFO_PROVIDER_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_DISPLAY_INFO_PROVIDER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "extensions/browser/api/system_display/display_info_provider.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class ElectronDisplayInfoProvider : public DisplayInfoProvider {
|
||||
public:
|
||||
ElectronDisplayInfoProvider();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronDisplayInfoProvider);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_DISPLAY_INFO_PROVIDER_H_
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_extension_host_delegate.h"
|
||||
#include "shell/browser/extensions/electron_extension_host_delegate.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -11,31 +11,31 @@
|
|||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "extensions/browser/media_capture_util.h"
|
||||
#include "shell/browser/extensions/atom_extension_web_contents_observer.h"
|
||||
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
AtomExtensionHostDelegate::AtomExtensionHostDelegate() {}
|
||||
ElectronExtensionHostDelegate::ElectronExtensionHostDelegate() {}
|
||||
|
||||
AtomExtensionHostDelegate::~AtomExtensionHostDelegate() {}
|
||||
ElectronExtensionHostDelegate::~ElectronExtensionHostDelegate() {}
|
||||
|
||||
void AtomExtensionHostDelegate::OnExtensionHostCreated(
|
||||
void ElectronExtensionHostDelegate::OnExtensionHostCreated(
|
||||
content::WebContents* web_contents) {
|
||||
AtomExtensionWebContentsObserver::CreateForWebContents(web_contents);
|
||||
ElectronExtensionWebContentsObserver::CreateForWebContents(web_contents);
|
||||
}
|
||||
|
||||
void AtomExtensionHostDelegate::OnRenderViewCreatedForBackgroundPage(
|
||||
void ElectronExtensionHostDelegate::OnRenderViewCreatedForBackgroundPage(
|
||||
ExtensionHost* host) {}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
AtomExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
ElectronExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
// TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from
|
||||
// content_shell.
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void AtomExtensionHostDelegate::CreateTab(
|
||||
void ElectronExtensionHostDelegate::CreateTab(
|
||||
std::unique_ptr<content::WebContents> web_contents,
|
||||
const std::string& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
|
@ -45,7 +45,7 @@ void AtomExtensionHostDelegate::CreateTab(
|
|||
NOTREACHED();
|
||||
}
|
||||
|
||||
void AtomExtensionHostDelegate::ProcessMediaAccessRequest(
|
||||
void ElectronExtensionHostDelegate::ProcessMediaAccessRequest(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
content::MediaResponseCallback callback,
|
||||
|
@ -55,7 +55,7 @@ void AtomExtensionHostDelegate::ProcessMediaAccessRequest(
|
|||
std::move(callback), extension);
|
||||
}
|
||||
|
||||
bool AtomExtensionHostDelegate::CheckMediaAccessPermission(
|
||||
bool ElectronExtensionHostDelegate::CheckMediaAccessPermission(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& security_origin,
|
||||
blink::mojom::MediaStreamType type,
|
||||
|
@ -65,7 +65,7 @@ bool AtomExtensionHostDelegate::CheckMediaAccessPermission(
|
|||
}
|
||||
|
||||
content::PictureInPictureResult
|
||||
AtomExtensionHostDelegate::EnterPictureInPicture(
|
||||
ElectronExtensionHostDelegate::EnterPictureInPicture(
|
||||
content::WebContents* web_contents,
|
||||
const viz::SurfaceId& surface_id,
|
||||
const gfx::Size& natural_size) {
|
||||
|
@ -73,7 +73,7 @@ AtomExtensionHostDelegate::EnterPictureInPicture(
|
|||
return content::PictureInPictureResult();
|
||||
}
|
||||
|
||||
void AtomExtensionHostDelegate::ExitPictureInPicture() {
|
||||
void ElectronExtensionHostDelegate::ExitPictureInPicture() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_HOST_DELEGATE_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_HOST_DELEGATE_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_HOST_DELEGATE_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_HOST_DELEGATE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -14,10 +14,10 @@
|
|||
namespace extensions {
|
||||
|
||||
// A minimal ExtensionHostDelegate.
|
||||
class AtomExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
class ElectronExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
public:
|
||||
AtomExtensionHostDelegate();
|
||||
~AtomExtensionHostDelegate() override;
|
||||
ElectronExtensionHostDelegate();
|
||||
~ElectronExtensionHostDelegate() override;
|
||||
|
||||
// ExtensionHostDelegate implementation.
|
||||
void OnExtensionHostCreated(content::WebContents* web_contents) override;
|
||||
|
@ -43,9 +43,9 @@ class AtomExtensionHostDelegate : public ExtensionHostDelegate {
|
|||
void ExitPictureInPicture() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionHostDelegate);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionHostDelegate);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_HOST_DELEGATE_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_HOST_DELEGATE_H_
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_extension_loader.h"
|
||||
#include "shell/browser/extensions/electron_extension_loader.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
|||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/sequenced_task_runner.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task_runner_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "extensions/browser/extension_file_task_runner.h"
|
||||
|
@ -25,16 +26,15 @@ using LoadErrorBehavior = ExtensionRegistrar::LoadErrorBehavior;
|
|||
|
||||
namespace {
|
||||
|
||||
scoped_refptr<const Extension> LoadUnpacked(
|
||||
std::pair<scoped_refptr<const Extension>, std::string> LoadUnpacked(
|
||||
const base::FilePath& extension_dir) {
|
||||
// app_shell only supports unpacked extensions.
|
||||
// NOTE: If you add packed extension support consider removing the flag
|
||||
// FOLLOW_SYMLINKS_ANYWHERE below. Packed extensions should not have symlinks.
|
||||
// TODO(nornagon): these LOG()s should surface as JS exceptions
|
||||
if (!base::DirectoryExists(extension_dir)) {
|
||||
LOG(ERROR) << "Extension directory not found: "
|
||||
<< extension_dir.AsUTF8Unsafe();
|
||||
return nullptr;
|
||||
std::string err = "Extension directory not found: " +
|
||||
base::UTF16ToUTF8(extension_dir.LossyDisplayName());
|
||||
return std::make_pair(nullptr, err);
|
||||
}
|
||||
|
||||
int load_flags = Extension::FOLLOW_SYMLINKS_ANYWHERE;
|
||||
|
@ -42,43 +42,46 @@ scoped_refptr<const Extension> LoadUnpacked(
|
|||
scoped_refptr<Extension> extension = file_util::LoadExtension(
|
||||
extension_dir, Manifest::COMMAND_LINE, load_flags, &load_error);
|
||||
if (!extension.get()) {
|
||||
LOG(ERROR) << "Loading extension at " << extension_dir.value()
|
||||
<< " failed with: " << load_error;
|
||||
return nullptr;
|
||||
std::string err = "Loading extension at " +
|
||||
base::UTF16ToUTF8(extension_dir.LossyDisplayName()) +
|
||||
" failed with: " + load_error;
|
||||
return std::make_pair(nullptr, err);
|
||||
}
|
||||
|
||||
std::string warnings;
|
||||
// Log warnings.
|
||||
if (extension->install_warnings().size()) {
|
||||
LOG(WARNING) << "Warnings loading extension at " << extension_dir.value()
|
||||
<< ":";
|
||||
for (const auto& warning : extension->install_warnings())
|
||||
LOG(WARNING) << warning.message;
|
||||
warnings += "Warnings loading extension at " +
|
||||
base::UTF16ToUTF8(extension_dir.LossyDisplayName()) + ": ";
|
||||
for (const auto& warning : extension->install_warnings()) {
|
||||
warnings += warning.message + " ";
|
||||
}
|
||||
}
|
||||
|
||||
return extension;
|
||||
return std::make_pair(extension, warnings);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
AtomExtensionLoader::AtomExtensionLoader(
|
||||
ElectronExtensionLoader::ElectronExtensionLoader(
|
||||
content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context),
|
||||
extension_registrar_(browser_context, this),
|
||||
weak_factory_(this) {}
|
||||
|
||||
AtomExtensionLoader::~AtomExtensionLoader() = default;
|
||||
ElectronExtensionLoader::~ElectronExtensionLoader() = default;
|
||||
|
||||
void AtomExtensionLoader::LoadExtension(
|
||||
void ElectronExtensionLoader::LoadExtension(
|
||||
const base::FilePath& extension_dir,
|
||||
base::OnceCallback<void(const Extension*)> loaded) {
|
||||
base::OnceCallback<void(const Extension*, const std::string&)> cb) {
|
||||
base::PostTaskAndReplyWithResult(
|
||||
GetExtensionFileTaskRunner().get(), FROM_HERE,
|
||||
base::BindOnce(&LoadUnpacked, extension_dir),
|
||||
base::BindOnce(&AtomExtensionLoader::FinishExtensionLoad,
|
||||
weak_factory_.GetWeakPtr(), std::move(loaded)));
|
||||
base::BindOnce(&ElectronExtensionLoader::FinishExtensionLoad,
|
||||
weak_factory_.GetWeakPtr(), std::move(cb)));
|
||||
}
|
||||
|
||||
void AtomExtensionLoader::ReloadExtension(const ExtensionId& extension_id) {
|
||||
void ElectronExtensionLoader::ReloadExtension(const ExtensionId& extension_id) {
|
||||
const Extension* extension = ExtensionRegistry::Get(browser_context_)
|
||||
->GetInstalledExtension(extension_id);
|
||||
// We shouldn't be trying to reload extensions that haven't been added.
|
||||
|
@ -94,31 +97,33 @@ void AtomExtensionLoader::ReloadExtension(const ExtensionId& extension_id) {
|
|||
return;
|
||||
}
|
||||
|
||||
void AtomExtensionLoader::UnloadExtension(
|
||||
void ElectronExtensionLoader::UnloadExtension(
|
||||
const ExtensionId& extension_id,
|
||||
extensions::UnloadedExtensionReason reason) {
|
||||
extension_registrar_.RemoveExtension(extension_id, reason);
|
||||
}
|
||||
|
||||
void AtomExtensionLoader::FinishExtensionLoad(
|
||||
base::OnceCallback<void(const Extension*)> done,
|
||||
scoped_refptr<const Extension> extension) {
|
||||
void ElectronExtensionLoader::FinishExtensionLoad(
|
||||
base::OnceCallback<void(const Extension*, const std::string&)> cb,
|
||||
std::pair<scoped_refptr<const Extension>, std::string> result) {
|
||||
scoped_refptr<const Extension> extension = result.first;
|
||||
if (extension) {
|
||||
extension_registrar_.AddExtension(extension);
|
||||
}
|
||||
std::move(done).Run(extension.get());
|
||||
std::move(cb).Run(extension.get(), result.second);
|
||||
}
|
||||
|
||||
void AtomExtensionLoader::FinishExtensionReload(
|
||||
void ElectronExtensionLoader::FinishExtensionReload(
|
||||
const ExtensionId& old_extension_id,
|
||||
scoped_refptr<const Extension> extension) {
|
||||
std::pair<scoped_refptr<const Extension>, std::string> result) {
|
||||
scoped_refptr<const Extension> extension = result.first;
|
||||
if (extension) {
|
||||
extension_registrar_.AddExtension(extension);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomExtensionLoader::PreAddExtension(const Extension* extension,
|
||||
const Extension* old_extension) {
|
||||
void ElectronExtensionLoader::PreAddExtension(const Extension* extension,
|
||||
const Extension* old_extension) {
|
||||
if (old_extension)
|
||||
return;
|
||||
|
||||
|
@ -138,13 +143,13 @@ void AtomExtensionLoader::PreAddExtension(const Extension* extension,
|
|||
}
|
||||
}
|
||||
|
||||
void AtomExtensionLoader::PostActivateExtension(
|
||||
void ElectronExtensionLoader::PostActivateExtension(
|
||||
scoped_refptr<const Extension> extension) {}
|
||||
|
||||
void AtomExtensionLoader::PostDeactivateExtension(
|
||||
void ElectronExtensionLoader::PostDeactivateExtension(
|
||||
scoped_refptr<const Extension> extension) {}
|
||||
|
||||
void AtomExtensionLoader::LoadExtensionForReload(
|
||||
void ElectronExtensionLoader::LoadExtensionForReload(
|
||||
const ExtensionId& extension_id,
|
||||
const base::FilePath& path,
|
||||
LoadErrorBehavior load_error_behavior) {
|
||||
|
@ -153,21 +158,21 @@ void AtomExtensionLoader::LoadExtensionForReload(
|
|||
base::PostTaskAndReplyWithResult(
|
||||
GetExtensionFileTaskRunner().get(), FROM_HERE,
|
||||
base::BindOnce(&LoadUnpacked, path),
|
||||
base::BindOnce(&AtomExtensionLoader::FinishExtensionReload,
|
||||
base::BindOnce(&ElectronExtensionLoader::FinishExtensionReload,
|
||||
weak_factory_.GetWeakPtr(), extension_id));
|
||||
did_schedule_reload_ = true;
|
||||
}
|
||||
|
||||
bool AtomExtensionLoader::CanEnableExtension(const Extension* extension) {
|
||||
bool ElectronExtensionLoader::CanEnableExtension(const Extension* extension) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AtomExtensionLoader::CanDisableExtension(const Extension* extension) {
|
||||
bool ElectronExtensionLoader::CanDisableExtension(const Extension* extension) {
|
||||
// Extensions cannot be disabled by the user.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionLoader::ShouldBlockExtension(const Extension* extension) {
|
||||
bool ElectronExtensionLoader::ShouldBlockExtension(const Extension* extension) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2,11 +2,12 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_LOADER_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_LOADER_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_LOADER_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_LOADER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
|
@ -27,16 +28,16 @@ namespace extensions {
|
|||
class Extension;
|
||||
|
||||
// Handles extension loading and reloading using ExtensionRegistrar.
|
||||
class AtomExtensionLoader : public ExtensionRegistrar::Delegate {
|
||||
class ElectronExtensionLoader : public ExtensionRegistrar::Delegate {
|
||||
public:
|
||||
explicit AtomExtensionLoader(content::BrowserContext* browser_context);
|
||||
~AtomExtensionLoader() override;
|
||||
explicit ElectronExtensionLoader(content::BrowserContext* browser_context);
|
||||
~ElectronExtensionLoader() override;
|
||||
|
||||
// Loads an unpacked extension from a directory synchronously. Returns the
|
||||
// extension on success, or nullptr otherwise.
|
||||
void LoadExtension(
|
||||
const base::FilePath& extension_dir,
|
||||
base::OnceCallback<void(const Extension* extension)> loaded);
|
||||
void LoadExtension(const base::FilePath& extension_dir,
|
||||
base::OnceCallback<void(const Extension* extension,
|
||||
const std::string&)> cb);
|
||||
|
||||
// Starts reloading the extension. A keep-alive is maintained until the
|
||||
// reload succeeds/fails. If the extension is an app, it will be launched upon
|
||||
|
@ -51,11 +52,13 @@ class AtomExtensionLoader : public ExtensionRegistrar::Delegate {
|
|||
private:
|
||||
// If the extension loaded successfully, enables it. If it's an app, launches
|
||||
// it. If the load failed, updates ShellKeepAliveRequester.
|
||||
void FinishExtensionReload(const ExtensionId& old_extension_id,
|
||||
scoped_refptr<const Extension> extension);
|
||||
void FinishExtensionReload(
|
||||
const ExtensionId& old_extension_id,
|
||||
std::pair<scoped_refptr<const Extension>, std::string> result);
|
||||
|
||||
void FinishExtensionLoad(base::OnceCallback<void(const Extension*)> loaded,
|
||||
scoped_refptr<const Extension> extension);
|
||||
void FinishExtensionLoad(
|
||||
base::OnceCallback<void(const Extension*, const std::string&)> cb,
|
||||
std::pair<scoped_refptr<const Extension>, std::string> result);
|
||||
|
||||
// ExtensionRegistrar::Delegate:
|
||||
void PreAddExtension(const Extension* extension,
|
||||
|
@ -84,11 +87,11 @@ class AtomExtensionLoader : public ExtensionRegistrar::Delegate {
|
|||
// LoadExtensionForReload().
|
||||
bool did_schedule_reload_ = false;
|
||||
|
||||
base::WeakPtrFactory<AtomExtensionLoader> weak_factory_;
|
||||
base::WeakPtrFactory<ElectronExtensionLoader> weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionLoader);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionLoader);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_LOADER_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_LOADER_H_
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_extension_system.h"
|
||||
#include "shell/browser/extensions/electron_extension_system.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -30,27 +30,28 @@
|
|||
#include "extensions/browser/value_store/value_store_factory_impl.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/file_util.h"
|
||||
#include "shell/browser/extensions/atom_extension_loader.h"
|
||||
#include "shell/browser/extensions/electron_extension_loader.h"
|
||||
|
||||
using content::BrowserContext;
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
AtomExtensionSystem::AtomExtensionSystem(BrowserContext* browser_context)
|
||||
ElectronExtensionSystem::ElectronExtensionSystem(
|
||||
BrowserContext* browser_context)
|
||||
: browser_context_(browser_context),
|
||||
store_factory_(new ValueStoreFactoryImpl(browser_context->GetPath())),
|
||||
weak_factory_(this) {}
|
||||
|
||||
AtomExtensionSystem::~AtomExtensionSystem() = default;
|
||||
ElectronExtensionSystem::~ElectronExtensionSystem() = default;
|
||||
|
||||
void AtomExtensionSystem::LoadExtension(
|
||||
void ElectronExtensionSystem::LoadExtension(
|
||||
const base::FilePath& extension_dir,
|
||||
base::OnceCallback<void(const Extension*)> loaded) {
|
||||
extension_loader_->LoadExtension(extension_dir, std::move(loaded));
|
||||
base::OnceCallback<void(const Extension*, const std::string&)> cb) {
|
||||
extension_loader_->LoadExtension(extension_dir, std::move(cb));
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::FinishInitialization() {
|
||||
void ElectronExtensionSystem::FinishInitialization() {
|
||||
// Inform the rest of the extensions system to start.
|
||||
ready_.Signal();
|
||||
content::NotificationService::current()->Notify(
|
||||
|
@ -59,20 +60,20 @@ void AtomExtensionSystem::FinishInitialization() {
|
|||
content::NotificationService::NoDetails());
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::ReloadExtension(const ExtensionId& extension_id) {
|
||||
void ElectronExtensionSystem::ReloadExtension(const ExtensionId& extension_id) {
|
||||
extension_loader_->ReloadExtension(extension_id);
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::RemoveExtension(const ExtensionId& extension_id) {
|
||||
void ElectronExtensionSystem::RemoveExtension(const ExtensionId& extension_id) {
|
||||
extension_loader_->UnloadExtension(
|
||||
extension_id, extensions::UnloadedExtensionReason::UNINSTALL);
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::Shutdown() {
|
||||
void ElectronExtensionSystem::Shutdown() {
|
||||
extension_loader_.reset();
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
|
||||
void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
|
||||
service_worker_manager_ =
|
||||
std::make_unique<ServiceWorkerManager>(browser_context_);
|
||||
runtime_data_ =
|
||||
|
@ -81,56 +82,57 @@ void AtomExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
|
|||
shared_user_script_master_ =
|
||||
std::make_unique<SharedUserScriptMaster>(browser_context_);
|
||||
app_sorting_ = std::make_unique<NullAppSorting>();
|
||||
extension_loader_ = std::make_unique<AtomExtensionLoader>(browser_context_);
|
||||
extension_loader_ =
|
||||
std::make_unique<ElectronExtensionLoader>(browser_context_);
|
||||
}
|
||||
|
||||
ExtensionService* AtomExtensionSystem::extension_service() {
|
||||
ExtensionService* ElectronExtensionSystem::extension_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RuntimeData* AtomExtensionSystem::runtime_data() {
|
||||
RuntimeData* ElectronExtensionSystem::runtime_data() {
|
||||
return runtime_data_.get();
|
||||
}
|
||||
|
||||
ManagementPolicy* AtomExtensionSystem::management_policy() {
|
||||
ManagementPolicy* ElectronExtensionSystem::management_policy() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ServiceWorkerManager* AtomExtensionSystem::service_worker_manager() {
|
||||
ServiceWorkerManager* ElectronExtensionSystem::service_worker_manager() {
|
||||
return service_worker_manager_.get();
|
||||
}
|
||||
|
||||
SharedUserScriptMaster* AtomExtensionSystem::shared_user_script_master() {
|
||||
SharedUserScriptMaster* ElectronExtensionSystem::shared_user_script_master() {
|
||||
return new SharedUserScriptMaster(browser_context_);
|
||||
}
|
||||
|
||||
StateStore* AtomExtensionSystem::state_store() {
|
||||
StateStore* ElectronExtensionSystem::state_store() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StateStore* AtomExtensionSystem::rules_store() {
|
||||
StateStore* ElectronExtensionSystem::rules_store() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scoped_refptr<ValueStoreFactory> AtomExtensionSystem::store_factory() {
|
||||
scoped_refptr<ValueStoreFactory> ElectronExtensionSystem::store_factory() {
|
||||
return store_factory_;
|
||||
}
|
||||
|
||||
InfoMap* AtomExtensionSystem::info_map() {
|
||||
InfoMap* ElectronExtensionSystem::info_map() {
|
||||
if (!info_map_.get())
|
||||
info_map_ = new InfoMap;
|
||||
return info_map_.get();
|
||||
}
|
||||
|
||||
QuotaService* AtomExtensionSystem::quota_service() {
|
||||
QuotaService* ElectronExtensionSystem::quota_service() {
|
||||
return quota_service_.get();
|
||||
}
|
||||
|
||||
AppSorting* AtomExtensionSystem::app_sorting() {
|
||||
AppSorting* ElectronExtensionSystem::app_sorting() {
|
||||
return app_sorting_.get();
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
void ElectronExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
base::OnceClosure callback) {
|
||||
base::PostTaskAndReply(
|
||||
|
@ -140,24 +142,24 @@ void AtomExtensionSystem::RegisterExtensionWithRequestContexts(
|
|||
std::move(callback));
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::UnregisterExtensionWithRequestContexts(
|
||||
void ElectronExtensionSystem::UnregisterExtensionWithRequestContexts(
|
||||
const std::string& extension_id,
|
||||
const UnloadedExtensionReason reason) {}
|
||||
|
||||
const base::OneShotEvent& AtomExtensionSystem::ready() const {
|
||||
const base::OneShotEvent& ElectronExtensionSystem::ready() const {
|
||||
return ready_;
|
||||
}
|
||||
|
||||
ContentVerifier* AtomExtensionSystem::content_verifier() {
|
||||
ContentVerifier* ElectronExtensionSystem::content_verifier() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<ExtensionSet> AtomExtensionSystem::GetDependentExtensions(
|
||||
std::unique_ptr<ExtensionSet> ElectronExtensionSystem::GetDependentExtensions(
|
||||
const Extension* extension) {
|
||||
return std::make_unique<ExtensionSet>();
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::InstallUpdate(
|
||||
void ElectronExtensionSystem::InstallUpdate(
|
||||
const std::string& extension_id,
|
||||
const std::string& public_key,
|
||||
const base::FilePath& temp_dir,
|
||||
|
@ -167,14 +169,14 @@ void AtomExtensionSystem::InstallUpdate(
|
|||
base::DeleteFile(temp_dir, true /* recursive */);
|
||||
}
|
||||
|
||||
bool AtomExtensionSystem::FinishDelayedInstallationIfReady(
|
||||
bool ElectronExtensionSystem::FinishDelayedInstallationIfReady(
|
||||
const std::string& extension_id,
|
||||
bool install_immediately) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void AtomExtensionSystem::OnExtensionRegisteredWithRequestContexts(
|
||||
void ElectronExtensionSystem::OnExtensionRegisteredWithRequestContexts(
|
||||
scoped_refptr<Extension> extension) {
|
||||
ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_);
|
||||
registry->AddReady(extension);
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_SYSTEM_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_SYSTEM_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -26,21 +26,22 @@ class BrowserContext;
|
|||
|
||||
namespace extensions {
|
||||
|
||||
class AtomExtensionLoader;
|
||||
class ElectronExtensionLoader;
|
||||
class ValueStoreFactory;
|
||||
|
||||
// A simplified version of ExtensionSystem for app_shell. Allows
|
||||
// app_shell to skip initialization of services it doesn't need.
|
||||
class AtomExtensionSystem : public ExtensionSystem {
|
||||
class ElectronExtensionSystem : public ExtensionSystem {
|
||||
public:
|
||||
using InstallUpdateCallback = ExtensionSystem::InstallUpdateCallback;
|
||||
explicit AtomExtensionSystem(content::BrowserContext* browser_context);
|
||||
~AtomExtensionSystem() override;
|
||||
explicit ElectronExtensionSystem(content::BrowserContext* browser_context);
|
||||
~ElectronExtensionSystem() override;
|
||||
|
||||
// Loads an unpacked extension from a directory. Returns the extension on
|
||||
// success, or nullptr otherwise.
|
||||
void LoadExtension(const base::FilePath& extension_dir,
|
||||
base::OnceCallback<void(const Extension*)> loaded);
|
||||
void LoadExtension(
|
||||
const base::FilePath& extension_dir,
|
||||
base::OnceCallback<void(const Extension*, const std::string&)> cb);
|
||||
|
||||
// Finish initialization for the shell extension system.
|
||||
void FinishInitialization();
|
||||
|
@ -98,18 +99,18 @@ class AtomExtensionSystem : public ExtensionSystem {
|
|||
std::unique_ptr<SharedUserScriptMaster> shared_user_script_master_;
|
||||
std::unique_ptr<AppSorting> app_sorting_;
|
||||
|
||||
std::unique_ptr<AtomExtensionLoader> extension_loader_;
|
||||
std::unique_ptr<ElectronExtensionLoader> extension_loader_;
|
||||
|
||||
scoped_refptr<ValueStoreFactory> store_factory_;
|
||||
|
||||
// Signaled when the extension system has completed its startup tasks.
|
||||
base::OneShotEvent ready_;
|
||||
|
||||
base::WeakPtrFactory<AtomExtensionSystem> weak_factory_;
|
||||
base::WeakPtrFactory<ElectronExtensionSystem> weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionSystem);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionSystem);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_SYSTEM_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_H_
|
|
@ -2,49 +2,50 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_extension_system_factory.h"
|
||||
#include "shell/browser/extensions/electron_extension_system_factory.h"
|
||||
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "extensions/browser/extension_prefs_factory.h"
|
||||
#include "extensions/browser/extension_registry_factory.h"
|
||||
#include "shell/browser/extensions/atom_extension_system.h"
|
||||
#include "shell/browser/extensions/electron_extension_system.h"
|
||||
|
||||
using content::BrowserContext;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
ExtensionSystem* AtomExtensionSystemFactory::GetForBrowserContext(
|
||||
ExtensionSystem* ElectronExtensionSystemFactory::GetForBrowserContext(
|
||||
BrowserContext* context) {
|
||||
return static_cast<AtomExtensionSystem*>(
|
||||
return static_cast<ElectronExtensionSystem*>(
|
||||
GetInstance()->GetServiceForBrowserContext(context, true));
|
||||
}
|
||||
|
||||
// static
|
||||
AtomExtensionSystemFactory* AtomExtensionSystemFactory::GetInstance() {
|
||||
return base::Singleton<AtomExtensionSystemFactory>::get();
|
||||
ElectronExtensionSystemFactory* ElectronExtensionSystemFactory::GetInstance() {
|
||||
return base::Singleton<ElectronExtensionSystemFactory>::get();
|
||||
}
|
||||
|
||||
AtomExtensionSystemFactory::AtomExtensionSystemFactory()
|
||||
: ExtensionSystemProvider("AtomExtensionSystem",
|
||||
ElectronExtensionSystemFactory::ElectronExtensionSystemFactory()
|
||||
: ExtensionSystemProvider("ElectronExtensionSystem",
|
||||
BrowserContextDependencyManager::GetInstance()) {
|
||||
DependsOn(ExtensionPrefsFactory::GetInstance());
|
||||
DependsOn(ExtensionRegistryFactory::GetInstance());
|
||||
}
|
||||
|
||||
AtomExtensionSystemFactory::~AtomExtensionSystemFactory() {}
|
||||
ElectronExtensionSystemFactory::~ElectronExtensionSystemFactory() {}
|
||||
|
||||
KeyedService* AtomExtensionSystemFactory::BuildServiceInstanceFor(
|
||||
KeyedService* ElectronExtensionSystemFactory::BuildServiceInstanceFor(
|
||||
BrowserContext* context) const {
|
||||
return new AtomExtensionSystem(context);
|
||||
return new ElectronExtensionSystem(context);
|
||||
}
|
||||
|
||||
BrowserContext* AtomExtensionSystemFactory::GetBrowserContextToUse(
|
||||
BrowserContext* ElectronExtensionSystemFactory::GetBrowserContextToUse(
|
||||
BrowserContext* context) const {
|
||||
// Use a separate instance for incognito.
|
||||
return context;
|
||||
}
|
||||
|
||||
bool AtomExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const {
|
||||
bool ElectronExtensionSystemFactory::ServiceIsCreatedWithBrowserContext()
|
||||
const {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_SYSTEM_FACTORY_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_SYSTEM_FACTORY_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_FACTORY_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_FACTORY_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/singleton.h"
|
||||
|
@ -11,20 +11,20 @@
|
|||
|
||||
namespace extensions {
|
||||
|
||||
// A factory that provides AtomExtensionSystem.
|
||||
class AtomExtensionSystemFactory : public ExtensionSystemProvider {
|
||||
// A factory that provides ElectronExtensionSystem.
|
||||
class ElectronExtensionSystemFactory : public ExtensionSystemProvider {
|
||||
public:
|
||||
// ExtensionSystemProvider implementation:
|
||||
ExtensionSystem* GetForBrowserContext(
|
||||
content::BrowserContext* context) override;
|
||||
|
||||
static AtomExtensionSystemFactory* GetInstance();
|
||||
static ElectronExtensionSystemFactory* GetInstance();
|
||||
|
||||
private:
|
||||
friend struct base::DefaultSingletonTraits<AtomExtensionSystemFactory>;
|
||||
friend struct base::DefaultSingletonTraits<ElectronExtensionSystemFactory>;
|
||||
|
||||
AtomExtensionSystemFactory();
|
||||
~AtomExtensionSystemFactory() override;
|
||||
ElectronExtensionSystemFactory();
|
||||
~ElectronExtensionSystemFactory() override;
|
||||
|
||||
// BrowserContextKeyedServiceFactory implementation:
|
||||
KeyedService* BuildServiceInstanceFor(
|
||||
|
@ -33,9 +33,9 @@ class AtomExtensionSystemFactory : public ExtensionSystemProvider {
|
|||
content::BrowserContext* context) const override;
|
||||
bool ServiceIsCreatedWithBrowserContext() const override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionSystemFactory);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionSystemFactory);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_SYSTEM_FACTORY_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_FACTORY_H_
|
|
@ -2,25 +2,25 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_extension_web_contents_observer.h"
|
||||
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
AtomExtensionWebContentsObserver::AtomExtensionWebContentsObserver(
|
||||
ElectronExtensionWebContentsObserver::ElectronExtensionWebContentsObserver(
|
||||
content::WebContents* web_contents)
|
||||
: ExtensionWebContentsObserver(web_contents) {}
|
||||
|
||||
AtomExtensionWebContentsObserver::~AtomExtensionWebContentsObserver() {}
|
||||
ElectronExtensionWebContentsObserver::~ElectronExtensionWebContentsObserver() {}
|
||||
|
||||
void AtomExtensionWebContentsObserver::CreateForWebContents(
|
||||
void ElectronExtensionWebContentsObserver::CreateForWebContents(
|
||||
content::WebContents* web_contents) {
|
||||
content::WebContentsUserData<
|
||||
AtomExtensionWebContentsObserver>::CreateForWebContents(web_contents);
|
||||
ElectronExtensionWebContentsObserver>::CreateForWebContents(web_contents);
|
||||
|
||||
// Initialize this instance if necessary.
|
||||
FromWebContents(web_contents)->Initialize();
|
||||
}
|
||||
|
||||
WEB_CONTENTS_USER_DATA_KEY_IMPL(AtomExtensionWebContentsObserver)
|
||||
WEB_CONTENTS_USER_DATA_KEY_IMPL(ElectronExtensionWebContentsObserver)
|
||||
|
||||
} // namespace extensions
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
|
@ -12,26 +12,29 @@
|
|||
namespace extensions {
|
||||
|
||||
// The app_shell version of ExtensionWebContentsObserver.
|
||||
class AtomExtensionWebContentsObserver
|
||||
class ElectronExtensionWebContentsObserver
|
||||
: public ExtensionWebContentsObserver,
|
||||
public content::WebContentsUserData<AtomExtensionWebContentsObserver> {
|
||||
public content::WebContentsUserData<
|
||||
ElectronExtensionWebContentsObserver> {
|
||||
public:
|
||||
~AtomExtensionWebContentsObserver() override;
|
||||
~ElectronExtensionWebContentsObserver() override;
|
||||
|
||||
// Creates and initializes an instance of this class for the given
|
||||
// |web_contents|, if it doesn't already exist.
|
||||
static void CreateForWebContents(content::WebContents* web_contents);
|
||||
|
||||
private:
|
||||
friend class content::WebContentsUserData<AtomExtensionWebContentsObserver>;
|
||||
friend class content::WebContentsUserData<
|
||||
ElectronExtensionWebContentsObserver>;
|
||||
|
||||
explicit AtomExtensionWebContentsObserver(content::WebContents* web_contents);
|
||||
explicit ElectronExtensionWebContentsObserver(
|
||||
content::WebContents* web_contents);
|
||||
|
||||
WEB_CONTENTS_USER_DATA_KEY_DECL();
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionWebContentsObserver);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionWebContentsObserver);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "shell/browser/extensions/atom_extension_web_contents_observer.h"
|
||||
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
|
||||
#include "shell/browser/extensions/electron_messaging_delegate.h"
|
||||
|
||||
namespace extensions {
|
||||
|
@ -22,7 +22,7 @@ MessagingDelegate* ElectronExtensionsAPIClient::GetMessagingDelegate() {
|
|||
|
||||
void ElectronExtensionsAPIClient::AttachWebContentsHelpers(
|
||||
content::WebContents* web_contents) const {
|
||||
extensions::AtomExtensionWebContentsObserver::CreateForWebContents(
|
||||
extensions::ElectronExtensionWebContentsObserver::CreateForWebContents(
|
||||
web_contents);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_extensions_browser_client.h"
|
||||
#include "shell/browser/extensions/electron_extensions_browser_client.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
@ -30,13 +30,13 @@
|
|||
#include "shell/browser/atom_browser_client.h"
|
||||
#include "shell/browser/atom_browser_context.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/extensions/api/runtime/atom_runtime_api_delegate.h"
|
||||
#include "shell/browser/extensions/atom_extension_host_delegate.h"
|
||||
#include "shell/browser/extensions/atom_extension_system_factory.h"
|
||||
#include "shell/browser/extensions/atom_extension_web_contents_observer.h"
|
||||
#include "shell/browser/extensions/atom_navigation_ui_data.h"
|
||||
#include "shell/browser/extensions/api/runtime/electron_runtime_api_delegate.h"
|
||||
#include "shell/browser/extensions/electron_extension_host_delegate.h"
|
||||
#include "shell/browser/extensions/electron_extension_system_factory.h"
|
||||
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
|
||||
#include "shell/browser/extensions/electron_extensions_api_client.h"
|
||||
#include "shell/browser/extensions/electron_extensions_browser_api_provider.h"
|
||||
#include "shell/browser/extensions/electron_navigation_ui_data.h"
|
||||
#include "shell/browser/extensions/electron_process_manager_delegate.h"
|
||||
|
||||
using content::BrowserContext;
|
||||
|
@ -44,7 +44,7 @@ using content::BrowserThread;
|
|||
|
||||
namespace electron {
|
||||
|
||||
AtomExtensionsBrowserClient::AtomExtensionsBrowserClient()
|
||||
ElectronExtensionsBrowserClient::ElectronExtensionsBrowserClient()
|
||||
: api_client_(new extensions::ElectronExtensionsAPIClient),
|
||||
process_manager_delegate_(new extensions::ElectronProcessManagerDelegate),
|
||||
extension_cache_(new extensions::NullExtensionCache()) {
|
||||
|
@ -58,19 +58,19 @@ AtomExtensionsBrowserClient::AtomExtensionsBrowserClient()
|
|||
std::make_unique<extensions::ElectronExtensionsBrowserAPIProvider>());
|
||||
}
|
||||
|
||||
AtomExtensionsBrowserClient::~AtomExtensionsBrowserClient() {}
|
||||
ElectronExtensionsBrowserClient::~ElectronExtensionsBrowserClient() {}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsShuttingDown() {
|
||||
bool ElectronExtensionsBrowserClient::IsShuttingDown() {
|
||||
return electron::Browser::Get()->is_shutting_down();
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::AreExtensionsDisabled(
|
||||
bool ElectronExtensionsBrowserClient::AreExtensionsDisabled(
|
||||
const base::CommandLine& command_line,
|
||||
BrowserContext* context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
|
||||
bool ElectronExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
|
||||
auto context_map = AtomBrowserContext::browser_context_map();
|
||||
for (auto const& entry : context_map) {
|
||||
if (entry.second && entry.second.get() == context)
|
||||
|
@ -79,23 +79,23 @@ bool AtomExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsSameContext(BrowserContext* first,
|
||||
BrowserContext* second) {
|
||||
bool ElectronExtensionsBrowserClient::IsSameContext(BrowserContext* first,
|
||||
BrowserContext* second) {
|
||||
return first == second;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::HasOffTheRecordContext(
|
||||
bool ElectronExtensionsBrowserClient::HasOffTheRecordContext(
|
||||
BrowserContext* context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BrowserContext* AtomExtensionsBrowserClient::GetOffTheRecordContext(
|
||||
BrowserContext* ElectronExtensionsBrowserClient::GetOffTheRecordContext(
|
||||
BrowserContext* context) {
|
||||
// app_shell only supports a single context.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BrowserContext* AtomExtensionsBrowserClient::GetOriginalContext(
|
||||
BrowserContext* ElectronExtensionsBrowserClient::GetOriginalContext(
|
||||
BrowserContext* context) {
|
||||
DCHECK(context);
|
||||
if (context->IsOffTheRecord()) {
|
||||
|
@ -105,24 +105,24 @@ BrowserContext* AtomExtensionsBrowserClient::GetOriginalContext(
|
|||
}
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsGuestSession(
|
||||
bool ElectronExtensionsBrowserClient::IsGuestSession(
|
||||
BrowserContext* context) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsExtensionIncognitoEnabled(
|
||||
bool ElectronExtensionsBrowserClient::IsExtensionIncognitoEnabled(
|
||||
const std::string& extension_id,
|
||||
content::BrowserContext* context) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::CanExtensionCrossIncognito(
|
||||
bool ElectronExtensionsBrowserClient::CanExtensionCrossIncognito(
|
||||
const extensions::Extension* extension,
|
||||
content::BrowserContext* context) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
base::FilePath AtomExtensionsBrowserClient::GetBundleResourcePath(
|
||||
base::FilePath ElectronExtensionsBrowserClient::GetBundleResourcePath(
|
||||
const network::ResourceRequest& request,
|
||||
const base::FilePath& extension_resources_path,
|
||||
int* resource_id) const {
|
||||
|
@ -130,7 +130,7 @@ base::FilePath AtomExtensionsBrowserClient::GetBundleResourcePath(
|
|||
return base::FilePath();
|
||||
}
|
||||
|
||||
void AtomExtensionsBrowserClient::LoadResourceFromResourceBundle(
|
||||
void ElectronExtensionsBrowserClient::LoadResourceFromResourceBundle(
|
||||
const network::ResourceRequest& request,
|
||||
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
||||
const base::FilePath& resource_relative_path,
|
||||
|
@ -172,7 +172,7 @@ bool AllowCrossRendererResourceLoad(const GURL& url,
|
|||
}
|
||||
} // namespace
|
||||
|
||||
bool AtomExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
bool ElectronExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
|
@ -192,71 +192,73 @@ bool AtomExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
|||
return false;
|
||||
}
|
||||
|
||||
PrefService* AtomExtensionsBrowserClient::GetPrefServiceForContext(
|
||||
PrefService* ElectronExtensionsBrowserClient::GetPrefServiceForContext(
|
||||
BrowserContext* context) {
|
||||
return static_cast<AtomBrowserContext*>(context)->prefs();
|
||||
}
|
||||
|
||||
void AtomExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
|
||||
void ElectronExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
|
||||
content::BrowserContext* context,
|
||||
std::vector<extensions::EarlyExtensionPrefsObserver*>* observers) const {}
|
||||
|
||||
extensions::ProcessManagerDelegate*
|
||||
AtomExtensionsBrowserClient::GetProcessManagerDelegate() const {
|
||||
ElectronExtensionsBrowserClient::GetProcessManagerDelegate() const {
|
||||
return process_manager_delegate_.get();
|
||||
}
|
||||
|
||||
std::unique_ptr<extensions::ExtensionHostDelegate> AtomExtensionsBrowserClient::
|
||||
std::unique_ptr<extensions::ExtensionHostDelegate>
|
||||
ElectronExtensionsBrowserClient::
|
||||
CreateExtensionHostDelegate() { // TODO(samuelmaddock):
|
||||
return base::WrapUnique(new extensions::AtomExtensionHostDelegate);
|
||||
return base::WrapUnique(new extensions::ElectronExtensionHostDelegate);
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
|
||||
bool ElectronExtensionsBrowserClient::DidVersionUpdate(
|
||||
BrowserContext* context) {
|
||||
// TODO(jamescook): We might want to tell extensions when app_shell updates.
|
||||
return false;
|
||||
}
|
||||
|
||||
void AtomExtensionsBrowserClient::PermitExternalProtocolHandler() {}
|
||||
void ElectronExtensionsBrowserClient::PermitExternalProtocolHandler() {}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsInDemoMode() {
|
||||
bool ElectronExtensionsBrowserClient::IsInDemoMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsScreensaverInDemoMode(
|
||||
bool ElectronExtensionsBrowserClient::IsScreensaverInDemoMode(
|
||||
const std::string& app_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsRunningInForcedAppMode() {
|
||||
bool ElectronExtensionsBrowserClient::IsRunningInForcedAppMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsAppModeForcedForApp(
|
||||
bool ElectronExtensionsBrowserClient::IsAppModeForcedForApp(
|
||||
const extensions::ExtensionId& extension_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsLoggedInAsPublicAccount() {
|
||||
bool ElectronExtensionsBrowserClient::IsLoggedInAsPublicAccount() {
|
||||
return false;
|
||||
}
|
||||
|
||||
extensions::ExtensionSystemProvider*
|
||||
AtomExtensionsBrowserClient::GetExtensionSystemFactory() {
|
||||
return extensions::AtomExtensionSystemFactory::GetInstance();
|
||||
ElectronExtensionsBrowserClient::GetExtensionSystemFactory() {
|
||||
return extensions::ElectronExtensionSystemFactory::GetInstance();
|
||||
}
|
||||
|
||||
std::unique_ptr<extensions::RuntimeAPIDelegate>
|
||||
AtomExtensionsBrowserClient::CreateRuntimeAPIDelegate(
|
||||
ElectronExtensionsBrowserClient::CreateRuntimeAPIDelegate(
|
||||
content::BrowserContext* context) const {
|
||||
return std::make_unique<extensions::AtomRuntimeAPIDelegate>(context);
|
||||
return std::make_unique<extensions::ElectronRuntimeAPIDelegate>(context);
|
||||
}
|
||||
|
||||
const extensions::ComponentExtensionResourceManager*
|
||||
AtomExtensionsBrowserClient::GetComponentExtensionResourceManager() {
|
||||
ElectronExtensionsBrowserClient::GetComponentExtensionResourceManager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void AtomExtensionsBrowserClient::BroadcastEventToRenderers(
|
||||
void ElectronExtensionsBrowserClient::BroadcastEventToRenderers(
|
||||
extensions::events::HistogramValue histogram_value,
|
||||
const std::string& event_name,
|
||||
std::unique_ptr<base::ListValue> args,
|
||||
|
@ -264,9 +266,10 @@ void AtomExtensionsBrowserClient::BroadcastEventToRenderers(
|
|||
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&AtomExtensionsBrowserClient::BroadcastEventToRenderers,
|
||||
base::Unretained(this), histogram_value, event_name,
|
||||
std::move(args), dispatch_to_off_the_record_profiles));
|
||||
base::BindOnce(
|
||||
&ElectronExtensionsBrowserClient::BroadcastEventToRenderers,
|
||||
base::Unretained(this), histogram_value, event_name,
|
||||
std::move(args), dispatch_to_off_the_record_profiles));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -281,49 +284,50 @@ void AtomExtensionsBrowserClient::BroadcastEventToRenderers(
|
|||
}
|
||||
}
|
||||
|
||||
extensions::ExtensionCache* AtomExtensionsBrowserClient::GetExtensionCache() {
|
||||
extensions::ExtensionCache*
|
||||
ElectronExtensionsBrowserClient::GetExtensionCache() {
|
||||
return extension_cache_.get();
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsBackgroundUpdateAllowed() {
|
||||
bool ElectronExtensionsBrowserClient::IsBackgroundUpdateAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsMinBrowserVersionSupported(
|
||||
bool ElectronExtensionsBrowserClient::IsMinBrowserVersionSupported(
|
||||
const std::string& min_version) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void AtomExtensionsBrowserClient::SetAPIClientForTest(
|
||||
void ElectronExtensionsBrowserClient::SetAPIClientForTest(
|
||||
extensions::ExtensionsAPIClient* api_client) {
|
||||
api_client_.reset(api_client);
|
||||
}
|
||||
|
||||
extensions::ExtensionWebContentsObserver*
|
||||
AtomExtensionsBrowserClient::GetExtensionWebContentsObserver(
|
||||
ElectronExtensionsBrowserClient::GetExtensionWebContentsObserver(
|
||||
content::WebContents* web_contents) {
|
||||
return extensions::AtomExtensionWebContentsObserver::FromWebContents(
|
||||
return extensions::ElectronExtensionWebContentsObserver::FromWebContents(
|
||||
web_contents);
|
||||
}
|
||||
|
||||
extensions::KioskDelegate* AtomExtensionsBrowserClient::GetKioskDelegate() {
|
||||
extensions::KioskDelegate* ElectronExtensionsBrowserClient::GetKioskDelegate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool AtomExtensionsBrowserClient::IsLockScreenContext(
|
||||
bool ElectronExtensionsBrowserClient::IsLockScreenContext(
|
||||
content::BrowserContext* context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string AtomExtensionsBrowserClient::GetApplicationLocale() {
|
||||
std::string ElectronExtensionsBrowserClient::GetApplicationLocale() {
|
||||
return AtomBrowserClient::Get()->GetApplicationLocale();
|
||||
}
|
||||
|
||||
std::string AtomExtensionsBrowserClient::GetUserAgent() const {
|
||||
std::string ElectronExtensionsBrowserClient::GetUserAgent() const {
|
||||
return AtomBrowserClient::Get()->GetUserAgent();
|
||||
}
|
||||
|
||||
void AtomExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
void ElectronExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const extensions::Extension* extension) const {}
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSIONS_BROWSER_CLIENT_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSIONS_BROWSER_CLIENT_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_CLIENT_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_CLIENT_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -31,10 +31,11 @@ namespace electron {
|
|||
// with no related incognito context.
|
||||
// Must be initialized via InitWithBrowserContext() once the BrowserContext is
|
||||
// created.
|
||||
class AtomExtensionsBrowserClient : public extensions::ExtensionsBrowserClient {
|
||||
class ElectronExtensionsBrowserClient
|
||||
: public extensions::ExtensionsBrowserClient {
|
||||
public:
|
||||
AtomExtensionsBrowserClient();
|
||||
~AtomExtensionsBrowserClient() override;
|
||||
ElectronExtensionsBrowserClient();
|
||||
~ElectronExtensionsBrowserClient() override;
|
||||
|
||||
// ExtensionsBrowserClient overrides:
|
||||
bool IsShuttingDown() override;
|
||||
|
@ -137,9 +138,9 @@ class AtomExtensionsBrowserClient : public extensions::ExtensionsBrowserClient {
|
|||
// The extension cache used for download and installation.
|
||||
std::unique_ptr<extensions::ExtensionCache> extension_cache_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionsBrowserClient);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionsBrowserClient);
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_EXTENSIONS_BROWSER_CLIENT_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_CLIENT_H_
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/extensions/atom_navigation_ui_data.h"
|
||||
#include "shell/browser/extensions/electron_navigation_ui_data.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
@ -11,20 +11,20 @@
|
|||
|
||||
namespace extensions {
|
||||
|
||||
AtomNavigationUIData::AtomNavigationUIData() {}
|
||||
ElectronNavigationUIData::ElectronNavigationUIData() {}
|
||||
|
||||
AtomNavigationUIData::AtomNavigationUIData(
|
||||
ElectronNavigationUIData::ElectronNavigationUIData(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
extension_data_ = std::make_unique<ExtensionNavigationUIData>(
|
||||
navigation_handle, extension_misc::kUnknownTabId,
|
||||
extension_misc::kUnknownWindowId);
|
||||
}
|
||||
|
||||
AtomNavigationUIData::~AtomNavigationUIData() {}
|
||||
ElectronNavigationUIData::~ElectronNavigationUIData() {}
|
||||
|
||||
std::unique_ptr<content::NavigationUIData> AtomNavigationUIData::Clone() {
|
||||
std::unique_ptr<AtomNavigationUIData> copy =
|
||||
std::make_unique<AtomNavigationUIData>();
|
||||
std::unique_ptr<content::NavigationUIData> ElectronNavigationUIData::Clone() {
|
||||
std::unique_ptr<ElectronNavigationUIData> copy =
|
||||
std::make_unique<ElectronNavigationUIData>();
|
||||
|
||||
if (extension_data_)
|
||||
copy->SetExtensionNavigationUIData(extension_data_->DeepCopy());
|
||||
|
@ -32,7 +32,7 @@ std::unique_ptr<content::NavigationUIData> AtomNavigationUIData::Clone() {
|
|||
return std::move(copy);
|
||||
}
|
||||
|
||||
void AtomNavigationUIData::SetExtensionNavigationUIData(
|
||||
void ElectronNavigationUIData::SetExtensionNavigationUIData(
|
||||
std::unique_ptr<ExtensionNavigationUIData> extension_data) {
|
||||
extension_data_ = std::move(extension_data);
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ATOM_NAVIGATION_UI_DATA_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ATOM_NAVIGATION_UI_DATA_H_
|
||||
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_NAVIGATION_UI_DATA_H_
|
||||
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_NAVIGATION_UI_DATA_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -18,11 +18,12 @@ namespace extensions {
|
|||
// beginning of each navigation. The class is instantiated on the UI thread,
|
||||
// then a copy created using Clone is passed to the content::ResourceRequestInfo
|
||||
// on the IO thread.
|
||||
class AtomNavigationUIData : public content::NavigationUIData {
|
||||
class ElectronNavigationUIData : public content::NavigationUIData {
|
||||
public:
|
||||
AtomNavigationUIData();
|
||||
explicit AtomNavigationUIData(content::NavigationHandle* navigation_handle);
|
||||
~AtomNavigationUIData() override;
|
||||
ElectronNavigationUIData();
|
||||
explicit ElectronNavigationUIData(
|
||||
content::NavigationHandle* navigation_handle);
|
||||
~ElectronNavigationUIData() override;
|
||||
|
||||
// Creates a new ChromeNavigationUIData that is a deep copy of the original.
|
||||
// Any changes to the original after the clone is created will not be
|
||||
|
@ -40,9 +41,9 @@ class AtomNavigationUIData : public content::NavigationUIData {
|
|||
// Manages the lifetime of optional ExtensionNavigationUIData information.
|
||||
std::unique_ptr<ExtensionNavigationUIData> extension_data_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomNavigationUIData);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronNavigationUIData);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ATOM_NAVIGATION_UI_DATA_H_
|
||||
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_NAVIGATION_UI_DATA_H_
|
|
@ -29,10 +29,10 @@
|
|||
#include "shell/browser/ui/inspectable_web_contents.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
#include "shell/browser/window_list.h"
|
||||
#include "shell/common/deprecate_util.h"
|
||||
#include "shell/common/gin_converters/gfx_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "shell/common/process_util.h"
|
||||
#include "skia/ext/skia_utils_mac.h"
|
||||
#include "third_party/webrtc/modules/desktop_capture/mac/window_list_utils.h"
|
||||
#include "ui/gfx/skia_util.h"
|
||||
|
@ -1463,16 +1463,14 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
|||
NSVisualEffectMaterial vibrancyType;
|
||||
|
||||
if (type == "appearance-based") {
|
||||
EmitDeprecationWarning(
|
||||
env, "NSVisualEffectMaterialAppearanceBased" + dep_warn, "electron");
|
||||
EmitWarning(env, "NSVisualEffectMaterialAppearanceBased" + dep_warn,
|
||||
"electron");
|
||||
vibrancyType = NSVisualEffectMaterialAppearanceBased;
|
||||
} else if (type == "light") {
|
||||
EmitDeprecationWarning(env, "NSVisualEffectMaterialLight" + dep_warn,
|
||||
"electron");
|
||||
EmitWarning(env, "NSVisualEffectMaterialLight" + dep_warn, "electron");
|
||||
vibrancyType = NSVisualEffectMaterialLight;
|
||||
} else if (type == "dark") {
|
||||
EmitDeprecationWarning(env, "NSVisualEffectMaterialDark" + dep_warn,
|
||||
"electron");
|
||||
EmitWarning(env, "NSVisualEffectMaterialDark" + dep_warn, "electron");
|
||||
vibrancyType = NSVisualEffectMaterialDark;
|
||||
} else if (type == "titlebar") {
|
||||
vibrancyType = NSVisualEffectMaterialTitlebar;
|
||||
|
@ -1495,13 +1493,13 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
|||
vibrancyType = static_cast<NSVisualEffectMaterial>(7);
|
||||
} else if (type == "medium-light") {
|
||||
// NSVisualEffectMaterialMediumLight
|
||||
EmitDeprecationWarning(
|
||||
env, "NSVisualEffectMaterialMediumLight" + dep_warn, "electron");
|
||||
EmitWarning(env, "NSVisualEffectMaterialMediumLight" + dep_warn,
|
||||
"electron");
|
||||
vibrancyType = static_cast<NSVisualEffectMaterial>(8);
|
||||
} else if (type == "ultra-dark") {
|
||||
// NSVisualEffectMaterialUltraDark
|
||||
EmitDeprecationWarning(env, "NSVisualEffectMaterialUltraDark" + dep_warn,
|
||||
"electron");
|
||||
EmitWarning(env, "NSVisualEffectMaterialUltraDark" + dep_warn,
|
||||
"electron");
|
||||
vibrancyType = static_cast<NSVisualEffectMaterial>(9);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
// Copyright (c) 2019 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_DEPRECATE_UTIL_H_
|
||||
#define SHELL_COMMON_DEPRECATE_UTIL_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
void EmitDeprecationWarning(node::Environment* env,
|
||||
const std::string& warning_msg,
|
||||
const std::string& warning_type);
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_COMMON_DEPRECATE_UTIL_H_
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/common/extensions/atom_extensions_api_provider.h"
|
||||
#include "shell/common/extensions/electron_extensions_api_provider.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -74,50 +74,51 @@ base::span<const Alias> GetPermissionAliases() {
|
|||
|
||||
namespace electron {
|
||||
|
||||
AtomExtensionsAPIProvider::AtomExtensionsAPIProvider() = default;
|
||||
AtomExtensionsAPIProvider::~AtomExtensionsAPIProvider() = default;
|
||||
ElectronExtensionsAPIProvider::ElectronExtensionsAPIProvider() = default;
|
||||
ElectronExtensionsAPIProvider::~ElectronExtensionsAPIProvider() = default;
|
||||
|
||||
void AtomExtensionsAPIProvider::AddAPIFeatures(
|
||||
void ElectronExtensionsAPIProvider::AddAPIFeatures(
|
||||
extensions::FeatureProvider* provider) {
|
||||
extensions::AddElectronAPIFeatures(provider);
|
||||
}
|
||||
|
||||
void AtomExtensionsAPIProvider::AddManifestFeatures(
|
||||
void ElectronExtensionsAPIProvider::AddManifestFeatures(
|
||||
extensions::FeatureProvider* provider) {
|
||||
extensions::AddElectronManifestFeatures(provider);
|
||||
}
|
||||
|
||||
void AtomExtensionsAPIProvider::AddPermissionFeatures(
|
||||
void ElectronExtensionsAPIProvider::AddPermissionFeatures(
|
||||
extensions::FeatureProvider* provider) {
|
||||
// No shell-specific permission features.
|
||||
}
|
||||
|
||||
void AtomExtensionsAPIProvider::AddBehaviorFeatures(
|
||||
void ElectronExtensionsAPIProvider::AddBehaviorFeatures(
|
||||
extensions::FeatureProvider* provider) {
|
||||
// No shell-specific behavior features.
|
||||
}
|
||||
|
||||
void AtomExtensionsAPIProvider::AddAPIJSONSources(
|
||||
void ElectronExtensionsAPIProvider::AddAPIJSONSources(
|
||||
extensions::JSONFeatureProviderSource* json_source) {
|
||||
// json_source->LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES);
|
||||
}
|
||||
|
||||
bool AtomExtensionsAPIProvider::IsAPISchemaGenerated(const std::string& name) {
|
||||
bool ElectronExtensionsAPIProvider::IsAPISchemaGenerated(
|
||||
const std::string& name) {
|
||||
return extensions::api::ElectronGeneratedSchemas::IsGenerated(name);
|
||||
}
|
||||
|
||||
base::StringPiece AtomExtensionsAPIProvider::GetAPISchema(
|
||||
base::StringPiece ElectronExtensionsAPIProvider::GetAPISchema(
|
||||
const std::string& name) {
|
||||
return extensions::api::ElectronGeneratedSchemas::Get(name);
|
||||
}
|
||||
|
||||
void AtomExtensionsAPIProvider::RegisterPermissions(
|
||||
void ElectronExtensionsAPIProvider::RegisterPermissions(
|
||||
extensions::PermissionsInfo* permissions_info) {
|
||||
permissions_info->RegisterPermissions(extensions::GetPermissionInfos(),
|
||||
extensions::GetPermissionAliases());
|
||||
}
|
||||
|
||||
void AtomExtensionsAPIProvider::RegisterManifestHandlers() {
|
||||
void ElectronExtensionsAPIProvider::RegisterManifestHandlers() {
|
||||
extensions::ManifestHandlerRegistry* registry =
|
||||
extensions::ManifestHandlerRegistry::Get();
|
||||
registry->RegisterHandler(
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_EXTENSIONS_ATOM_EXTENSIONS_API_PROVIDER_H_
|
||||
#define SHELL_COMMON_EXTENSIONS_ATOM_EXTENSIONS_API_PROVIDER_H_
|
||||
#ifndef SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_API_PROVIDER_H_
|
||||
#define SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_API_PROVIDER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
|||
|
||||
namespace electron {
|
||||
|
||||
class AtomExtensionsAPIProvider : public extensions::ExtensionsAPIProvider {
|
||||
class ElectronExtensionsAPIProvider : public extensions::ExtensionsAPIProvider {
|
||||
public:
|
||||
AtomExtensionsAPIProvider();
|
||||
~AtomExtensionsAPIProvider() override;
|
||||
ElectronExtensionsAPIProvider();
|
||||
~ElectronExtensionsAPIProvider() override;
|
||||
|
||||
// ExtensionsAPIProvider:
|
||||
void AddAPIFeatures(extensions::FeatureProvider* provider) override;
|
||||
|
@ -31,9 +31,9 @@ class AtomExtensionsAPIProvider : public extensions::ExtensionsAPIProvider {
|
|||
void RegisterManifestHandlers() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionsAPIProvider);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionsAPIProvider);
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_COMMON_EXTENSIONS_ATOM_EXTENSIONS_API_PROVIDER_H_
|
||||
#endif // SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_API_PROVIDER_H_
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/common/extensions/atom_extensions_client.h"
|
||||
#include "shell/common/extensions/electron_extensions_client.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -17,7 +17,7 @@
|
|||
#include "extensions/common/features/simple_feature.h"
|
||||
#include "extensions/common/permissions/permission_message_provider.h"
|
||||
#include "extensions/common/url_pattern_set.h"
|
||||
#include "shell/common/extensions/atom_extensions_api_provider.h"
|
||||
#include "shell/common/extensions/electron_extensions_api_provider.h"
|
||||
|
||||
using extensions::ExtensionsClient;
|
||||
|
||||
|
@ -27,11 +27,11 @@ namespace {
|
|||
|
||||
// TODO(jamescook): Refactor ChromePermissionsMessageProvider so we can share
|
||||
// code. For now, this implementation does nothing.
|
||||
class AtomPermissionMessageProvider
|
||||
class ElectronPermissionMessageProvider
|
||||
: public extensions::PermissionMessageProvider {
|
||||
public:
|
||||
AtomPermissionMessageProvider() {}
|
||||
~AtomPermissionMessageProvider() override {}
|
||||
ElectronPermissionMessageProvider() {}
|
||||
~ElectronPermissionMessageProvider() override {}
|
||||
|
||||
// PermissionMessageProvider implementation.
|
||||
extensions::PermissionMessages GetPermissionMessages(
|
||||
|
@ -60,81 +60,82 @@ class AtomPermissionMessageProvider
|
|||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomPermissionMessageProvider);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronPermissionMessageProvider);
|
||||
};
|
||||
|
||||
base::LazyInstance<AtomPermissionMessageProvider>::DestructorAtExit
|
||||
base::LazyInstance<ElectronPermissionMessageProvider>::DestructorAtExit
|
||||
g_permission_message_provider = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
AtomExtensionsClient::AtomExtensionsClient()
|
||||
ElectronExtensionsClient::ElectronExtensionsClient()
|
||||
: webstore_base_url_(extension_urls::kChromeWebstoreBaseURL),
|
||||
webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) {
|
||||
AddAPIProvider(std::make_unique<extensions::CoreExtensionsAPIProvider>());
|
||||
AddAPIProvider(std::make_unique<AtomExtensionsAPIProvider>());
|
||||
AddAPIProvider(std::make_unique<ElectronExtensionsAPIProvider>());
|
||||
}
|
||||
|
||||
AtomExtensionsClient::~AtomExtensionsClient() {}
|
||||
ElectronExtensionsClient::~ElectronExtensionsClient() {}
|
||||
|
||||
void AtomExtensionsClient::Initialize() {
|
||||
void ElectronExtensionsClient::Initialize() {
|
||||
// TODO(jamescook): Do we need to whitelist any extensions?
|
||||
}
|
||||
|
||||
void AtomExtensionsClient::InitializeWebStoreUrls(
|
||||
void ElectronExtensionsClient::InitializeWebStoreUrls(
|
||||
base::CommandLine* command_line) {}
|
||||
|
||||
const extensions::PermissionMessageProvider&
|
||||
AtomExtensionsClient::GetPermissionMessageProvider() const {
|
||||
ElectronExtensionsClient::GetPermissionMessageProvider() const {
|
||||
NOTIMPLEMENTED();
|
||||
return g_permission_message_provider.Get();
|
||||
}
|
||||
|
||||
const std::string AtomExtensionsClient::GetProductName() {
|
||||
const std::string ElectronExtensionsClient::GetProductName() {
|
||||
// TODO(samuelmaddock):
|
||||
return "app_shell";
|
||||
}
|
||||
|
||||
void AtomExtensionsClient::FilterHostPermissions(
|
||||
void ElectronExtensionsClient::FilterHostPermissions(
|
||||
const extensions::URLPatternSet& hosts,
|
||||
extensions::URLPatternSet* new_hosts,
|
||||
extensions::PermissionIDSet* permissions) const {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void AtomExtensionsClient::SetScriptingWhitelist(
|
||||
void ElectronExtensionsClient::SetScriptingWhitelist(
|
||||
const ExtensionsClient::ScriptingWhitelist& whitelist) {
|
||||
scripting_whitelist_ = whitelist;
|
||||
}
|
||||
|
||||
const ExtensionsClient::ScriptingWhitelist&
|
||||
AtomExtensionsClient::GetScriptingWhitelist() const {
|
||||
ElectronExtensionsClient::GetScriptingWhitelist() const {
|
||||
// TODO(jamescook): Real whitelist.
|
||||
return scripting_whitelist_;
|
||||
}
|
||||
|
||||
extensions::URLPatternSet AtomExtensionsClient::GetPermittedChromeSchemeHosts(
|
||||
extensions::URLPatternSet
|
||||
ElectronExtensionsClient::GetPermittedChromeSchemeHosts(
|
||||
const extensions::Extension* extension,
|
||||
const extensions::APIPermissionSet& api_permissions) const {
|
||||
NOTIMPLEMENTED();
|
||||
return extensions::URLPatternSet();
|
||||
}
|
||||
|
||||
bool AtomExtensionsClient::IsScriptableURL(const GURL& url,
|
||||
std::string* error) const {
|
||||
bool ElectronExtensionsClient::IsScriptableURL(const GURL& url,
|
||||
std::string* error) const {
|
||||
// No restrictions on URLs.
|
||||
return true;
|
||||
}
|
||||
|
||||
const GURL& AtomExtensionsClient::GetWebstoreBaseURL() const {
|
||||
const GURL& ElectronExtensionsClient::GetWebstoreBaseURL() const {
|
||||
return webstore_base_url_;
|
||||
}
|
||||
|
||||
const GURL& AtomExtensionsClient::GetWebstoreUpdateURL() const {
|
||||
const GURL& ElectronExtensionsClient::GetWebstoreUpdateURL() const {
|
||||
return webstore_update_url_;
|
||||
}
|
||||
|
||||
bool AtomExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
|
||||
bool ElectronExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
|
||||
// TODO(rockot): Maybe we want to do something else here. For now we accept
|
||||
// any URL as a blacklist URL because we don't really care.
|
||||
return true;
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_EXTENSIONS_ATOM_EXTENSIONS_CLIENT_H_
|
||||
#define SHELL_COMMON_EXTENSIONS_ATOM_EXTENSIONS_CLIENT_H_
|
||||
#ifndef SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_
|
||||
#define SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -24,12 +24,12 @@ class URLPatternSet;
|
|||
namespace electron {
|
||||
|
||||
// The app_shell implementation of ExtensionsClient.
|
||||
class AtomExtensionsClient : public extensions::ExtensionsClient {
|
||||
class ElectronExtensionsClient : public extensions::ExtensionsClient {
|
||||
public:
|
||||
typedef extensions::ExtensionsClient::ScriptingWhitelist ScriptingWhitelist;
|
||||
|
||||
AtomExtensionsClient();
|
||||
~AtomExtensionsClient() override;
|
||||
ElectronExtensionsClient();
|
||||
~ElectronExtensionsClient() override;
|
||||
|
||||
// ExtensionsClient overrides:
|
||||
void Initialize() override;
|
||||
|
@ -57,9 +57,9 @@ class AtomExtensionsClient : public extensions::ExtensionsClient {
|
|||
const GURL webstore_base_url_;
|
||||
const GURL webstore_update_url_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionsClient);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionsClient);
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_COMMON_EXTENSIONS_ATOM_EXTENSIONS_CLIENT_H_
|
||||
#endif // SHELL_COMMON_EXTENSIONS_ELECTRON_EXTENSIONS_CLIENT_H_
|
|
@ -12,7 +12,6 @@
|
|||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "gin/converter.h"
|
||||
#include "shell/common/deprecate_util.h"
|
||||
#include "shell/common/gin_converters/gfx_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/common/deprecate_util.h"
|
||||
#include "shell/common/process_util.h"
|
||||
|
||||
#include "gin/dictionary.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
void EmitDeprecationWarning(node::Environment* env,
|
||||
const std::string& warning_msg,
|
||||
const std::string& warning_type) {
|
||||
void EmitWarning(node::Environment* env,
|
||||
const std::string& warning_msg,
|
||||
const std::string& warning_type) {
|
||||
gin::Dictionary process(env->isolate(), env->process_object());
|
||||
|
||||
base::RepeatingCallback<void(base::StringPiece, base::StringPiece,
|
20
shell/common/process_util.h
Normal file
20
shell/common/process_util.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) 2019 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_PROCESS_UTIL_H_
|
||||
#define SHELL_COMMON_PROCESS_UTIL_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
void EmitWarning(node::Environment* env,
|
||||
const std::string& warning_msg,
|
||||
const std::string& warning_type);
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_COMMON_PROCESS_UTIL_H_
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/renderer/extensions/atom_extensions_renderer_client.h"
|
||||
#include "shell/renderer/extensions/electron_extensions_renderer_client.h"
|
||||
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "extensions/renderer/dispatcher.h"
|
||||
|
@ -10,20 +10,20 @@
|
|||
|
||||
namespace electron {
|
||||
|
||||
AtomExtensionsRendererClient::AtomExtensionsRendererClient()
|
||||
ElectronExtensionsRendererClient::ElectronExtensionsRendererClient()
|
||||
: dispatcher_(std::make_unique<extensions::Dispatcher>(
|
||||
std::make_unique<ElectronExtensionsDispatcherDelegate>())) {
|
||||
dispatcher_->OnRenderThreadStarted(content::RenderThread::Get());
|
||||
}
|
||||
|
||||
AtomExtensionsRendererClient::~AtomExtensionsRendererClient() {}
|
||||
ElectronExtensionsRendererClient::~ElectronExtensionsRendererClient() {}
|
||||
|
||||
bool AtomExtensionsRendererClient::IsIncognitoProcess() const {
|
||||
bool ElectronExtensionsRendererClient::IsIncognitoProcess() const {
|
||||
// app_shell doesn't support off-the-record contexts.
|
||||
return false;
|
||||
}
|
||||
|
||||
int AtomExtensionsRendererClient::GetLowestIsolatedWorldId() const {
|
||||
int ElectronExtensionsRendererClient::GetLowestIsolatedWorldId() const {
|
||||
// app_shell doesn't need to reserve world IDs for anything other than
|
||||
// extensions, so we always return 1. Note that 0 is reserved for the global
|
||||
// world.
|
||||
|
@ -31,33 +31,33 @@ int AtomExtensionsRendererClient::GetLowestIsolatedWorldId() const {
|
|||
return 10;
|
||||
}
|
||||
|
||||
extensions::Dispatcher* AtomExtensionsRendererClient::GetDispatcher() {
|
||||
extensions::Dispatcher* ElectronExtensionsRendererClient::GetDispatcher() {
|
||||
return dispatcher_.get();
|
||||
}
|
||||
|
||||
bool AtomExtensionsRendererClient::ExtensionAPIEnabledForServiceWorkerScript(
|
||||
const GURL& scope,
|
||||
const GURL& script_url) const {
|
||||
bool ElectronExtensionsRendererClient::
|
||||
ExtensionAPIEnabledForServiceWorkerScript(const GURL& scope,
|
||||
const GURL& script_url) const {
|
||||
// TODO(nornagon): adapt logic from chrome's version
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AtomExtensionsRendererClient::AllowPopup() {
|
||||
bool ElectronExtensionsRendererClient::AllowPopup() {
|
||||
// TODO(samuelmaddock):
|
||||
return false;
|
||||
}
|
||||
|
||||
void AtomExtensionsRendererClient::RunScriptsAtDocumentStart(
|
||||
void ElectronExtensionsRendererClient::RunScriptsAtDocumentStart(
|
||||
content::RenderFrame* render_frame) {
|
||||
dispatcher_->RunScriptsAtDocumentStart(render_frame);
|
||||
}
|
||||
|
||||
void AtomExtensionsRendererClient::RunScriptsAtDocumentEnd(
|
||||
void ElectronExtensionsRendererClient::RunScriptsAtDocumentEnd(
|
||||
content::RenderFrame* render_frame) {
|
||||
dispatcher_->RunScriptsAtDocumentEnd(render_frame);
|
||||
}
|
||||
|
||||
void AtomExtensionsRendererClient::RunScriptsAtDocumentIdle(
|
||||
void ElectronExtensionsRendererClient::RunScriptsAtDocumentIdle(
|
||||
content::RenderFrame* render_frame) {
|
||||
dispatcher_->RunScriptsAtDocumentIdle(render_frame);
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_RENDERER_EXTENSIONS_ATOM_EXTENSIONS_RENDERER_CLIENT_H_
|
||||
#define SHELL_RENDERER_EXTENSIONS_ATOM_EXTENSIONS_RENDERER_CLIENT_H_
|
||||
#ifndef SHELL_RENDERER_EXTENSIONS_ELECTRON_EXTENSIONS_RENDERER_CLIENT_H_
|
||||
#define SHELL_RENDERER_EXTENSIONS_ELECTRON_EXTENSIONS_RENDERER_CLIENT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -20,11 +20,11 @@ class Dispatcher;
|
|||
|
||||
namespace electron {
|
||||
|
||||
class AtomExtensionsRendererClient
|
||||
class ElectronExtensionsRendererClient
|
||||
: public extensions::ExtensionsRendererClient {
|
||||
public:
|
||||
AtomExtensionsRendererClient();
|
||||
~AtomExtensionsRendererClient() override;
|
||||
ElectronExtensionsRendererClient();
|
||||
~ElectronExtensionsRendererClient() override;
|
||||
|
||||
// ExtensionsRendererClient implementation.
|
||||
bool IsIncognitoProcess() const override;
|
||||
|
@ -43,9 +43,9 @@ class AtomExtensionsRendererClient
|
|||
private:
|
||||
std::unique_ptr<extensions::Dispatcher> dispatcher_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomExtensionsRendererClient);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionsRendererClient);
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_RENDERER_EXTENSIONS_ATOM_EXTENSIONS_RENDERER_CLIENT_H_
|
||||
#endif // SHELL_RENDERER_EXTENSIONS_ELECTRON_EXTENSIONS_RENDERER_CLIENT_H_
|
|
@ -73,8 +73,8 @@
|
|||
#include "extensions/renderer/guest_view/extensions_guest_view_container.h"
|
||||
#include "extensions/renderer/guest_view/extensions_guest_view_container_dispatcher.h"
|
||||
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h"
|
||||
#include "shell/common/extensions/atom_extensions_client.h"
|
||||
#include "shell/renderer/extensions/atom_extensions_renderer_client.h"
|
||||
#include "shell/common/extensions/electron_extensions_client.h"
|
||||
#include "shell/renderer/extensions/electron_extensions_renderer_client.h"
|
||||
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
|
||||
namespace electron {
|
||||
|
@ -149,7 +149,7 @@ void RendererClientBase::RenderThreadStarted() {
|
|||
extensions_client_.reset(CreateExtensionsClient());
|
||||
extensions::ExtensionsClient::Set(extensions_client_.get());
|
||||
|
||||
extensions_renderer_client_.reset(new AtomExtensionsRendererClient);
|
||||
extensions_renderer_client_.reset(new ElectronExtensionsRendererClient);
|
||||
extensions::ExtensionsRendererClient::Set(extensions_renderer_client_.get());
|
||||
|
||||
thread->AddObserver(extensions_renderer_client_->GetDispatcher());
|
||||
|
@ -386,7 +386,7 @@ v8::Local<v8::Value> RendererClientBase::RunScript(
|
|||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions::ExtensionsClient* RendererClientBase::CreateExtensionsClient() {
|
||||
return new AtomExtensionsClient;
|
||||
return new ElectronExtensionsClient;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class ExtensionsClient;
|
|||
namespace electron {
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
class AtomExtensionsRendererClient;
|
||||
class ElectronExtensionsRendererClient;
|
||||
#endif
|
||||
|
||||
class RendererClientBase : public content::ContentRendererClient
|
||||
|
@ -115,7 +115,7 @@ class RendererClientBase : public content::ContentRendererClient
|
|||
private:
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
||||
std::unique_ptr<AtomExtensionsRendererClient> extensions_renderer_client_;
|
||||
std::unique_ptr<ElectronExtensionsRendererClient> extensions_renderer_client_;
|
||||
#endif
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue