refactor: rename the atom namespace to electron

This commit is contained in:
Samuel Attard 2019-06-19 14:23:04 -07:00 committed by Samuel Attard
parent 8c4496a9c9
commit 34c4c8d508
531 changed files with 1456 additions and 1428 deletions

View file

@ -1,4 +1,4 @@
module atom.mojom;
module electron.mojom;
import "mojo/public/mojom/base/values.mojom";
import "mojo/public/mojom/base/string16.mojom";

View file

@ -14,7 +14,7 @@
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
namespace atom {
namespace electron {
namespace api {
@ -194,7 +194,7 @@ void Clipboard::Clear(mate::Arguments* args) {
} // namespace api
} // namespace atom
} // namespace electron
namespace {
@ -203,25 +203,26 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Context> context,
void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("availableFormats", &atom::api::Clipboard::AvailableFormats);
dict.SetMethod("has", &atom::api::Clipboard::Has);
dict.SetMethod("read", &atom::api::Clipboard::Read);
dict.SetMethod("write", &atom::api::Clipboard::Write);
dict.SetMethod("readText", &atom::api::Clipboard::ReadText);
dict.SetMethod("writeText", &atom::api::Clipboard::WriteText);
dict.SetMethod("readRTF", &atom::api::Clipboard::ReadRTF);
dict.SetMethod("writeRTF", &atom::api::Clipboard::WriteRTF);
dict.SetMethod("readHTML", &atom::api::Clipboard::ReadHTML);
dict.SetMethod("writeHTML", &atom::api::Clipboard::WriteHTML);
dict.SetMethod("readBookmark", &atom::api::Clipboard::ReadBookmark);
dict.SetMethod("writeBookmark", &atom::api::Clipboard::WriteBookmark);
dict.SetMethod("readImage", &atom::api::Clipboard::ReadImage);
dict.SetMethod("writeImage", &atom::api::Clipboard::WriteImage);
dict.SetMethod("readFindText", &atom::api::Clipboard::ReadFindText);
dict.SetMethod("writeFindText", &atom::api::Clipboard::WriteFindText);
dict.SetMethod("readBuffer", &atom::api::Clipboard::ReadBuffer);
dict.SetMethod("writeBuffer", &atom::api::Clipboard::WriteBuffer);
dict.SetMethod("clear", &atom::api::Clipboard::Clear);
dict.SetMethod("availableFormats",
&electron::api::Clipboard::AvailableFormats);
dict.SetMethod("has", &electron::api::Clipboard::Has);
dict.SetMethod("read", &electron::api::Clipboard::Read);
dict.SetMethod("write", &electron::api::Clipboard::Write);
dict.SetMethod("readText", &electron::api::Clipboard::ReadText);
dict.SetMethod("writeText", &electron::api::Clipboard::WriteText);
dict.SetMethod("readRTF", &electron::api::Clipboard::ReadRTF);
dict.SetMethod("writeRTF", &electron::api::Clipboard::WriteRTF);
dict.SetMethod("readHTML", &electron::api::Clipboard::ReadHTML);
dict.SetMethod("writeHTML", &electron::api::Clipboard::WriteHTML);
dict.SetMethod("readBookmark", &electron::api::Clipboard::ReadBookmark);
dict.SetMethod("writeBookmark", &electron::api::Clipboard::WriteBookmark);
dict.SetMethod("readImage", &electron::api::Clipboard::ReadImage);
dict.SetMethod("writeImage", &electron::api::Clipboard::WriteImage);
dict.SetMethod("readFindText", &electron::api::Clipboard::ReadFindText);
dict.SetMethod("writeFindText", &electron::api::Clipboard::WriteFindText);
dict.SetMethod("readBuffer", &electron::api::Clipboard::ReadBuffer);
dict.SetMethod("writeBuffer", &electron::api::Clipboard::WriteBuffer);
dict.SetMethod("clear", &electron::api::Clipboard::Clear);
}
} // namespace

View file

