refactor: eliminate brightray (#15240)

This commit is contained in:
Milan Burda 2018-10-24 12:49:10 +02:00 committed by Alexey Kuzmin
parent 1d8ab03146
commit 8ba271efba
47 changed files with 178 additions and 234 deletions

7
.gitignore vendored
View file

@ -16,13 +16,6 @@
*.vcxproj.user
*.xcodeproj
/.idea/
/brightray/brightray.opensdf
/brightray/brightray.sdf
/brightray/brightray.sln
/brightray/brightray.suo
/brightray/brightray.v12.suo
/brightray/brightray.vcxproj*
/brightray/brightray.xcodeproj/
/dist/
/external_binaries/
/out/

View file

@ -4,6 +4,7 @@ import("buildflags/buildflags.gni")
import("electron_paks.gni")
import("filenames.gni")
import("//build/config/locales.gni")
import("//build/config/ui.gni")
import("//build/config/win/manifest.gni")
import("//pdf/features.gni")
import("//services/service_manager/public/service_manifest.gni")
@ -201,11 +202,11 @@ static_library("electron_lib") {
deps = [
":atom_js2c",
"brightray",
"buildflags",
"chromium_src:chrome",
"native_mate",
"//base",
"//base:base_static",
"//base:i18n",
"//chrome/common",
"//components/certificate_transparency",
@ -214,11 +215,15 @@ static_library("electron_lib") {
"//components/prefs",
"//components/viz/service",
"//content/public/app:both",
"//content/public/browser",
"//content/public/child",
"//content/public/common:service_names",
"//content/shell:copy_shell_resources",
"//gin",
"//media/mojo/interfaces",
"//net:extras",
"//net:net_resources",
"//net:net_with_v8",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",

View file

@ -7,11 +7,11 @@
#include "atom/app/atom_main_delegate.h"
#include "atom/app/node_main.h"
#include "atom/common/atom_command_line.h"
#include "atom/common/mac/main_application_bundle.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 "brightray/common/mac/main_application_bundle.h"
#include "content/public/app/content_main.h"
int AtomMain(int argc, char* argv[]) {
@ -28,7 +28,7 @@ int AtomInitializeICUandStartNode(int argc, char* argv[]) {
base::AtExitManager atexit_manager;
base::mac::ScopedNSAutoreleasePool pool;
base::mac::SetOverrideFrameworkBundlePath(
brightray::MainApplicationBundlePath()
atom::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks")
.Append(ATOM_PRODUCT_NAME " Framework.framework"));

View file

@ -5,6 +5,8 @@
#include "atom/app/atom_main_delegate.h"
#include "atom/browser/mac/atom_application.h"
#include "atom/common/application_info.h"
#include "atom/common/mac/main_application_bundle.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/mac/bundle_locations.h"
@ -12,8 +14,6 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/path_service.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/common/application_info.h"
#include "brightray/common/mac/main_application_bundle.h"
#include "content/public/common/content_paths.h"
namespace atom {
@ -21,9 +21,7 @@ namespace atom {
namespace {
base::FilePath GetFrameworksPath() {
return brightray::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks");
return MainApplicationBundlePath().Append("Contents").Append("Frameworks");
}
base::FilePath GetHelperAppPath(const base::FilePath& frameworks_path,
@ -46,8 +44,7 @@ void AtomMainDelegate::OverrideChildProcessPath() {
base::FilePath helper_path =
GetHelperAppPath(frameworks_path, ATOM_PRODUCT_NAME);
if (!base::PathExists(helper_path))
helper_path =
GetHelperAppPath(frameworks_path, brightray::GetApplicationName());
helper_path = GetHelperAppPath(frameworks_path, GetApplicationName());
if (!base::PathExists(helper_path))
LOG(FATAL) << "Unable to find helper app";
base::PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
@ -55,7 +52,7 @@ void AtomMainDelegate::OverrideChildProcessPath() {
void AtomMainDelegate::SetUpBundleOverrides() {
base::mac::ScopedNSAutoreleasePool pool;
NSBundle* bundle = brightray::MainApplicationBundle();
NSBundle* bundle = MainApplicationBundle();
std::string base_bundle_id =
base::SysNSStringToUTF8([bundle bundleIdentifier]);
NSString* team_id = [bundle objectForInfoDictionaryKey:@"ElectronTeamID"];

View file

@ -13,6 +13,7 @@
#include "atom/browser/api/gpuinfo_manager.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_paths.h"
#include "atom/browser/login_handler.h"
#include "atom/browser/relauncher.h"
#include "atom/common/atom_command_line.h"
@ -31,7 +32,6 @@
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/sys_info.h"
#include "brightray/browser/brightray_paths.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/common/chrome_paths.h"
@ -395,15 +395,15 @@ IconLoader::IconSize GetIconSizeByString(const std::string& size) {
// Return the path constant from string.
int GetPathConstant(const std::string& name) {
if (name == "appData")
return brightray::DIR_APP_DATA;
return DIR_APP_DATA;
else if (name == "userData")
return brightray::DIR_USER_DATA;
return DIR_USER_DATA;
else if (name == "cache")
return brightray::DIR_CACHE;
return DIR_CACHE;
else if (name == "userCache")
return brightray::DIR_USER_CACHE;
return DIR_USER_CACHE;
else if (name == "logs")
return brightray::DIR_APP_LOGS;
return DIR_APP_LOGS;
else if (name == "home")
return base::DIR_HOME;
else if (name == "temp")
@ -898,7 +898,7 @@ bool App::RequestSingleInstanceLock() {
return true;
base::FilePath user_dir;
base::PathService::Get(brightray::DIR_USER_DATA, &user_dir);
base::PathService::Get(DIR_USER_DATA, &user_dir);
auto cb = base::Bind(&App::OnSecondInstance, base::Unretained(this));

View file

@ -9,6 +9,7 @@
#include "atom/browser/atom_blob_reader.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_download_manager_delegate.h"
#include "atom/browser/atom_paths.h"
#include "atom/browser/atom_permission_manager.h"
#include "atom/browser/browser.h"
#include "atom/browser/cookie_change_notifier.h"
@ -18,6 +19,7 @@
#include "atom/browser/ui/inspectable_web_contents_impl.h"
#include "atom/browser/web_view_manager.h"
#include "atom/browser/zoom_level_delegate.h"
#include "atom/common/application_info.h"
#include "atom/common/atom_version.h"
#include "atom/common/chrome_version.h"
#include "atom/common/options_switches.h"
@ -28,8 +30,6 @@
#include "base/strings/stringprintf.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/threading/thread_restrictions.h"
#include "brightray/browser/brightray_paths.h"
#include "brightray/common/application_info.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
@ -100,11 +100,10 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
base::StringToInt(command_line->GetSwitchValueASCII(switches::kDiskCacheSize),
&max_cache_size_);
if (!base::PathService::Get(brightray::DIR_USER_DATA, &path_)) {
base::PathService::Get(brightray::DIR_APP_DATA, &path_);
path_ = path_.Append(
base::FilePath::FromUTF8Unsafe(brightray::GetApplicationName()));
base::PathService::Override(brightray::DIR_USER_DATA, path_);
if (!base::PathService::Get(DIR_USER_DATA, &path_)) {
base::PathService::Get(DIR_APP_DATA, &path_);
path_ = path_.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
base::PathService::Override(DIR_USER_DATA, path_);
}
if (!in_memory && !partition.empty())

View file

@ -15,6 +15,7 @@
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_paths.h"
#include "atom/browser/atom_web_ui_controller_factory.h"
#include "atom/browser/browser.h"
#include "atom/browser/io_thread.h"
@ -23,6 +24,7 @@
#include "atom/browser/node_debugger.h"
#include "atom/browser/ui/devtools_manager_delegate.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/application_info.h"
#include "atom/common/asar/asar_util.h"
#include "atom/common/node_bindings.h"
#include "base/base_switches.h"
@ -32,8 +34,6 @@
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/brightray_paths.h"
#include "brightray/common/application_info.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/browser/net/chrome_net_log_helper.h"
@ -139,12 +139,12 @@ const int kWaitForUIThreadSeconds = 10;
void OverrideLinuxAppDataPath() {
base::FilePath path;
if (base::PathService::Get(brightray::DIR_APP_DATA, &path))
if (base::PathService::Get(DIR_APP_DATA, &path))
return;
std::unique_ptr<base::Environment> env(base::Environment::Create());
path = base::nix::GetXDGDirectory(env.get(), base::nix::kXdgConfigHomeEnvVar,
base::nix::kDotConfigDir);
base::PathService::Override(brightray::DIR_APP_DATA, path);
base::PathService::Override(DIR_APP_DATA, path);
}
int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
@ -224,11 +224,10 @@ void AtomBrowserMainParts::InitializeFeatureList() {
#if !defined(OS_MACOSX)
void AtomBrowserMainParts::OverrideAppLogsPath() {
base::FilePath path;
if (base::PathService::Get(brightray::DIR_APP_DATA, &path)) {
path = path.Append(
base::FilePath::FromUTF8Unsafe(brightray::GetApplicationName()));
if (base::PathService::Get(DIR_APP_DATA, &path)) {
path = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
path = path.Append(base::FilePath::FromUTF8Unsafe("logs"));
base::PathService::Override(brightray::DIR_APP_LOGS, path);
base::PathService::Override(DIR_APP_LOGS, path);
}
}
#endif

View file

@ -4,11 +4,11 @@
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_paths.h"
#include "atom/browser/mac/atom_application_delegate.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "brightray/browser/brightray_paths.h"
#include "ui/base/l10n/l10n_util_mac.h"
namespace atom {
@ -41,7 +41,7 @@ void AtomBrowserMainParts::OverrideAppLogsPath() {
NSString* libraryPath =
[NSHomeDirectory() stringByAppendingPathComponent:logsPath];
base::PathService::Override(brightray::DIR_APP_LOGS,
base::PathService::Override(DIR_APP_LOGS,
base::FilePath([libraryPath UTF8String]));
}

View file

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BRIGHTRAY_BROWSER_BRIGHTRAY_PATHS_H_
#define BRIGHTRAY_BROWSER_BRIGHTRAY_PATHS_H_
#ifndef ATOM_BROWSER_ATOM_PATHS_H_
#define ATOM_BROWSER_ATOM_PATHS_H_
#include "base/base_paths.h"
#if defined(OS_WIN)
#include "base/base_paths_win.h"
@ -15,7 +17,7 @@
#include "base/base_paths_posix.h"
#endif
namespace brightray {
namespace atom {
enum {
PATH_START = 11000,
@ -39,6 +41,6 @@ enum {
PATH_END
};
} // namespace brightray
} // namespace atom
#endif // BRIGHTRAY_BROWSER_BRIGHTRAY_PATHS_H_
#endif // ATOM_BROWSER_ATOM_PATHS_H_

View file

@ -9,10 +9,12 @@
#include <utility>
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_paths.h"
#include "atom/browser/browser_observer.h"
#include "atom/browser/login_handler.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "atom/common/application_info.h"
#include "base/files/file_util.h"
#include "base/message_loop/message_loop.h"
#include "base/no_destructor.h"
@ -20,8 +22,6 @@
#include "base/run_loop.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/brightray_paths.h"
#include "brightray/common/application_info.h"
namespace atom {
@ -104,25 +104,25 @@ void Browser::Shutdown() {
}
std::string Browser::GetVersion() const {
std::string ret = brightray::GetOverriddenApplicationVersion();
std::string ret = GetOverriddenApplicationVersion();
if (ret.empty())
ret = GetExecutableFileVersion();
return ret;
}
void Browser::SetVersion(const std::string& version) {
brightray::OverrideApplicationVersion(version);
OverrideApplicationVersion(version);
}
std::string Browser::GetName() const {
std::string ret = brightray::GetOverriddenApplicationName();
std::string ret = GetOverriddenApplicationName();
if (ret.empty())
ret = GetExecutableFileProductName();
return ret;
}
void Browser::SetName(const std::string& name) {
brightray::OverrideApplicationName(name);
OverrideApplicationName(name);
}
int Browser::GetBadgeCount() {
@ -156,7 +156,7 @@ void Browser::DidFinishLaunching(const base::DictionaryValue& launch_info) {
// Make sure the userData directory is created.
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::FilePath user_data;
if (base::PathService::Get(brightray::DIR_USER_DATA, &user_data))
if (base::PathService::Get(DIR_USER_DATA, &user_data))
base::CreateDirectoryAndGetError(user_data, nullptr);
is_ready_ = true;

View file

@ -9,11 +9,11 @@
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "atom/common/application_info.h"
#include "atom/common/atom_version.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/process/launch.h"
#include "brightray/common/application_info.h"
#if defined(USE_X11)
#include "chrome/browser/ui/libgtkui/gtk_util.h"
@ -131,11 +131,11 @@ Browser::LoginItemSettings Browser::GetLoginItemSettings(
}
std::string Browser::GetExecutableFileVersion() const {
return brightray::GetApplicationVersion();
return GetApplicationVersion();
}
std::string Browser::GetExecutableFileProductName() const {
return brightray::GetApplicationName();
return GetApplicationName();
}
bool Browser::IsUnityRunning() {

View file

@ -9,13 +9,13 @@
#include "atom/browser/mac/dict_util.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "atom/common/application_info.h"
#include "atom/common/platform_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/common/application_info.h"
#include "net/base/mac/url_conversions.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
@ -289,11 +289,11 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) {
}
std::string Browser::GetExecutableFileVersion() const {
return brightray::GetApplicationVersion();
return GetApplicationVersion();
}
std::string Browser::GetExecutableFileProductName() const {
return brightray::GetApplicationName();
return GetApplicationName();
}
int Browser::DockBounce(BounceType type) {

View file

@ -11,6 +11,7 @@
#include <shobjidl.h>
#include "atom/browser/ui/win/jump_list.h"
#include "atom/common/application_info.h"
#include "atom/common/atom_version.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "base/base_paths.h"
@ -24,7 +25,6 @@
#include "base/win/registry.h"
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "brightray/common/application_info.h"
namespace atom {
@ -120,7 +120,7 @@ void Browser::ClearRecentDocuments() {
}
void Browser::SetAppUserModelID(const base::string16& name) {
brightray::SetAppUserModelID(name);
atom::SetAppUserModelID(name);
}
bool Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
@ -324,7 +324,7 @@ Browser::LoginItemSettings Browser::GetLoginItemSettings(
}
PCWSTR Browser::GetAppUserModelID() {
return brightray::GetRawAppUserModelID();
return GetRawAppUserModelID();
}
std::string Browser::GetExecutableFileVersion() const {
@ -340,7 +340,7 @@ std::string Browser::GetExecutableFileVersion() const {
}
std::string Browser::GetExecutableFileProductName() const {
return brightray::GetApplicationName();
return GetApplicationName();
}
} // namespace atom

View file

@ -15,7 +15,7 @@ namespace atom {
namespace {
const char kMediaDeviceIdSalt[] = "brightray.media.device_id_salt";
const char kMediaDeviceIdSalt[] = "electron.media.device_id_salt";
} // namespace

View file

@ -9,12 +9,12 @@
#include <vector>
#include "atom/browser/notifications/notification_delegate.h"
#include "atom/common/application_info.h"
#include "atom/common/platform_util.h"
#include "base/files/file_enumerator.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/common/application_info.h"
#include "chrome/browser/ui/libgtkui/gtk_util.h"
#include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
#include "third_party/skia/include/core/SkBitmap.h"
@ -66,7 +66,7 @@ bool LibnotifyNotification::Initialize() {
return false;
}
if (!libnotify_loader_.notify_is_initted() &&
!libnotify_loader_.notify_init(brightray::GetApplicationName().c_str())) {
!libnotify_loader_.notify_init(GetApplicationName().c_str())) {
LOG(WARNING) << "Unable to initialize libnotify; notifications disabled";
return false;
}

View file

@ -13,10 +13,10 @@
#include "atom/browser/notifications/notification_delegate.h"
#include "atom/browser/notifications/win/notification_presenter_win.h"
#include "atom/browser/win/scoped_hstring.h"
#include "atom/common/application_info.h"
#include "base/environment.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/win/scoped_hstring.h"
#include "brightray/common/application_info.h"
#include "content/public/browser/browser_thread.h"
using ABI::Windows::Data::Xml::Dom::IXmlAttribute;
@ -58,13 +58,13 @@ bool WindowsToastNotification::Initialize() {
&toast_manager_)))
return false;
if (brightray::IsRunningInDesktopBridge()) {
if (IsRunningInDesktopBridge()) {
// Ironically, the Desktop Bridge / UWP environment
// requires us to not give Windows an appUserModelId.
return SUCCEEDED(toast_manager_->CreateToastNotifier(&toast_notifier_));
} else {
ScopedHString app_id;
if (!brightray::GetAppUserModelID(&app_id))
if (!GetAppUserModelID(&app_id))
return false;
return SUCCEEDED(

View file

@ -23,10 +23,10 @@ using Microsoft::WRL::Make;
using Microsoft::WRL::RuntimeClass;
using Microsoft::WRL::RuntimeClassFlags;
class ScopedHString;
namespace atom {
class ScopedHString;
using DesktopToastActivatedEventHandler =
ABI::Windows::Foundation::ITypedEventHandler<
ABI::Windows::UI::Notifications::ToastNotification*,

View file

@ -150,7 +150,7 @@
backing:NSBackingStoreBuffered
defer:YES]);
[devtools_window_ setDelegate:self];
[devtools_window_ setFrameAutosaveName:@"brightray.devtools"];
[devtools_window_ setFrameAutosaveName:@"electron.devtools"];
[devtools_window_ setTitle:@"Developer Tools"];
[devtools_window_ setReleasedWhenClosed:NO];
[devtools_window_ setAutorecalculatesContentBorderThickness:NO

View file

@ -59,9 +59,9 @@ const char kChromeUIDevToolsRemoteFrontendBase[] =
"https://chrome-devtools-frontend.appspot.com/";
const char kChromeUIDevToolsRemoteFrontendPath[] = "serve_file";
const char kDevToolsBoundsPref[] = "brightray.devtools.bounds";
const char kDevToolsZoomPref[] = "brightray.devtools.zoom";
const char kDevToolsPreferences[] = "brightray.devtools.preferences";
const char kDevToolsBoundsPref[] = "electron.devtools.bounds";
const char kDevToolsZoomPref[] = "electron.devtools.zoom";
const char kDevToolsPreferences[] = "electron.devtools.preferences";
const char kFrontendHostId[] = "id";
const char kFrontendHostMethod[] = "method";

View file

@ -5,9 +5,9 @@
#include "atom/browser/ui/tray_icon_gtk.h"
#include "atom/browser/browser.h"
#include "atom/common/application_info.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/common/application_info.h"
#include "chrome/browser/ui/libgtkui/app_indicator_icon.h"
#include "chrome/browser/ui/libgtkui/gtk_status_icon.h"
#include "ui/gfx/image/image.h"
@ -31,7 +31,7 @@ void TrayIconGtk::SetImage(const gfx::Image& image) {
return;
}
const auto toolTip = base::UTF8ToUTF16(brightray::GetApplicationName());
const auto toolTip = base::UTF8ToUTF16(GetApplicationName());
if (libgtkui::AppIndicatorIcon::CouldOpen()) {
++indicators_count;

View file

@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#include "brightray/browser/win/scoped_hstring.h"
#include "atom/browser/win/scoped_hstring.h"
#include <winstring.h>
namespace atom {
ScopedHString::ScopedHString(const wchar_t* source) : str_(nullptr) {
Reset(source);
}
@ -36,3 +38,5 @@ void ScopedHString::Reset(const std::wstring& source) {
Reset();
WindowsCreateString(source.c_str(), source.length(), &str_);
}
} // namespace atom

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-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_
#define BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_
#ifndef ATOM_BROWSER_WIN_SCOPED_HSTRING_H_
#define ATOM_BROWSER_WIN_SCOPED_HSTRING_H_
#include <hstring.h>
#include <windows.h>
@ -12,6 +12,8 @@
#include "base/macros.h"
namespace atom {
class ScopedHString {
public:
// Copy from |source|.
@ -38,4 +40,6 @@ class ScopedHString {
DISALLOW_COPY_AND_ASSIGN(ScopedHString);
};
#endif // BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_
} // namespace atom
#endif // ATOM_BROWSER_WIN_SCOPED_HSTRING_H_

View file

@ -9,6 +9,7 @@
#include <string>
#include "atom/common/api/locker.h"
#include "atom/common/application_info.h"
#include "atom/common/atom_version.h"
#include "atom/common/chrome_version.h"
#include "atom/common/heap_snapshot.h"
@ -20,7 +21,6 @@
#include "base/process/process_metrics_iocounters.h"
#include "base/sys_info.h"
#include "base/threading/thread_restrictions.h"
#include "brightray/common/application_info.h"
#include "native_mate/dictionary.h"
namespace atom {
@ -76,7 +76,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process) {
#endif
#if defined(OS_WIN)
if (brightray::IsRunningInDesktopBridge())
if (IsRunningInDesktopBridge())
dict.Set("windowsStore", true);
#endif

View file

@ -1,8 +1,12 @@
#include "brightray/common/application_info.h"
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/common/application_info.h"
#include "base/no_destructor.h"
namespace brightray {
namespace atom {
namespace {
@ -27,4 +31,4 @@ std::string GetOverriddenApplicationVersion() {
return *g_overridden_application_version;
}
} // namespace brightray
} // namespace atom

View file

@ -1,14 +1,18 @@
#ifndef BRIGHTRAY_COMMON_APPLICATION_INFO_H_
#define BRIGHTRAY_COMMON_APPLICATION_INFO_H_
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_APPLICATION_INFO_H_
#define ATOM_COMMON_APPLICATION_INFO_H_
#if defined(OS_WIN)
#include "atom/browser/win/scoped_hstring.h"
#include "base/strings/string16.h"
#include "brightray/browser/win/scoped_hstring.h"
#endif
#include <string>
namespace brightray {
namespace atom {
void OverrideApplicationName(const std::string& name);
std::string GetOverriddenApplicationName();
@ -26,6 +30,6 @@ void SetAppUserModelID(const base::string16& name);
bool IsRunningInDesktopBridge();
#endif
} // namespace brightray
} // namespace atom
#endif // BRIGHTRAY_COMMON_APPLICATION_INFO_H_
#endif // ATOM_COMMON_APPLICATION_INFO_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 "brightray/common/application_info.h"
#include "atom/common/application_info.h"
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
@ -30,7 +30,7 @@ GDesktopAppInfo* get_desktop_app_info() {
} // namespace
namespace brightray {
namespace atom {
std::string GetApplicationName() {
// attempt #1: the string set in app.setName()
@ -76,4 +76,4 @@ std::string GetApplicationVersion() {
return ret;
}
} // namespace brightray
} // namespace atom

View file

@ -1,10 +1,14 @@
#import "brightray/common/application_info.h"
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import "atom/common/application_info.h"
#import "atom/common/mac/main_application_bundle.h"
#import "base/mac/foundation_util.h"
#import "base/strings/sys_string_conversions.h"
#import "brightray/common/mac/main_application_bundle.h"
namespace brightray {
namespace atom {
namespace {
@ -27,4 +31,4 @@ std::string GetApplicationVersion() {
return ApplicationInfoDictionaryValue(@"CFBundleShortVersionString");
}
} // namespace brightray
} // namespace atom

View file

@ -1,4 +1,8 @@
#include "brightray/common/application_info.h"
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/common/application_info.h"
#include <windows.h> // windows.h must be included first
@ -8,13 +12,13 @@
#include <memory>
#include "atom/browser/win/scoped_hstring.h"
#include "base/file_version_info.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/win/scoped_hstring.h"
namespace brightray {
namespace atom {
namespace {
@ -106,4 +110,4 @@ bool IsRunningInDesktopBridge() {
return result;
}
} // namespace brightray
} // namespace atom

View file

@ -0,0 +1,26 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Adam Roben <adam@roben.org>. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#ifndef ATOM_COMMON_MAC_MAIN_APPLICATION_BUNDLE_H_
#define ATOM_COMMON_MAC_MAIN_APPLICATION_BUNDLE_H_
@class NSBundle;
namespace base {
class FilePath;
}
namespace atom {
// The "main" application bundle is the outermost bundle for this logical
// application. E.g., if you have MyApp.app and
// MyApp.app/Contents/Frameworks/MyApp Helper.app, the main application bundle
// is MyApp.app, no matter which executable is currently running.
NSBundle* MainApplicationBundle();
base::FilePath MainApplicationBundlePath();
} // namespace atom
#endif // ATOM_COMMON_MAC_MAIN_APPLICATION_BUNDLE_H_

View file

@ -3,7 +3,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#import "brightray/common/mac/main_application_bundle.h"
#import "atom/common/mac/main_application_bundle.h"
#include "base/files/file_path.h"
#include "base/mac/bundle_locations.h"
@ -11,7 +11,7 @@
#include "base/path_service.h"
#include "base/strings/string_util.h"
namespace brightray {
namespace atom {
namespace {
@ -53,4 +53,4 @@ NSBundle* MainApplicationBundle() {
MainApplicationBundlePath())];
}
} // namespace brightray
} // namespace atom

View file

@ -6,6 +6,7 @@
#include "atom/common/api/api_messages.h"
#include "atom/common/api/atom_bindings.h"
#include "atom/common/application_info.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_bindings.h"
@ -17,7 +18,6 @@
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/process/process_handle.h"
#include "brightray/common/application_info.h"
#include "content/public/renderer/render_frame.h"
#include "native_mate/dictionary.h"
#include "third_party/blink/public/web/blink.h"
@ -168,7 +168,7 @@ void AtomSandboxedRendererClient::InitializeBindings(
#endif
#if defined(OS_WIN)
if (brightray::IsRunningInDesktopBridge())
if (IsRunningInDesktopBridge())
process.Set("windowsStore", true);
#endif

View file

@ -1,31 +0,0 @@
import("//build/config/ui.gni")
static_library("brightray") {
deps = [
"//base",
"//base:base_static",
"//content/public/browser",
"//content/shell:copy_shell_resources",
"//net:extras",
"//net:net_with_v8",
"//ui/views",
]
include_dirs = [ ".." ]
if (is_linux) {
deps += [ "//build/config/linux/gtk" ]
}
sources = [
"browser/brightray_paths.h",
"browser/win/scoped_hstring.cc",
"browser/win/scoped_hstring.h",
"common/application_info.cc",
"common/application_info.h",
"common/application_info_mac.mm",
"common/application_info_win.cc",
"common/mac/main_application_bundle.h",
"common/mac/main_application_bundle.mm",
]
}

View file

@ -1 +0,0 @@
filter=-legal/copyright

View file

@ -1,19 +0,0 @@
Copyright (c) 2013-2014 Adam Roben <adam@roben.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,27 +0,0 @@
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,21 +0,0 @@
#ifndef BRIGHTRAY_COMMON_MAC_MAIN_APPLICATION_BUNDLE_H_
#define BRIGHTRAY_COMMON_MAC_MAIN_APPLICATION_BUNDLE_H_
@class NSBundle;
namespace base {
class FilePath;
}
namespace brightray {
// The "main" application bundle is the outermost bundle for this logical
// application. E.g., if you have MyApp.app and
// MyApp.app/Contents/Frameworks/MyApp Helper.app, the main application bundle
// is MyApp.app, no matter which executable is currently running.
NSBundle* MainApplicationBundle();
base::FilePath MainApplicationBundlePath();
} // namespace brightray
#endif // BRIGHTRAY_COMMON_MAC_MAIN_APPLICATION_BUNDLE_H_

View file

@ -8,8 +8,7 @@ be found in the `.gn` and `.gni` files.
The following `gn` files contain the main rules for building Electron:
* `BUILD.gn` defines how Electron itself is built.
* `brightray/BUILD.gn` defines how `brightray` is built and
* `BUILD.gn` defines how Electron itself is built and
includes the default configurations for linking with Chromium.
* `build/args/{debug,release,all}.gn` contain the default build arguments for
building Electron.

View file

@ -48,8 +48,7 @@ still set breakpoints - Visual Studio will automatically figure out that the
source code matches the code running in the attached process and break
accordingly.
Relevant code files can be found in `./atom/` as well as in Brightray, found in
`./brightray/browser` and `./brightray/common`.
Relevant code files can be found in `./atom/`.
### Attaching

View file

@ -41,8 +41,7 @@ this basic introduction, let's assume that you're calling a command from JavaScr
that isn't behaving correctly - so you'd like to break on that command's C++
counterpart inside the Electron source.
Relevant code files can be found in `./atom/` as well as in Brightray, found in
`./brightray/browser` and `./brightray/common`.
Relevant code files can be found in `./atom/`.
Let's assume that you want to debug `app.setName()`, which is defined in `browser.cc`
as `Browser::SetName()`. Set the breakpoint using the `breakpoint` command, specifying

View file

@ -55,7 +55,7 @@ $ git checkout -b my-branch -t upstream/master
### Step 4: Code
Most pull requests opened against the `electron/electron` repository include
changes to either the C/C++ code in the `atom/` or `brightray/` folders,
changes to either the C/C++ code in the `atom/` folder,
the JavaScript code in the `lib/` folder, the documentation in `docs/api/`
or tests in the `spec/` folder.

View file

@ -31,7 +31,6 @@ Electron
| | message loop into Chromium's message loop.
| └── api/ - The implementation of common APIs, and foundations of
| Electron's built-in modules.
├── brightray/ - Thin shim over libcc that makes it easier to use.
├── chromium_src/ - Source code copied from Chromium. See below.
├── default_app/ - The default page to show when Electron is started without
| providing an app.

View file

@ -10,12 +10,6 @@ arbitrary files from it without unpacking the whole file.
The ASAR format was created primarily to improve performance on Windows... TODO
### Brightray
Brightray [was](https://github.com/electron-archive/brightray) a static library
that made [libchromiumcontent] easier to use in applications. It is now
deprecated and has been merged into Electron's codebase.
### CRT
The C Run-time Library (CRT) is the part of the C++ Standard Library that
@ -74,7 +68,7 @@ MAS, see the [Mac App Store Submission Guide].
### Mojo
An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.
An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.
See https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md

View file

@ -223,6 +223,7 @@ filenames = {
"atom/browser/atom_javascript_dialog_manager.h",
"atom/browser/atom_navigation_throttle.h",
"atom/browser/atom_navigation_throttle.cc",
"atom/browser/atom_paths.h",
"atom/browser/atom_permission_manager.cc",
"atom/browser/atom_permission_manager.h",
"atom/browser/atom_quota_permission_context.cc",
@ -495,6 +496,8 @@ filenames = {
"atom/browser/ui/x/x_window_utils.h",
"atom/browser/unresponsive_suppressor.cc",
"atom/browser/unresponsive_suppressor.h",
"atom/browser/win/scoped_hstring.cc",
"atom/browser/win/scoped_hstring.h",
"atom/browser/web_contents_permission_helper.cc",
"atom/browser/web_contents_permission_helper.h",
"atom/browser/web_contents_preferences.cc",
@ -544,6 +547,11 @@ filenames = {
"atom/common/asar/asar_util.h",
"atom/common/asar/scoped_temporary_file.cc",
"atom/common/asar/scoped_temporary_file.h",
"atom/common/application_info_linux.cc",
"atom/common/application_info_mac.mm",
"atom/common/application_info_win.cc",
"atom/common/application_info.cc",
"atom/common/application_info.h",
"atom/common/atom_command_line.cc",
"atom/common/atom_command_line.h",
"atom/common/atom_constants.cc",
@ -576,7 +584,8 @@ filenames = {
"atom/common/keyboard_util.h",
"atom/common/mouse_util.cc",
"atom/common/mouse_util.h",
"atom/common/linux/application_info.cc",
"atom/common/mac/main_application_bundle.h",
"atom/common/mac/main_application_bundle.mm",
"atom/common/native_mate_converters/accelerator_converter.cc",
"atom/common/native_mate_converters/accelerator_converter.h",
"atom/common/native_mate_converters/blink_converter.cc",

View file

@ -43,10 +43,10 @@
"browserify": "browserify",
"bump-version": "./script/bump-version.py",
"check-tls": "python ./script/tls.py",
"clang-format": "find atom/ brightray/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",
"clang-format": "find atom/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",
"lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
"lint:js": "node ./script/lint.js --js",
"lint:clang-format": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
"lint:clang-format": "python script/run-clang-format.py -r -c atom/ chromium_src/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
"lint:cpp": "node ./script/lint.js --cc",
"lint:py": "node ./script/lint.js --py",
"lint:gn": "node ./script/lint.js --gn",
@ -56,7 +56,7 @@
"create-api-json": "electron-docs-linter docs --outfile=electron-api.json",
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=electron-api.json --out=electron.d.ts",
"preinstall": "node -e 'process.exit(0)'",
"precommit": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ && node ./script/lint.js -c && remark docs -qf || (echo \"Code not formatted correctly.\" && exit 1)",
"precommit": "python script/run-clang-format.py -r -c atom/ chromium_src/ && node ./script/lint.js -c && remark docs -qf || (echo \"Code not formatted correctly.\" && exit 1)",
"prepack": "check-for-leaks",
"prepush": "check-for-leaks",
"repl": "node ./script/start.js --interactive",

View file

@ -248,7 +248,7 @@ patches:
author: Jeremy Apthorp <nornagon@nornagon.net>
file: gtk_visibility.patch
description: |
Allow electron and brightray to depend on GTK in the GN build.
Allow electron to depend on GTK in the GN build.
-
author: Jeremy Apthorp <nornagon@nornagon.net>
file: sysroot.patch

View file

@ -3,18 +3,17 @@ From: Jeremy Apthorp <nornagon@nornagon.net>
Date: Thu, 20 Sep 2018 17:48:38 -0700
Subject: gtk_visibility.patch
Allow electron and brightray to depend on GTK in the GN build.
Allow electron to depend on GTK in the GN build.
diff --git a/build/config/linux/gtk/BUILD.gn b/build/config/linux/gtk/BUILD.gn
index deae4d3455a8..fd5d906b98b0 100644
index deae4d3455a8..5f5db2fd6e5e 100644
--- a/build/config/linux/gtk/BUILD.gn
+++ b/build/config/linux/gtk/BUILD.gn
@@ -18,6 +18,8 @@ group("gtk") {
@@ -18,6 +18,7 @@ group("gtk") {
visibility = [
"//chrome/test:interactive_ui_tests",
"//chrome/test:unit_tests",
+ "//electron:*",
+ "//electron/brightray:*",
"//examples:peerconnection_client",
"//gpu/gles2_conform_support:gles2_conform_test_windowless",
"//remoting/host",

View file

@ -40,7 +40,7 @@ function spawnAndCheckExitCode (cmd, args, opts) {
const LINTERS = [ {
key: 'c++',
roots: ['atom', 'brightray'],
roots: ['atom'],
test: filename => filename.endsWith('.cc') || filename.endsWith('.h'),
run: (opts, filenames) => {
if (opts.fix) {