Permalink
Browse files

refactor: eliminate brightray (#15240)

  • Loading branch information...
miniak authored and alexeykuzmin committed Oct 24, 2018
1 parent 1d8ab03 commit 8ba271efba691357ab1970c1a553b4e019125574
Showing with 178 additions and 234 deletions.
  1. +0 −7 .gitignore
  2. +6 −1 BUILD.gn
  3. +2 −2 atom/app/atom_library_main.mm
  4. +5 −8 atom/app/atom_main_delegate_mac.mm
  5. +7 −7 atom/browser/api/atom_api_app.cc
  6. +6 −7 atom/browser/atom_browser_context.cc
  7. +7 −8 atom/browser/atom_browser_main_parts.cc
  8. +2 −2 atom/browser/atom_browser_main_parts_mac.mm
  9. +7 −5 brightray/browser/brightray_paths.h → atom/browser/atom_paths.h
  10. +7 −7 atom/browser/browser.cc
  11. +3 −3 atom/browser/browser_linux.cc
  12. +3 −3 atom/browser/browser_mac.mm
  13. +4 −4 atom/browser/browser_win.cc
  14. +1 −1 atom/browser/media/media_device_id_salt.cc
  15. +2 −2 atom/browser/notifications/linux/libnotify_notification.cc
  16. +4 −4 atom/browser/notifications/win/windows_toast_notification.cc
  17. +2 −2 atom/browser/notifications/win/windows_toast_notification.h
  18. +1 −1 atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm
  19. +3 −3 atom/browser/ui/inspectable_web_contents_impl.cc
  20. +2 −2 atom/browser/ui/tray_icon_gtk.cc
  21. +5 −1 {brightray → atom}/browser/win/scoped_hstring.cc
  22. +7 −3 {brightray → atom}/browser/win/scoped_hstring.h
  23. +2 −2 atom/common/api/atom_bindings.cc
  24. +7 −3 {brightray → atom}/common/application_info.cc
  25. +10 −6 {brightray → atom}/common/application_info.h
  26. +3 −3 atom/common/{linux/application_info.cc → application_info_linux.cc}
  27. +8 −4 {brightray → atom}/common/application_info_mac.mm
  28. +8 −4 {brightray → atom}/common/application_info_win.cc
  29. +26 −0 atom/common/mac/main_application_bundle.h
  30. +3 −3 {brightray → atom}/common/mac/main_application_bundle.mm
  31. +2 −2 atom/renderer/atom_sandboxed_renderer_client.cc
  32. +0 −31 brightray/BUILD.gn
  33. +0 −1 brightray/CPPLINT.cfg
  34. +0 −19 brightray/LICENSE
  35. +0 −27 brightray/LICENSE-CHROMIUM
  36. +0 −21 brightray/common/mac/main_application_bundle.h
  37. +1 −2 docs/development/build-system-overview.md
  38. +1 −2 docs/development/debug-instructions-windows.md
  39. +1 −2 docs/development/debugging-instructions-macos.md
  40. +1 −1 docs/development/pull-requests.md
  41. +0 −1 docs/development/source-code-directory-structure.md
  42. +1 −7 docs/glossary.md
  43. +10 −1 filenames.gni
  44. +3 −3 package.json
  45. +1 −1 patches/common/chromium/.patches.yaml
  46. +3 −4 patches/common/chromium/gtk_visibility.patch
  47. +1 −1 script/lint.js
@@ -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/
@@ -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",
@@ -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"));
@@ -5,25 +5,23 @@
#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"
#include "base/mac/foundation_util.h"
#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 {
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,16 +44,15 @@
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);
}
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"];
@@ -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));
@@ -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())
@@ -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
@@ -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 @@
NSString* libraryPath =
[NSHomeDirectory() stringByAppendingPathComponent:logsPath];
base::PathService::Override(brightray::DIR_APP_LOGS,
base::PathService::Override(DIR_APP_LOGS,
base::FilePath([libraryPath UTF8String]));
}
@@ -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_
@@ -9,19 +9,19 @@
#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"
#include "base/path_service.h"
#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;
Oops, something went wrong.

0 comments on commit 8ba271e

Please sign in to comment.