@ -13,7 +13,7 @@
#include "ui/base/clipboard/clipboard.h"
#include "ui/gfx/image/image.h"
namespace atom {
namespace electron {
namespace api {
@ -59,6 +59,6 @@ class Clipboard {
} // namespace api
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_API_ATOM_API_CLIPBOARD_H_

View file

@ -6,7 +6,7 @@
#include "shell/common/api/atom_api_clipboard.h"
#include "ui/base/cocoa/find_pasteboard.h"
namespace atom {
namespace electron {
namespace api {
@ -21,4 +21,4 @@ base::string16 Clipboard::ReadFindText() {
} // namespace api
} // namespace atom
} // namespace electron

View file

@ -10,7 +10,7 @@
#include "native_mate/wrappable.h"
#include "shell/common/key_weak_map.h"
namespace atom {
namespace electron {
namespace api {
@ -51,13 +51,13 @@ class KeyWeakMap : public mate::Wrappable<KeyWeakMap<K>> {
void Remove(const K& key) { key_weak_map_.Remove(key); }
atom::KeyWeakMap<K> key_weak_map_;
electron::KeyWeakMap<K> key_weak_map_;
DISALLOW_COPY_AND_ASSIGN(KeyWeakMap);
};
} // namespace api
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_API_ATOM_API_KEY_WEAK_MAP_H_

View file

@ -39,7 +39,7 @@
#include "ui/gfx/icon_util.h"
#endif
namespace atom {
namespace electron {
namespace api {
@ -650,24 +650,24 @@ void NativeImage::BuildPrototype(v8::Isolate* isolate,
} // namespace api
} // namespace atom
} // namespace electron
namespace mate {
v8::Local<v8::Value> Converter<mate::Handle<atom::api::NativeImage>>::ToV8(
v8::Local<v8::Value> Converter<mate::Handle<electron::api::NativeImage>>::ToV8(
v8::Isolate* isolate,
const mate::Handle<atom::api::NativeImage>& val) {
const mate::Handle<electron::api::NativeImage>& val) {
return val.ToV8();
}
bool Converter<mate::Handle<atom::api::NativeImage>>::FromV8(
bool Converter<mate::Handle<electron::api::NativeImage>>::FromV8(
v8::Isolate* isolate,
v8::Local<v8::Value> val,
mate::Handle<atom::api::NativeImage>* out) {
mate::Handle<electron::api::NativeImage>* out) {
// Try converting from file path.
base::FilePath path;
if (ConvertFromV8(isolate, val, &path)) {
*out = atom::api::NativeImage::CreateFromPath(isolate, path);
*out = electron::api::NativeImage::CreateFromPath(isolate, path);
// Should throw when failed to initialize from path.
return !(*out)->image().IsEmpty();
}
@ -677,7 +677,8 @@ bool Converter<mate::Handle<atom::api::NativeImage>>::FromV8(
if (!wrapper)
return false;
*out = CreateHandle(isolate, static_cast<atom::api::NativeImage*>(wrapper));
*out =
CreateHandle(isolate, static_cast<electron::api::NativeImage*>(wrapper));
return true;
}
@ -685,7 +686,7 @@ bool Converter<mate::Handle<atom::api::NativeImage>>::FromV8(
namespace {
using atom::api::NativeImage;
using electron::api::NativeImage;
void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Value> unused,

View file

@ -34,7 +34,7 @@ namespace mate {
class Arguments;
}
namespace atom {
namespace electron {
namespace api {
@ -113,19 +113,19 @@ class NativeImage : public mate::Wrappable<NativeImage> {
} // namespace api
} // namespace atom
} // namespace electron
namespace mate {
// A custom converter that allows converting path to NativeImage.
template <>
struct Converter<mate::Handle<atom::api::NativeImage>> {
struct Converter<mate::Handle<electron::api::NativeImage>> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const mate::Handle<atom::api::NativeImage>& val);
const mate::Handle<electron::api::NativeImage>& val);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
mate::Handle<atom::api::NativeImage>* out);
mate::Handle<electron::api::NativeImage>* out);
};
} // namespace mate

View file

@ -15,7 +15,7 @@
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
namespace atom {
namespace electron {
namespace api {
@ -73,4 +73,4 @@ bool NativeImage::IsTemplateImage() {
} // namespace api
} // namespace atom
} // namespace electron

View file

@ -44,7 +44,7 @@ struct Converter<base::win::ShortcutOperation> {
namespace {
void OnOpenExternalFinished(atom::util::Promise promise,
void OnOpenExternalFinished(electron::util::Promise promise,
const std::string& error) {
if (error.empty())
promise.Resolve();
@ -53,7 +53,7 @@ void OnOpenExternalFinished(atom::util::Promise promise,
}
v8::Local<v8::Promise> OpenExternal(const GURL& url, mate::Arguments* args) {
atom::util::Promise promise(args->isolate());
electron::util::Promise promise(args->isolate());
v8::Local<v8::Promise> handle = promise.GetHandle();
platform_util::OpenExternalOptions options;

View file

@ -117,13 +117,15 @@ void Initialize(v8::Local<v8::Object> exports,
dict.SetMethod("deleteHiddenValue", &DeleteHiddenValue);
dict.SetMethod("getObjectHash", &GetObjectHash);
dict.SetMethod("takeHeapSnapshot", &TakeHeapSnapshot);
dict.SetMethod("setRemoteCallbackFreer", &atom::RemoteCallbackFreer::BindTo);
dict.SetMethod("setRemoteObjectFreer", &atom::RemoteObjectFreer::BindTo);
dict.SetMethod("addRemoteObjectRef", &atom::RemoteObjectFreer::AddRef);
dict.SetMethod("createIDWeakMap", &atom::api::KeyWeakMap<int32_t>::Create);
dict.SetMethod("setRemoteCallbackFreer",
&electron::RemoteCallbackFreer::BindTo);
dict.SetMethod("setRemoteObjectFreer", &electron::RemoteObjectFreer::BindTo);
dict.SetMethod("addRemoteObjectRef", &electron::RemoteObjectFreer::AddRef);
dict.SetMethod("createIDWeakMap",
&electron::api::KeyWeakMap<int32_t>::Create);
dict.SetMethod(
"createDoubleIDWeakMap",
&atom::api::KeyWeakMap<std::pair<std::string, int32_t>>::Create);
&electron::api::KeyWeakMap<std::pair<std::string, int32_t>>::Create);
dict.SetMethod("requestGarbageCollectionForTesting",
&RequestGarbageCollectionForTesting);
dict.SetMethod("isSameOrigin", &IsSameOrigin);

View file

@ -31,7 +31,7 @@
#include "shell/common/promise_util.h"
#include "third_party/blink/renderer/platform/heap/process_heap.h" // nogncheck
namespace atom {
namespace electron {
namespace {
@ -358,7 +358,7 @@ bool ElectronBindings::TakeHeapSnapshot(v8::Isolate* isolate,
base::File file(file_path,
base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
return atom::TakeHeapSnapshot(isolate, &file);
return electron::TakeHeapSnapshot(isolate, &file);
}
} // namespace atom
} // namespace electron

View file

@ -30,7 +30,7 @@ namespace node {
class Environment;
}
namespace atom {
namespace electron {
class ElectronBindings {
public:
@ -82,6 +82,6 @@ class ElectronBindings {
DISALLOW_COPY_AND_ASSIGN(ElectronBindings);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_API_ELECTRON_BINDINGS_H_

View file

@ -8,7 +8,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
namespace atom {
namespace electron {
ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate,
v8::Local<v8::Object> target)
@ -38,4 +38,4 @@ void ObjectLifeMonitor::Free(
delete data.GetParameter();
}
} // namespace atom
} // namespace electron

View file

@ -9,7 +9,7 @@
#include "base/memory/weak_ptr.h"
#include "v8/include/v8.h"
namespace atom {
namespace electron {
class ObjectLifeMonitor {
protected:
@ -29,6 +29,6 @@ class ObjectLifeMonitor {
DISALLOW_COPY_AND_ASSIGN(ObjectLifeMonitor);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_API_OBJECT_LIFE_MONITOR_H_

View file

@ -11,7 +11,7 @@
#include "electron/shell/common/api/api.mojom.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
namespace atom {
namespace electron {
// static
void RemoteCallbackFreer::BindTo(v8::Isolate* isolate,
@ -56,4 +56,4 @@ void RemoteCallbackFreer::RenderViewDeleted(content::RenderViewHost*) {
delete this;
}
} // namespace atom
} // namespace electron

View file

@ -10,7 +10,7 @@
#include "content/public/browser/web_contents_observer.h"
#include "shell/common/api/object_life_monitor.h"
namespace atom {
namespace electron {
class RemoteCallbackFreer : public ObjectLifeMonitor,
public content::WebContentsObserver {
@ -41,6 +41,6 @@ class RemoteCallbackFreer : public ObjectLifeMonitor,
DISALLOW_COPY_AND_ASSIGN(RemoteCallbackFreer);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_API_REMOTE_CALLBACK_FREER_H_

View file

@ -13,7 +13,7 @@
using blink::WebLocalFrame;
namespace atom {
namespace electron {
namespace {
@ -82,4 +82,4 @@ void RemoteObjectFreer::RunDestructor() {
electron_ptr->Message(true, channel, args.Clone());
}
} // namespace atom
} // namespace electron

View file

@ -10,7 +10,7 @@
#include "shell/common/api/object_life_monitor.h"
namespace atom {
namespace electron {
class RemoteObjectFreer : public ObjectLifeMonitor {
public:
@ -40,6 +40,6 @@ class RemoteObjectFreer : public ObjectLifeMonitor {
DISALLOW_COPY_AND_ASSIGN(RemoteObjectFreer);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_API_REMOTE_OBJECT_FREER_H_

View file

@ -11,7 +11,7 @@
#include "electron/electron_version.h"
#include "shell/browser/browser.h"
namespace atom {
namespace electron {
namespace {
@ -53,4 +53,4 @@ std::string GetApplicationUserAgent() {
return content::BuildUserAgentFromProduct(user_agent);
}
} // namespace atom
} // namespace electron

View file

@ -12,7 +12,7 @@
#include <string>
namespace atom {
namespace electron {
void OverrideApplicationName(const std::string& name);
std::string GetOverriddenApplicationName();
@ -32,6 +32,6 @@ void SetAppUserModelID(const base::string16& name);
bool IsRunningInDesktopBridge();
#endif
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_APPLICATION_INFO_H_

View file

@ -30,7 +30,7 @@ GDesktopAppInfo* get_desktop_app_info() {
} // namespace
namespace atom {
namespace electron {
std::string GetApplicationName() {
// attempt #1: the string set in app.setName()
@ -76,4 +76,4 @@ std::string GetApplicationVersion() {
return ret;
}
} // namespace atom
} // namespace electron

View file

@ -10,7 +10,7 @@
#import "base/strings/sys_string_conversions.h"
#import "shell/common/mac/main_application_bundle.h"
namespace atom {
namespace electron {
namespace {
@ -33,4 +33,4 @@ std::string GetApplicationVersion() {
return ApplicationInfoDictionaryValue(@"CFBundleShortVersionString");
}
} // namespace atom
} // namespace electron

View file

@ -18,7 +18,7 @@
#include "base/strings/utf_string_conversions.h"
#include "shell/browser/win/scoped_hstring.h"
namespace atom {
namespace electron {
namespace {
@ -110,4 +110,4 @@ bool IsRunningInDesktopBridge() {
return result;
}
} // namespace atom
} // namespace electron

View file

@ -7,7 +7,7 @@
#include "base/command_line.h"
#include "uv.h" // NOLINT(build/include)
namespace atom {
namespace electron {
// static
base::CommandLine::StringVector AtomCommandLine::argv_;
@ -33,4 +33,4 @@ void AtomCommandLine::InitializeFromCommandLine() {
}
#endif
} // namespace atom
} // namespace electron

View file

@ -12,7 +12,7 @@
#include "base/macros.h"
#include "build/build_config.h"
namespace atom {
namespace electron {
// Singleton to remember the original "argc" and "argv".
class AtomCommandLine {
@ -33,6 +33,6 @@ class AtomCommandLine {
DISALLOW_IMPLICIT_CONSTRUCTORS(AtomCommandLine);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_ATOM_COMMAND_LINE_H_

View file

@ -4,7 +4,7 @@
#include "shell/common/atom_constants.h"
namespace atom {
namespace electron {
const char kBrowserForward[] = "browser-forward";
const char kBrowserBackward[] = "browser-backward";
@ -44,4 +44,4 @@ const char kPdfViewerUIOrigin[] = "chrome://pdf-viewer/";
const char kPdfViewerUIHost[] = "pdf-viewer";
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
} // namespace atom
} // namespace electron

View file

@ -8,7 +8,7 @@
#include "build/build_config.h"
#include "electron/buildflags/buildflags.h"
namespace atom {
namespace electron {
// The app-command in NativeWindow.
extern const char kBrowserForward[];
@ -47,6 +47,6 @@ extern const char kPdfViewerUIOrigin[];
extern const char kPdfViewerUIHost[];
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_ATOM_CONSTANTS_H_

View file

@ -10,7 +10,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
namespace atom {
namespace electron {
SkColor ParseHexColor(const std::string& color_string) {
// Check the string for incorrect formatting.
@ -51,4 +51,4 @@ std::string ToRGBHex(SkColor color) {
SkColorGetG(color), SkColorGetB(color));
}
} // namespace atom
} // namespace electron

View file

@ -9,7 +9,7 @@
#include "third_party/skia/include/core/SkColor.h"
namespace atom {
namespace electron {
// Parse hex color like "#FFF" or "#EFEFEF"
SkColor ParseHexColor(const std::string& name);
@ -17,6 +17,6 @@ SkColor ParseHexColor(const std::string& name);
// Convert color to RGB hex value like "#ABCDEF"
std::string ToRGBHex(SkColor color);
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_COLOR_UTIL_H_

View file

@ -26,7 +26,7 @@ const char kCrashesDirectoryKey[] = "crashes-directory";
CrashReporter::CrashReporter() {
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
bool run_as_node = base::Environment::Create()->HasVar(atom::kRunAsNode);
bool run_as_node = base::Environment::Create()->HasVar(electron::kRunAsNode);
#else
bool run_as_node = false;
#endif

View file

@ -76,7 +76,7 @@ void CrashReporterWin::Init(const std::string& product_name,
} else {
std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string pipe_name_utf8;
if (env->GetVar(atom::kCrashpadPipeName, &pipe_name_utf8)) {
if (env->GetVar(electron::kCrashpadPipeName, &pipe_name_utf8)) {
base::string16 pipe_name = base::UTF8ToUTF16(pipe_name_utf8);
if (!crashpad_client_.SetHandlerIPCPipe(pipe_name))
LOG(ERROR) << "Failed to set handler IPC pipe name: " << pipe_name;
@ -112,16 +112,16 @@ void CrashReporterWin::UpdatePipeName() {
std::string pipe_name =
base::UTF16ToUTF8(crashpad_client_.GetHandlerIPCPipe());
std::unique_ptr<base::Environment> env(base::Environment::Create());
env->SetVar(atom::kCrashpadPipeName, pipe_name);
env->SetVar(electron::kCrashpadPipeName, pipe_name);
// Notify all WebContents of the pipe name.
const auto& pages = atom::InspectableWebContentsImpl::GetAll();
const auto& pages = electron::InspectableWebContentsImpl::GetAll();
for (auto* page : pages) {
auto* frame_host = page->GetWebContents()->GetMainFrame();
if (!frame_host)
continue;
atom::mojom::ElectronRendererAssociatedPtr electron_ptr;
electron::mojom::ElectronRendererAssociatedPtr electron_ptr;
frame_host->GetRemoteAssociatedInterfaces()->GetInterface(
mojo::MakeRequest(&electron_ptr));
electron_ptr->UpdateCrashpadPipeName(pipe_name);

View file

@ -9,7 +9,7 @@
#include "native_mate/dictionary.h"
#include "shell/common/native_mate_converters/callback.h"
namespace atom {
namespace electron {
void EmitDeprecationWarning(node::Environment* env,
const std::string& warning_msg,
@ -24,4 +24,4 @@ void EmitDeprecationWarning(node::Environment* env,
emit_warning.Run(warning_msg, warning_type, "");
}
} // namespace atom
} // namespace electron

View file

@ -9,12 +9,12 @@
#include "shell/common/node_includes.h"
namespace atom {
namespace electron {
void EmitDeprecationWarning(node::Environment* env,
const std::string& warning_msg,
const std::string& warning_type);
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_DEPRECATE_UTIL_H_

View file

@ -32,7 +32,7 @@ class HeapSnapshotOutputStream : public v8::OutputStream {
} // namespace
namespace atom {
namespace electron {
bool TakeHeapSnapshot(v8::Isolate* isolate, base::File* file) {
DCHECK(isolate);
@ -53,4 +53,4 @@ bool TakeHeapSnapshot(v8::Isolate* isolate, base::File* file) {
return stream.IsComplete();
}
} // namespace atom
} // namespace electron

View file

@ -8,10 +8,10 @@
#include "base/files/file.h"
#include "v8/include/v8.h"
namespace atom {
namespace electron {
bool TakeHeapSnapshot(v8::Isolate* isolate, base::File* file);
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_HEAP_SNAPSHOT_H_

View file

@ -12,7 +12,7 @@
#include "base/macros.h"
#include "v8/include/v8.h"
namespace atom {
namespace electron {
// Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer.
template <typename K>
@ -82,6 +82,6 @@ class KeyWeakMap {
DISALLOW_COPY_AND_ASSIGN(KeyWeakMap);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_KEY_WEAK_MAP_H_

View file

@ -10,7 +10,7 @@
#include "third_party/blink/public/platform/web_input_event.h"
#include "ui/events/event_constants.h"
namespace atom {
namespace electron {
namespace {
@ -355,4 +355,4 @@ int WebEventModifiersToEventFlags(int modifiers) {
return flags;
}
} // namespace atom
} // namespace electron

View file

@ -10,7 +10,7 @@
#include "base/strings/string16.h"
#include "ui/events/keycodes/keyboard_codes.h"
namespace atom {
namespace electron {
// Return key code of the char, and also determine whether the SHIFT key is
// pressed.
@ -23,6 +23,6 @@ ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted);
// Ported from ui/events/blink/blink_event_util.h
int WebEventModifiersToEventFlags(int modifiers);
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_KEYBOARD_UTIL_H_

View file

@ -12,7 +12,7 @@ namespace base {
class FilePath;
}
namespace atom {
namespace electron {
// The "main" application bundle is the outermost bundle for this logical
// application. E.g., if you have MyApp.app and
@ -21,6 +21,6 @@ namespace atom {
NSBundle* MainApplicationBundle();
base::FilePath MainApplicationBundlePath();
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_MAC_MAIN_APPLICATION_BUNDLE_H_

View file

@ -11,7 +11,7 @@
#include "base/path_service.h"
#include "base/strings/string_util.h"
namespace atom {
namespace electron {
namespace {
@ -53,4 +53,4 @@ NSBundle* MainApplicationBundle() {
MainApplicationBundlePath())];
}
} // namespace atom
} // namespace electron

View file

@ -7,7 +7,7 @@
using Cursor = blink::WebCursorInfo::Type;
namespace atom {
namespace electron {
std::string CursorTypeToString(const content::CursorInfo& info) {
switch (info.type) {
@ -104,4 +104,4 @@ std::string CursorTypeToString(const content::CursorInfo& info) {
}
}
} // namespace atom
} // namespace electron

View file

@ -24,11 +24,11 @@
code; \
} break;
namespace atom {
namespace electron {
// Returns the cursor's type as a string.
std::string CursorTypeToString(const content::CursorInfo& info);
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_MOUSE_UTIL_H_

View file

@ -180,7 +180,7 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
return false;
bool shifted = false;
ui::KeyboardCode keyCode = atom::KeyboardCodeFromStr(str, &shifted);
ui::KeyboardCode keyCode = electron::KeyboardCodeFromStr(str, &shifted);
out->windows_key_code = keyCode;
if (shifted)
out->SetModifiers(out->GetModifiers() | blink::WebInputEvent::kShiftKey);
@ -190,7 +190,7 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
ui::DomKey domKey;
ui::KeyboardCode dummy_code;
int flags = atom::WebEventModifiersToEventFlags(out->GetModifiers());
int flags = electron::WebEventModifiersToEventFlags(out->GetModifiers());
if (ui::DomCodeToUsLayoutDomKey(domCode, flags, &domKey, &dummy_code))
out->dom_key = static_cast<int>(domKey);

View file

@ -149,7 +149,7 @@ bool Converter<blink::mojom::PermissionStatus>::FromV8(
v8::Local<v8::Value> Converter<content::PermissionType>::ToV8(
v8::Isolate* isolate,
const content::PermissionType& val) {
using PermissionType = atom::WebContentsPermissionHelper::PermissionType;
using PermissionType = electron::WebContentsPermissionHelper::PermissionType;
switch (val) {
case content::PermissionType::MIDI_SYSEX:
return StringToV8(isolate, "midiSysex");
@ -206,14 +206,14 @@ v8::Local<v8::Value> Converter<content::WebContents*>::ToV8(
content::WebContents* val) {
if (!val)
return v8::Null(isolate);
return atom::api::WebContents::FromOrCreate(isolate, val).ToV8();
return electron::api::WebContents::FromOrCreate(isolate, val).ToV8();
}
// static
bool Converter<content::WebContents*>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::WebContents** out) {
atom::api::WebContents* web_contents = nullptr;
electron::api::WebContents* web_contents = nullptr;
if (!ConvertFromV8(isolate, val, &web_contents) || !web_contents)
return false;

View file

@ -60,7 +60,8 @@ v8::Local<v8::Value> Converter<file_dialog::DialogSettings>::ToV8(
const file_dialog::DialogSettings& in) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.Set("window", atom::api::BrowserWindow::From(isolate, in.parent_window));
dict.Set("window",
electron::api::BrowserWindow::From(isolate, in.parent_window));
dict.Set("title", in.title);
dict.Set("message", in.message);
dict.Set("buttonLabel", in.button_label);

View file

@ -27,7 +27,7 @@ bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
if (val->IsNull())
return true;
Handle<atom::api::NativeImage> native_image;
Handle<electron::api::NativeImage> native_image;
if (!ConvertFromV8(isolate, val, &native_image))
return false;
@ -37,7 +37,7 @@ bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Image>::ToV8(v8::Isolate* isolate,
const gfx::Image& val) {
return ConvertToV8(isolate, atom::api::NativeImage::Create(isolate, val));
return ConvertToV8(isolate, electron::api::NativeImage::Create(isolate, val));
}
} // namespace mate

View file

@ -11,17 +11,17 @@
namespace mate {
bool Converter<atom::MessageBoxSettings>::FromV8(
bool Converter<electron::MessageBoxSettings>::FromV8(
v8::Isolate* isolate,
v8::Local<v8::Value> val,
atom::MessageBoxSettings* out) {
electron::MessageBoxSettings* out) {
mate::Dictionary dict;
int type = 0;
if (!ConvertFromV8(isolate, val, &dict))
return false;
dict.Get("window", &out->parent_window);
dict.Get("type", &type);
out->type = static_cast<atom::MessageBoxType>(type);
out->type = static_cast<electron::MessageBoxType>(type);
dict.Get("buttons", &out->buttons);
dict.Get("defaultId", &out->default_id);
dict.Get("cancelId", &out->cancel_id);

View file

@ -11,10 +11,10 @@
namespace mate {
template <>
struct Converter<atom::MessageBoxSettings> {
struct Converter<electron::MessageBoxSettings> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
atom::MessageBoxSettings* out);
electron::MessageBoxSettings* out);
};
} // namespace mate

View file

@ -270,7 +270,7 @@ v8::Local<v8::Value> Converter<network::ResourceRequest>::ToV8(
} // namespace mate
namespace atom {
namespace electron {
void FillRequestDetails(base::DictionaryValue* details,
const net::URLRequest* request) {
@ -321,4 +321,4 @@ void GetUploadData(base::ListValue* upload_data_list,
}
}
} // namespace atom
} // namespace electron

View file

@ -67,7 +67,7 @@ struct Converter<network::ResourceRequest> {
} // namespace mate
namespace atom {
namespace electron {
void FillRequestDetails(base::DictionaryValue* details,
const net::URLRequest* request);
@ -75,6 +75,6 @@ void FillRequestDetails(base::DictionaryValue* details,
void GetUploadData(base::ListValue* upload_data_list,
const net::URLRequest* request);
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_NATIVE_MATE_CONVERTERS_NET_CONVERTER_H_

View file

@ -17,7 +17,7 @@
#include "shell/common/node_bindings.h"
#include "shell/common/node_includes.h"
namespace atom {
namespace electron {
namespace {
@ -514,4 +514,4 @@ std::unique_ptr<base::Value> V8ValueConverter::FromV8Object(
return std::move(result);
}
} // namespace atom
} // namespace electron

View file

@ -17,7 +17,7 @@ class ListValue;
class Value;
} // namespace base
namespace atom {
namespace electron {
class V8ValueConverter {
public:
@ -72,6 +72,6 @@ class V8ValueConverter {
DISALLOW_COPY_AND_ASSIGN(V8ValueConverter);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_NATIVE_MATE_CONVERTERS_V8_VALUE_CONVERTER_H_

View file

@ -14,7 +14,7 @@ namespace mate {
bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::DictionaryValue* out) {
atom::V8ValueConverter converter;
electron::V8ValueConverter converter;
std::unique_ptr<base::Value> value(
converter.FromV8Value(val, isolate->GetCurrentContext()));
if (value && value->is_dict()) {
@ -28,14 +28,14 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<base::DictionaryValue>::ToV8(
v8::Isolate* isolate,
const base::DictionaryValue& val) {
atom::V8ValueConverter converter;
electron::V8ValueConverter converter;
return converter.ToV8Value(&val, isolate->GetCurrentContext());
}
bool Converter<base::Value>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::Value* out) {
atom::V8ValueConverter converter;
electron::V8ValueConverter converter;
std::unique_ptr<base::Value> value(
converter.FromV8Value(val, isolate->GetCurrentContext()));
if (value) {
@ -48,14 +48,14 @@ bool Converter<base::Value>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<base::Value>::ToV8(v8::Isolate* isolate,
const base::Value& val) {
atom::V8ValueConverter converter;
electron::V8ValueConverter converter;
return converter.ToV8Value(&val, isolate->GetCurrentContext());
}
bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::ListValue* out) {
atom::V8ValueConverter converter;
electron::V8ValueConverter converter;
std::unique_ptr<base::Value> value(
converter.FromV8Value(val, isolate->GetCurrentContext()));
if (value->is_list()) {
@ -69,7 +69,7 @@ bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<base::ListValue>::ToV8(
v8::Isolate* isolate,
const base::ListValue& val) {
atom::V8ValueConverter converter;
electron::V8ValueConverter converter;
return converter.ToV8Value(&val, isolate->GetCurrentContext());
}

View file

@ -120,7 +120,7 @@ bool g_is_initialized = false;
} // namespace
namespace atom {
namespace electron {
namespace {
@ -446,4 +446,4 @@ void NodeBindings::EmbedThreadRunner(void* arg) {
}
}
} // namespace atom
} // namespace electron

View file

@ -21,7 +21,7 @@ class Environment;
class MultiIsolatePlatform;
} // namespace node
namespace atom {
namespace electron {
class NodeBindings {
public:
@ -112,6 +112,6 @@ class NodeBindings {
DISALLOW_COPY_AND_ASSIGN(NodeBindings);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_NODE_BINDINGS_H_

View file

@ -6,7 +6,7 @@
#include <sys/epoll.h>
namespace atom {
namespace electron {
NodeBindingsLinux::NodeBindingsLinux(BrowserEnvironment browser_env)
: NodeBindings(browser_env), epoll_(epoll_create(1)) {
@ -52,4 +52,4 @@ NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) {
return new NodeBindingsLinux(browser_env);
}
} // namespace atom
} // namespace electron

View file

@ -8,7 +8,7 @@
#include "base/compiler_specific.h"
#include "shell/common/node_bindings.h"
namespace atom {
namespace electron {
class NodeBindingsLinux : public NodeBindings {
public:
@ -29,6 +29,6 @@ class NodeBindingsLinux : public NodeBindings {
DISALLOW_COPY_AND_ASSIGN(NodeBindingsLinux);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_NODE_BINDINGS_LINUX_H_

View file

@ -12,7 +12,7 @@
#include "shell/common/node_includes.h"
namespace atom {
namespace electron {
NodeBindingsMac::NodeBindingsMac(BrowserEnvironment browser_env)
: NodeBindings(browser_env) {}
@ -62,4 +62,4 @@ NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) {
return new NodeBindingsMac(browser_env);
}
} // namespace atom
} // namespace electron

View file

@ -8,7 +8,7 @@
#include "base/compiler_specific.h"
#include "shell/common/node_bindings.h"
namespace atom {
namespace electron {
class NodeBindingsMac : public NodeBindings {
public:
@ -26,6 +26,6 @@ class NodeBindingsMac : public NodeBindings {
DISALLOW_COPY_AND_ASSIGN(NodeBindingsMac);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_NODE_BINDINGS_MAC_H_

View file

@ -9,7 +9,7 @@
#include "base/logging.h"
#include "base/system/sys_info.h"
namespace atom {
namespace electron {
NodeBindingsWin::NodeBindingsWin(BrowserEnvironment browser_env)
: NodeBindings(browser_env) {
@ -50,4 +50,4 @@ NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) {
return new NodeBindingsWin(browser_env);
}
} // namespace atom
} // namespace electron

View file

@ -8,7 +8,7 @@
#include "base/compiler_specific.h"
#include "shell/common/node_bindings.h"
namespace atom {
namespace electron {
class NodeBindingsWin : public NodeBindings {
public:
@ -21,6 +21,6 @@ class NodeBindingsWin : public NodeBindings {
DISALLOW_COPY_AND_ASSIGN(NodeBindingsWin);
};
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_NODE_BINDINGS_WIN_H_

View file

@ -4,7 +4,7 @@
#include "shell/common/options_switches.h"
namespace atom {
namespace electron {
namespace options {
@ -270,4 +270,4 @@ const char kEnableAuthNegotiatePort[] = "enable-auth-negotiate-port";
} // namespace switches
} // namespace atom
} // namespace electron

View file

@ -5,7 +5,7 @@
#ifndef SHELL_COMMON_OPTIONS_SWITCHES_H_
#define SHELL_COMMON_OPTIONS_SWITCHES_H_
namespace atom {
namespace electron {
namespace options {
@ -131,6 +131,6 @@ extern const char kEnableAuthNegotiatePort[];
} // namespace switches
} // namespace atom
} // namespace electron
#endif // SHELL_COMMON_OPTIONS_SWITCHES_H_

View file

@ -7,7 +7,7 @@
#include "shell/common/api/locker.h"
#include "shell/common/promise_util.h"
namespace atom {
namespace electron {
namespace util {
@ -60,13 +60,13 @@ Promise CopyablePromise::GetPromise() const {
} // namespace util
} // namespace atom
} // namespace electron
namespace mate {
v8::Local<v8::Value> mate::Converter<atom::util::Promise>::ToV8(
v8::Local<v8::Value> mate::Converter<electron::util::Promise>::ToV8(
v8::Isolate*,
const atom::util::Promise& val) {
const electron::util::Promise& val) {
return val.GetHandle();
}

View file

@ -16,7 +16,7 @@
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/once_callback.h"
namespace atom {
namespace electron {
namespace util {
@ -246,14 +246,14 @@ class CopyablePromise {
} // namespace util
} // namespace atom
} // namespace electron
namespace mate {
template <>
struct Converter<atom::util::Promise> {
struct Converter<electron::util::Promise> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const atom::util::Promise& val);
const electron::util::Promise& val);
// TODO(MarshallOfSound): Implement FromV8 to allow promise chaining
// in native land
// static bool FromV8(v8::Isolate* isolate,