chore: rename atom -> electron (#21986)

This commit is contained in:
Jeremy Apthorp 2020-02-04 12:19:40 -08:00 committed by GitHub
parent f14fc4b041
commit d9321f4df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
287 changed files with 1771 additions and 1708 deletions

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/app/atom_content_client.h"
#include "shell/app/electron_content_client.h"
#include <string>
#include <utility>
@ -18,7 +18,7 @@
#include "electron/buildflags/buildflags.h"
#include "extensions/common/constants.h"
#include "ppapi/buildflags/buildflags.h"
#include "shell/browser/atom_paths.h"
#include "shell/browser/electron_paths.h"
#include "shell/common/options_switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@ -33,10 +33,10 @@
#endif // defined(WIDEVINE_CDM_AVAILABLE)
#if BUILDFLAG(ENABLE_PDF_VIEWER)
#include "pdf/pdf.h" // nogncheck
#include "pdf/pdf_ppapi.h" // nogncheck
#include "shell/common/atom_constants.h" // nogncheck
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
#include "pdf/pdf.h" // nogncheck
#include "pdf/pdf_ppapi.h" // nogncheck
#include "shell/common/electron_constants.h" // nogncheck
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
#if BUILDFLAG(ENABLE_PLUGINS)
#include "content/public/common/pepper_plugin_info.h"
@ -187,33 +187,33 @@ void AppendDelimitedSwitchToVector(const base::StringPiece cmd_switch,
} // namespace
AtomContentClient::AtomContentClient() = default;
ElectronContentClient::ElectronContentClient() = default;
AtomContentClient::~AtomContentClient() = default;
ElectronContentClient::~ElectronContentClient() = default;
base::string16 AtomContentClient::GetLocalizedString(int message_id) {
base::string16 ElectronContentClient::GetLocalizedString(int message_id) {
return l10n_util::GetStringUTF16(message_id);
}
base::StringPiece AtomContentClient::GetDataResource(
base::StringPiece ElectronContentClient::GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) {
return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
resource_id, scale_factor);
}
gfx::Image& AtomContentClient::GetNativeImageNamed(int resource_id) {
gfx::Image& ElectronContentClient::GetNativeImageNamed(int resource_id) {
return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
resource_id);
}
base::RefCountedMemory* AtomContentClient::GetDataResourceBytes(
base::RefCountedMemory* ElectronContentClient::GetDataResourceBytes(
int resource_id) {
return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
resource_id);
}
void AtomContentClient::AddAdditionalSchemes(Schemes* schemes) {
void ElectronContentClient::AddAdditionalSchemes(Schemes* schemes) {
AppendDelimitedSwitchToVector(switches::kServiceWorkerSchemes,
&schemes->service_worker_schemes);
AppendDelimitedSwitchToVector(switches::kStandardSchemes,
@ -229,7 +229,7 @@ void AtomContentClient::AddAdditionalSchemes(Schemes* schemes) {
schemes->standard_schemes.emplace_back(extensions::kExtensionScheme);
}
void AtomContentClient::AddPepperPlugins(
void ElectronContentClient::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@ -240,7 +240,7 @@ void AtomContentClient::AddPepperPlugins(
#endif // BUILDFLAG(ENABLE_PLUGINS)
}
void AtomContentClient::AddContentDecryptionModules(
void ElectronContentClient::AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) {
if (cdms) {

View file

@ -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_APP_ATOM_CONTENT_CLIENT_H_
#define SHELL_APP_ATOM_CONTENT_CLIENT_H_
#ifndef SHELL_APP_ELECTRON_CONTENT_CLIENT_H_
#define SHELL_APP_ELECTRON_CONTENT_CLIENT_H_
#include <set>
#include <string>
@ -14,10 +14,10 @@
namespace electron {
class AtomContentClient : public content::ContentClient {
class ElectronContentClient : public content::ContentClient {
public:
AtomContentClient();
~AtomContentClient() override;
ElectronContentClient();
~ElectronContentClient() override;
protected:
// content::ContentClient:
@ -33,9 +33,9 @@ class AtomContentClient : public content::ContentClient {
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
private:
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);
DISALLOW_COPY_AND_ASSIGN(ElectronContentClient);
};
} // namespace electron
#endif // SHELL_APP_ATOM_CONTENT_CLIENT_H_
#endif // SHELL_APP_ELECTRON_CONTENT_CLIENT_H_

View file

@ -2,22 +2,22 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_APP_ATOM_LIBRARY_MAIN_H_
#define SHELL_APP_ATOM_LIBRARY_MAIN_H_
#ifndef SHELL_APP_ELECTRON_LIBRARY_MAIN_H_
#define SHELL_APP_ELECTRON_LIBRARY_MAIN_H_
#include "build/build_config.h"
#include "electron/buildflags/buildflags.h"
#if defined(OS_MACOSX)
extern "C" {
__attribute__((visibility("default"))) int AtomMain(int argc, char* argv[]);
__attribute__((visibility("default"))) int ElectronMain(int argc, char* argv[]);
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
__attribute__((visibility("default"))) int AtomInitializeICUandStartNode(
__attribute__((visibility("default"))) int ElectronInitializeICUandStartNode(
int argc,
char* argv[]);
#endif
}
#endif // OS_MACOSX
#endif // SHELL_APP_ATOM_LIBRARY_MAIN_H_
#endif // SHELL_APP_ELECTRON_LIBRARY_MAIN_H_

View file

@ -2,29 +2,29 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/app/atom_library_main.h"
#include "shell/app/electron_library_main.h"
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "content/public/app/content_main.h"
#include "shell/app/atom_main_delegate.h"
#include "shell/app/electron_main_delegate.h"
#include "shell/app/node_main.h"
#include "shell/common/atom_command_line.h"
#include "shell/common/electron_command_line.h"
#include "shell/common/mac/main_application_bundle.h"
int AtomMain(int argc, char* argv[]) {
electron::AtomMainDelegate delegate;
int ElectronMain(int argc, char* argv[]) {
electron::ElectronMainDelegate delegate;
content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = const_cast<const char**>(argv);
electron::AtomCommandLine::Init(argc, argv);
electron::ElectronCommandLine::Init(argc, argv);
return content::ContentMain(params);
}
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
int AtomInitializeICUandStartNode(int argc, char* argv[]) {
int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
base::AtExitManager atexit_manager;
base::mac::ScopedNSAutoreleasePool pool;
base::mac::SetOverrideFrameworkBundlePath(

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/app/atom_main.h"
#include "shell/app/electron_main.h"
#include <algorithm>
#include <cstdlib>
@ -23,27 +23,27 @@
#include "base/win/windows_version.h"
#include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
#include "shell/app/atom_main_delegate.h"
#include "shell/app/command_line_args.h"
#include "shell/app/electron_main_delegate.h"
#include "shell/common/crash_reporter/win/crash_service_main.h"
#elif defined(OS_LINUX) // defined(OS_WIN)
#include <unistd.h>
#include <cstdio>
#include "content/public/app/content_main.h"
#include "shell/app/atom_main_delegate.h" // NOLINT
#else // defined(OS_LINUX)
#include "shell/app/electron_main_delegate.h" // NOLINT
#else // defined(OS_LINUX)
#include <mach-o/dyld.h>
#include <unistd.h>
#include <cstdio>
#include "shell/app/atom_library_main.h"
#include "shell/app/electron_library_main.h"
#endif // defined(OS_MACOSX)
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
#include "electron/buildflags/buildflags.h"
#include "shell/app/node_main.h"
#include "shell/common/atom_command_line.h"
#include "shell/common/atom_constants.h"
#include "shell/common/electron_command_line.h"
#include "shell/common/electron_constants.h"
#if defined(HELPER_EXECUTABLE) && !defined(MAS_BUILD)
#include "sandbox/mac/seatbelt_exec.h" // nogncheck
@ -149,12 +149,12 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
electron::AtomMainDelegate delegate;
electron::ElectronMainDelegate delegate;
content::ContentMainParams params(&delegate);
params.instance = instance;
params.sandbox_info = &sandbox_info;
electron::AtomCommandLine::Init(arguments.argc, arguments.argv);
electron::ElectronCommandLine::Init(arguments.argc, arguments.argv);
return content::ContentMain(params);
}
@ -171,11 +171,11 @@ int main(int argc, char* argv[]) {
}
#endif
electron::AtomMainDelegate delegate;
electron::ElectronMainDelegate delegate;
content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = const_cast<const char**>(argv);
electron::AtomCommandLine::Init(argc, argv);
electron::ElectronCommandLine::Init(argc, argv);
return content::ContentMain(params);
}
@ -186,7 +186,7 @@ int main(int argc, char* argv[]) {
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (IsEnvSet(electron::kRunAsNode)) {
return AtomInitializeICUandStartNode(argc, argv);
return ElectronInitializeICUandStartNode(argc, argv);
}
#endif
@ -219,7 +219,7 @@ int main(int argc, char* argv[]) {
}
#endif // defined(HELPER_EXECUTABLE) && !defined(MAS_BUILD)
return AtomMain(argc, argv);
return ElectronMain(argc, argv);
}
#endif // defined(OS_MACOSX)

View file

@ -2,9 +2,9 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_APP_ATOM_MAIN_H_
#define SHELL_APP_ATOM_MAIN_H_
#ifndef SHELL_APP_ELECTRON_MAIN_H_
#define SHELL_APP_ELECTRON_MAIN_H_
#include "content/public/app/content_main.h"
#endif // SHELL_APP_ATOM_MAIN_H_
#endif // SHELL_APP_ELECTRON_MAIN_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/app/atom_main_delegate.h"
#include "shell/app/electron_main_delegate.h"
#include <iostream>
#include <memory>
@ -27,21 +27,21 @@
#include "services/service_manager/embedder/switches.h"
#include "services/service_manager/sandbox/switches.h"
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
#include "shell/app/atom_content_client.h"
#include "shell/browser/atom_browser_client.h"
#include "shell/browser/atom_gpu_client.h"
#include "shell/app/electron_content_client.h"
#include "shell/browser/electron_browser_client.h"
#include "shell/browser/electron_gpu_client.h"
#include "shell/browser/feature_list.h"
#include "shell/browser/relauncher.h"
#include "shell/common/options_switches.h"
#include "shell/renderer/atom_renderer_client.h"
#include "shell/renderer/atom_sandboxed_renderer_client.h"
#include "shell/utility/atom_content_utility_client.h"
#include "shell/renderer/electron_renderer_client.h"
#include "shell/renderer/electron_sandboxed_renderer_client.h"
#include "shell/utility/electron_content_utility_client.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
#if defined(OS_MACOSX)
#include "shell/app/atom_main_delegate_mac.h"
#include "shell/app/electron_main_delegate_mac.h"
#endif
#if defined(OS_WIN)
@ -129,16 +129,16 @@ void LoadResourceBundle(const std::string& locale) {
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
}
AtomMainDelegate::AtomMainDelegate() = default;
ElectronMainDelegate::ElectronMainDelegate() = default;
AtomMainDelegate::~AtomMainDelegate() = default;
ElectronMainDelegate::~ElectronMainDelegate() = default;
const char* const AtomMainDelegate::kNonWildcardDomainNonPortSchemes[] = {
const char* const ElectronMainDelegate::kNonWildcardDomainNonPortSchemes[] = {
extensions::kExtensionScheme};
const size_t AtomMainDelegate::kNonWildcardDomainNonPortSchemesSize =
const size_t ElectronMainDelegate::kNonWildcardDomainNonPortSchemesSize =
base::size(kNonWildcardDomainNonPortSchemes);
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
bool ElectronMainDelegate::BasicStartupComplete(int* exit_code) {
auto* command_line = base::CommandLine::ForCurrentProcess();
logging::LoggingSettings settings;
@ -224,13 +224,13 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
<< " is not supported. See https://crbug.com/638180.";
#endif
content_client_ = std::make_unique<AtomContentClient>();
content_client_ = std::make_unique<ElectronContentClient>();
SetContentClient(content_client_.get());
return false;
}
void AtomMainDelegate::PostEarlyInitialization(bool is_running_tests) {
void ElectronMainDelegate::PostEarlyInitialization(bool is_running_tests) {
std::string custom_locale;
ui::ResourceBundle::InitSharedInstanceWithLocale(
custom_locale, nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
@ -256,11 +256,11 @@ void AtomMainDelegate::PostEarlyInitialization(bool is_running_tests) {
LoadResourceBundle(custom_locale);
AtomBrowserClient::SetApplicationLocale(
ElectronBrowserClient::SetApplicationLocale(
l10n_util::GetApplicationLocale(custom_locale));
}
void AtomMainDelegate::PreSandboxStartup() {
void ElectronMainDelegate::PreSandboxStartup() {
auto* command_line = base::CommandLine::ForCurrentProcess();
std::string process_type =
@ -287,7 +287,7 @@ void AtomMainDelegate::PreSandboxStartup() {
#endif
}
void AtomMainDelegate::PreCreateMainMessageLoop() {
void ElectronMainDelegate::PreCreateMainMessageLoop() {
// This is initialized early because the service manager reads some feature
// flags and we need to make sure the feature list is initialized before the
// service manager reads the features.
@ -297,35 +297,37 @@ void AtomMainDelegate::PreCreateMainMessageLoop() {
#endif
}
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
browser_client_ = std::make_unique<AtomBrowserClient>();
content::ContentBrowserClient*
ElectronMainDelegate::CreateContentBrowserClient() {
browser_client_ = std::make_unique<ElectronBrowserClient>();
return browser_client_.get();
}
content::ContentGpuClient* AtomMainDelegate::CreateContentGpuClient() {
gpu_client_ = std::make_unique<AtomGpuClient>();
content::ContentGpuClient* ElectronMainDelegate::CreateContentGpuClient() {
gpu_client_ = std::make_unique<ElectronGpuClient>();
return gpu_client_.get();
}
content::ContentRendererClient*
AtomMainDelegate::CreateContentRendererClient() {
ElectronMainDelegate::CreateContentRendererClient() {
auto* command_line = base::CommandLine::ForCurrentProcess();
if (IsSandboxEnabled(command_line)) {
renderer_client_ = std::make_unique<AtomSandboxedRendererClient>();
renderer_client_ = std::make_unique<ElectronSandboxedRendererClient>();
} else {
renderer_client_ = std::make_unique<AtomRendererClient>();
renderer_client_ = std::make_unique<ElectronRendererClient>();
}
return renderer_client_.get();
}
content::ContentUtilityClient* AtomMainDelegate::CreateContentUtilityClient() {
utility_client_ = std::make_unique<AtomContentUtilityClient>();
content::ContentUtilityClient*
ElectronMainDelegate::CreateContentUtilityClient() {
utility_client_ = std::make_unique<ElectronContentUtilityClient>();
return utility_client_.get();
}
int AtomMainDelegate::RunProcess(
int ElectronMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
if (process_type == kRelauncherProcess)
@ -335,13 +337,13 @@ int AtomMainDelegate::RunProcess(
}
#if defined(OS_MACOSX)
bool AtomMainDelegate::DelaySandboxInitialization(
bool ElectronMainDelegate::DelaySandboxInitialization(
const std::string& process_type) {
return process_type == kRelauncherProcess;
}
#endif
bool AtomMainDelegate::ShouldCreateFeatureList() {
bool ElectronMainDelegate::ShouldCreateFeatureList() {
return false;
}

View file

@ -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_APP_ATOM_MAIN_DELEGATE_H_
#define SHELL_APP_ATOM_MAIN_DELEGATE_H_
#ifndef SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#define SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#include <memory>
#include <string>
@ -19,12 +19,12 @@ namespace electron {
void LoadResourceBundle(const std::string& locale);
class AtomMainDelegate : public content::ContentMainDelegate {
class ElectronMainDelegate : public content::ContentMainDelegate {
public:
static const char* const kNonWildcardDomainNonPortSchemes[];
static const size_t kNonWildcardDomainNonPortSchemesSize;
AtomMainDelegate();
~AtomMainDelegate() override;
ElectronMainDelegate();
~ElectronMainDelegate() override;
protected:
// content::ContentMainDelegate:
@ -58,9 +58,9 @@ class AtomMainDelegate : public content::ContentMainDelegate {
std::unique_ptr<content::ContentUtilityClient> utility_client_;
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate);
DISALLOW_COPY_AND_ASSIGN(ElectronMainDelegate);
};
} // namespace electron
#endif // SHELL_APP_ATOM_MAIN_DELEGATE_H_
#endif // SHELL_APP_ELECTRON_MAIN_DELEGATE_H_

View file

@ -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_APP_ATOM_MAIN_DELEGATE_MAC_H_
#define SHELL_APP_ATOM_MAIN_DELEGATE_MAC_H_
#ifndef SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_
#define SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_
namespace electron {
@ -12,4 +12,4 @@ void RegisterAtomCrApp();
} // namespace electron
#endif // SHELL_APP_ATOM_MAIN_DELEGATE_MAC_H_
#endif // SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/app/atom_main_delegate.h"
#include "shell/app/electron_main_delegate.h"
#include <string>
@ -15,7 +15,7 @@
#include "base/strings/sys_string_conversions.h"
#include "content/common/mac_helpers.h"
#include "content/public/common/content_paths.h"
#include "shell/browser/mac/atom_application.h"
#include "shell/browser/mac/electron_application.h"
#include "shell/common/application_info.h"
#include "shell/common/mac/main_application_bundle.h"
@ -53,12 +53,12 @@ base::FilePath GetHelperAppPath(const base::FilePath& frameworks_path,
} // namespace
void AtomMainDelegate::OverrideFrameworkBundlePath() {
void ElectronMainDelegate::OverrideFrameworkBundlePath() {
base::mac::SetOverrideFrameworkBundlePath(
GetFrameworksPath().Append(ELECTRON_PRODUCT_NAME " Framework.framework"));
}
void AtomMainDelegate::OverrideChildProcessPath() {
void ElectronMainDelegate::OverrideChildProcessPath() {
base::FilePath frameworks_path = GetFrameworksPath();
base::FilePath helper_path =
GetHelperAppPath(frameworks_path, ELECTRON_PRODUCT_NAME);
@ -69,7 +69,7 @@ void AtomMainDelegate::OverrideChildProcessPath() {
base::PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
}
void AtomMainDelegate::SetUpBundleOverrides() {
void ElectronMainDelegate::SetUpBundleOverrides() {
base::mac::ScopedNSAutoreleasePool pool;
NSBundle* bundle = MainApplicationBundle();
std::string base_bundle_id =
@ -82,7 +82,7 @@ void AtomMainDelegate::SetUpBundleOverrides() {
void RegisterAtomCrApp() {
// Force the NSApplication subclass to be used.
[AtomApplication sharedApplication];
[ElectronApplication sharedApplication];
}
} // namespace electron