refactor: rename the atom namespace to electron
This commit is contained in:
parent
8c4496a9c9
commit
34c4c8d508
531 changed files with 1456 additions and 1428 deletions
|
@ -1,4 +1,4 @@
|
|||
module atom.mojom;
|
||||
module electron.mojom;
|
||||
|
||||
import "mojo/public/mojom/base/values.mojom";
|
||||
import "mojo/public/mojom/base/string16.mojom";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue