clang-format atom files

This commit is contained in:
Shelley Vohr 2018-04-17 21:44:10 -04:00
parent 717f55b012
commit 53bdf22c85
No known key found for this signature in database
GPG key ID: F13993A75599653C
128 changed files with 771 additions and 753 deletions

View file

@ -9,12 +9,12 @@
#if defined(OS_MACOSX)
extern "C" {
__attribute__((visibility("default")))
int AtomMain(int argc, char* argv[]);
__attribute__((visibility("default"))) int AtomMain(int argc, char* argv[]);
#ifdef ENABLE_RUN_AS_NODE
__attribute__((visibility("default")))
int AtomInitializeICUandStartNode(int argc, char *argv[]);
__attribute__((visibility("default"))) int AtomInitializeICUandStartNode(
int argc,
char* argv[]);
#endif
}
#endif // OS_MACOSX

View file

@ -14,4 +14,3 @@ bool CheckCommandLineArguments(int argc, base::CommandLine::CharType** argv);
} // namespace atom
#endif // ATOM_APP_COMMAND_LINE_ARGS_H_

View file

@ -9,7 +9,7 @@
namespace atom {
int NodeMain(int argc, char *argv[]);
int NodeMain(int argc, char* argv[]);
} // namespace atom

View file

@ -25,8 +25,7 @@ class UvTaskRunner : public base::SingleThreadTaskRunner {
base::OnceClosure task,
base::TimeDelta delay) override;
bool RunsTasksInCurrentSequence() const override;
bool PostNonNestableDelayedTask(
const base::Location& from_here,
bool PostNonNestableDelayedTask(const base::Location& from_here,
base::OnceClosure task,
base::TimeDelta delay) override;

View file

@ -67,8 +67,8 @@ class App : public AtomBrowserClient::Delegate,
public content::GpuDataManagerObserver,
public content::BrowserChildProcessObserver {
public:
using FileIconCallback = base::Callback<void(v8::Local<v8::Value>,
const gfx::Image&)>;
using FileIconCallback =
base::Callback<void(v8::Local<v8::Value>, const gfx::Image&)>;
static mate::Handle<App> Create(v8::Isolate* isolate);
@ -106,14 +106,11 @@ class App : public AtomBrowserClient::Delegate,
void OnAccessibilitySupportChanged() override;
void OnPreMainMessageLoopRun() override;
#if defined(OS_MACOSX)
void OnWillContinueUserActivity(
bool* prevent_default,
void OnWillContinueUserActivity(bool* prevent_default,
const std::string& type) override;
void OnDidFailToContinueUserActivity(
const std::string& type,
void OnDidFailToContinueUserActivity(const std::string& type,
const std::string& error) override;
void OnContinueUserActivity(
bool* prevent_default,
void OnContinueUserActivity(bool* prevent_default,
const std::string& type,
const base::DictionaryValue& user_info) override;
void OnUserActivityWasContinued(
@ -166,10 +163,10 @@ class App : public AtomBrowserClient::Delegate,
const content::ChildProcessData& data) override;
void BrowserChildProcessHostDisconnected(
const content::ChildProcessData& data) override;
void BrowserChildProcessCrashed(
const content::ChildProcessData& data, int exit_code) override;
void BrowserChildProcessKilled(
const content::ChildProcessData& data, int exit_code) override;
void BrowserChildProcessCrashed(const content::ChildProcessData& data,
int exit_code) override;
void BrowserChildProcessKilled(const content::ChildProcessData& data,
int exit_code) override;
private:
void SetAppPath(const base::FilePath& app_path);
@ -197,8 +194,7 @@ class App : public AtomBrowserClient::Delegate,
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);
#endif
void GetFileIcon(const base::FilePath& path,
mate::Arguments* args);
void GetFileIcon(const base::FilePath& path, mate::Arguments* args);
std::vector<mate::Dictionary> GetAppMetrics(v8::Isolate* isolate);
v8::Local<v8::Value> GetGPUFeatureStatus(v8::Isolate* isolate);
@ -233,8 +229,7 @@ class App : public AtomBrowserClient::Delegate,
base::FilePath app_path_;
using ProcessMetricMap =
std::unordered_map<base::ProcessId,
std::unique_ptr<atom::ProcessMetric>>;
std::unordered_map<base::ProcessId, std::unique_ptr<atom::ProcessMetric>>;
ProcessMetricMap app_metrics_;
DISALLOW_COPY_AND_ASSIGN(App);

View file

@ -32,7 +32,8 @@ class AutoUpdater : public mate::EventEmitter<AutoUpdater>,
// Delegate implementations.
void OnError(const std::string& error) override;
void OnError(const std::string& message, const int code,
void OnError(const std::string& message,
const int code,
const std::string& domain);
void OnCheckingForUpdate() override;
void OnUpdateAvailable() override;

View file

@ -82,8 +82,7 @@ class BrowserWindow : public TopLevelWindow,
// Helpers.
// Called when the window needs to update its draggable region.
void UpdateDraggableRegions(
content::RenderFrameHost* rfh,
void UpdateDraggableRegions(content::RenderFrameHost* rfh,
const std::vector<DraggableRegion>& regions);
// Convert draggable regions in raw format to SkRegion format.
@ -121,9 +120,10 @@ class BrowserWindow : public TopLevelWindow,
namespace mate {
template<>
template <>
struct Converter<atom::NativeWindow*> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
atom::NativeWindow** out) {
// null would be tranfered to NULL.
if (val->IsNull()) {

View file

@ -49,7 +49,8 @@ class Cookies : public mate::TrackableObject<Cookies> {
~Cookies() override;
void Get(const base::DictionaryValue& filter, const GetCallback& callback);
void Remove(const GURL& url, const std::string& name,
void Remove(const GURL& url,
const std::string& name,
const base::Closure& callback);
void Set(const base::DictionaryValue& details, const SetCallback& callback);
void FlushStore(const base::Closure& callback);

View file

@ -17,7 +17,7 @@
namespace content {
class DevToolsAgentHost;
class WebContents;
}
} // namespace content
namespace mate {
class Arguments;
@ -27,15 +27,15 @@ namespace atom {
namespace api {
class Debugger: public mate::TrackableObject<Debugger>,
class Debugger : public mate::TrackableObject<Debugger>,
public content::DevToolsAgentHostClient {
public:
using SendCommandCallback =
base::Callback<void(const base::DictionaryValue&,
const base::DictionaryValue&)>;
static mate::Handle<Debugger> Create(
v8::Isolate* isolate, content::WebContents* web_contents);
static mate::Handle<Debugger> Create(v8::Isolate* isolate,
content::WebContents* web_contents);
// mate::TrackableObject:
static void BuildPrototype(v8::Isolate* isolate,

View file

@ -16,7 +16,7 @@ namespace atom {
namespace api {
class DesktopCapturer: public mate::EventEmitter<DesktopCapturer>,
class DesktopCapturer : public mate::EventEmitter<DesktopCapturer>,
public DesktopMediaListObserver {
public:
struct Source {

View file

@ -55,7 +55,9 @@ class Menu : public mate::TrackableObject<Menu>,
void MenuWillShow(ui::SimpleMenuModel* source) override;
virtual void PopupAt(BrowserWindow* window,
int x, int y, int positioning_item,
int x,
int y,
int positioning_item,
const base::Closure& callback) = 0;
virtual void ClosePopupAt(int32_t window_id) = 0;
@ -110,12 +112,12 @@ class Menu : public mate::TrackableObject<Menu>,
} // namespace atom
namespace mate {
template<>
template <>
struct Converter<atom::AtomMenuModel*> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
atom::AtomMenuModel** out) {
// null would be tranfered to NULL.
if (val->IsNull()) {

View file

@ -23,7 +23,9 @@ class MenuMac : public Menu {
MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
void PopupAt(BrowserWindow* window,
int x, int y, int positioning_item,
int x,
int y,
int positioning_item,
const base::Closure& callback) override;
void PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
int32_t window_id,

View file

@ -22,7 +22,9 @@ class MenuViews : public Menu {
protected:
void PopupAt(BrowserWindow* window,
int x, int y, int positioning_item,
int x,
int y,
int positioning_item,
const base::Closure& callback) override;
void ClosePopupAt(int32_t window_id) override;

View file

@ -39,8 +39,8 @@ class Protocol : public mate::TrackableObject<Protocol> {
using CompletionCallback = base::Callback<void(v8::Local<v8::Value>)>;
using BooleanCallback = base::Callback<void(bool)>;
static mate::Handle<Protocol> Create(
v8::Isolate* isolate, AtomBrowserContext* browser_context);
static mate::Handle<Protocol> Create(v8::Isolate* isolate,
AtomBrowserContext* browser_context);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
@ -62,12 +62,11 @@ class Protocol : public mate::TrackableObject<Protocol> {
// The protocol handler that will create a protocol handler for certain
// request job.
template<typename RequestJob>
template <typename RequestJob>
class CustomProtocolHandler
: public net::URLRequestJobFactory::ProtocolHandler {
public:
CustomProtocolHandler(
v8::Isolate* isolate,
CustomProtocolHandler(v8::Isolate* isolate,
net::URLRequestContextGetter* request_context,
const Handler& handler)
: isolate_(isolate),
@ -95,7 +94,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
void RegisterServiceWorkerSchemes(const std::vector<std::string>& schemes);
// Register the protocol with certain request job.
template<typename RequestJob>
template <typename RequestJob>
void RegisterProtocol(const std::string& scheme,
const Handler& handler,
mate::Arguments* args) {
@ -108,7 +107,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
base::RetainedRef(getter), isolate(), scheme, handler),
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
}
template<typename RequestJob>
template <typename RequestJob>
static ProtocolError RegisterProtocolInIO(
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter,
v8::Isolate* isolate,
@ -141,7 +140,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
const std::string& scheme);
// Replace the protocol handler with a new one.
template<typename RequestJob>
template <typename RequestJob>
void InterceptProtocol(const std::string& scheme,
const Handler& handler,
mate::Arguments* args) {
@ -154,7 +153,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
base::RetainedRef(getter), isolate(), scheme, handler),
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
}
template<typename RequestJob>
template <typename RequestJob>
static ProtocolError InterceptProtocolInIO(
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter,
v8::Isolate* isolate,
@ -187,9 +186,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
// Convert error code to string.
std::string ErrorCodeToString(ProtocolError error);
base::WeakPtr<Protocol> GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
base::WeakPtr<Protocol> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
scoped_refptr<AtomBrowserContext> browser_context_;
base::WeakPtrFactory<Protocol> weak_factory_;

View file

@ -16,8 +16,8 @@ namespace api {
class RenderProcessPreferences
: public mate::Wrappable<RenderProcessPreferences> {
public:
static mate::Handle<RenderProcessPreferences>
ForAllWebContents(v8::Isolate* isolate);
static mate::Handle<RenderProcessPreferences> ForAllWebContents(
v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -16,7 +16,7 @@ namespace gfx {
class Point;
class Rect;
class Screen;
}
} // namespace gfx
namespace atom {

View file

@ -24,7 +24,7 @@ class FilePath;
namespace mate {
class Arguments;
class Dictionary;
}
} // namespace mate
namespace net {
class ProxyConfig;
@ -36,7 +36,7 @@ class AtomBrowserContext;
namespace api {
class Session: public mate::TrackableObject<Session>,
class Session : public mate::TrackableObject<Session>,
public content::DownloadManager::Observer {
public:
using ResolveProxyCallback = base::Callback<void(std::string)>;
@ -47,12 +47,13 @@ class Session: public mate::TrackableObject<Session>,
};
// Gets or creates Session from the |browser_context|.
static mate::Handle<Session> CreateFrom(
v8::Isolate* isolate, AtomBrowserContext* browser_context);
static mate::Handle<Session> CreateFrom(v8::Isolate* isolate,
AtomBrowserContext* browser_context);
// Gets the Session of |partition|.
static mate::Handle<Session> FromPartition(
v8::Isolate* isolate, const std::string& partition,
v8::Isolate* isolate,
const std::string& partition,
const base::DictionaryValue& options = base::DictionaryValue());
AtomBrowserContext* browser_context() const { return browser_context_.get(); }
@ -63,7 +64,7 @@ class Session: public mate::TrackableObject<Session>,
// Methods.
void ResolveProxy(const GURL& url, ResolveProxyCallback callback);
template<CacheAction action>
template <CacheAction action>
void DoCacheAction(const net::CompletionCallback& callback);
void ClearStorageData(mate::Arguments* args);
void FlushStorageData();

View file

@ -36,10 +36,11 @@ enum NotificationCenterKind {
class SystemPreferences : public mate::EventEmitter<SystemPreferences>
#if defined(OS_WIN)
, public BrowserObserver
, public gfx::SysColorChangeListener
,
public BrowserObserver,
public gfx::SysColorChangeListener
#endif
{
{
public:
static mate::Handle<SystemPreferences> Create(v8::Isolate* isolate);
@ -49,9 +50,9 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
#if defined(OS_WIN)
bool IsAeroGlassEnabled();
typedef HRESULT (STDAPICALLTYPE *DwmGetColorizationColor)(DWORD *, BOOL *);
typedef HRESULT(STDAPICALLTYPE* DwmGetColorizationColor)(DWORD*, BOOL*);
DwmGetColorizationColor dwmGetColorizationColor =
(DwmGetColorizationColor) GetProcAddress(LoadLibraryW(L"dwmapi.dll"),
(DwmGetColorizationColor)GetProcAddress(LoadLibraryW(L"dwmapi.dll"),
"DwmGetColorizationColor");
std::string GetAccentColor();
@ -66,8 +67,8 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
void OnFinishLaunching(const base::DictionaryValue& launch_info) override;
#elif defined(OS_MACOSX)
using NotificationCallback = base::Callback<
void(const std::string&, const base::DictionaryValue&)>;
using NotificationCallback =
base::Callback<void(const std::string&, const base::DictionaryValue&)>;
void PostNotification(const std::string& name,
const base::DictionaryValue& user_info);
@ -113,11 +114,15 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
private:
#if defined(OS_WIN)
// Static callback invoked when a message comes in to our messaging window.
static LRESULT CALLBACK
WndProcStatic(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
static LRESULT CALLBACK WndProcStatic(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam);
LRESULT CALLBACK
WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK WndProc(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam);
// The window class of |window_|.
ATOM atom_;

View file

@ -68,9 +68,9 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
void OnTouchBarItemResult(const std::string& item_id,
const base::DictionaryValue& details) override;
void OnNewWindowForTab() override;
#if defined(OS_WIN)
#if defined(OS_WIN)
void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) override;
#endif
#endif
// Public APIs of NativeWindow.
void Close();
@ -107,9 +107,9 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
void SetResizable(bool resizable);
bool IsResizable();
void SetMovable(bool movable);
#if defined(OS_WIN) || defined(OS_MACOSX)
#if defined(OS_WIN) || defined(OS_MACOSX)
void MoveTop();
#endif
#endif
bool IsMovable();
void SetMinimizable(bool minimizable);
bool IsMinimizable();
@ -184,8 +184,8 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
void SetIcon(mate::Handle<NativeImage> icon);
#endif
#if defined(OS_WIN)
typedef base::Callback<void(v8::Local<v8::Value>,
v8::Local<v8::Value>)> MessageCallback;
typedef base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>)>
MessageCallback;
bool HookWindowMessage(UINT message, const MessageCallback& callback);
bool IsWindowMessageHooked(UINT message);
void UnhookWindowMessage(UINT message);

View file

@ -21,7 +21,7 @@ class Image;
namespace mate {
class Arguments;
class Dictionary;
}
} // namespace mate
namespace atom {
@ -32,8 +32,7 @@ namespace api {
class Menu;
class NativeImage;
class Tray : public mate::TrackableObject<Tray>,
public TrayIconObserver {
class Tray : public mate::TrackableObject<Tray>, public TrayIconObserver {
public:
static mate::WrappableBase* New(mate::Handle<NativeImage> image,
mate::Arguments* args);
@ -42,7 +41,8 @@ class Tray : public mate::TrackableObject<Tray>,
v8::Local<v8::FunctionTemplate> prototype);
protected:
Tray(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
Tray(v8::Isolate* isolate,
v8::Local<v8::Object> wrapper,
mate::Handle<NativeImage> image);
~Tray() override;

View file

@ -38,7 +38,7 @@ class ResourceRequestBody;
namespace mate {
class Arguments;
class Dictionary;
}
} // namespace mate
namespace atom {
@ -82,13 +82,16 @@ class WebContents : public mate::TrackableObject<WebContents>,
// Create from an existing WebContents.
static mate::Handle<WebContents> CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents);
v8::Isolate* isolate,
content::WebContents* web_contents);
static mate::Handle<WebContents> CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents, Type type);
v8::Isolate* isolate,
content::WebContents* web_contents,
Type type);
// Create a new WebContents.
static mate::Handle<WebContents> Create(
v8::Isolate* isolate, const mate::Dictionary& options);
static mate::Handle<WebContents> Create(v8::Isolate* isolate,
const mate::Dictionary& options);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
@ -133,8 +136,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
void DisableDeviceEmulation();
void InspectElement(int x, int y);
void InspectServiceWorker();
void HasServiceWorker(
const base::Callback<void(bool)>&);
void HasServiceWorker(const base::Callback<void(bool)>&);
void UnregisterServiceWorker(const base::Callback<void(bool)>&);
void SetIgnoreMenuShortcuts(bool ignore);
void SetAudioMuted(bool muted);
@ -221,8 +223,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
bool allowed);
// Create window with the given disposition.
void OnCreateWindow(
const GURL& target_url,
void OnCreateWindow(const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
@ -264,7 +265,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
~WebContents();
void InitWithSessionAndOptions(v8::Isolate* isolate,
content::WebContents *web_contents,
content::WebContents* web_contents,
mate::Handle<class Session> session,
const mate::Dictionary& options);
@ -274,14 +275,12 @@ class WebContents : public mate::TrackableObject<WebContents>,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;
void WebContentsCreated(
content::WebContents* source_contents,
void WebContentsCreated(content::WebContents* source_contents,
int opener_render_process_id,
int opener_render_frame_id,
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents)
override;
content::WebContents* new_contents) override;
void AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
@ -321,16 +320,14 @@ class WebContents : public mate::TrackableObject<WebContents>,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) override;
bool CheckMediaAccessPermission(
content::WebContents* web_contents,
bool CheckMediaAccessPermission(content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type) override;
void RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override;
void RequestToLockMouse(
content::WebContents* web_contents,
void RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) override;
std::unique_ptr<content::BluetoothChooser> RunBluetoothChooser(
@ -396,9 +393,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
struct FrameDispatchHelper;
AtomBrowserContext* GetBrowserContext() const;
uint32_t GetNextRequestId() {
return ++request_id_;
}
uint32_t GetNextRequestId() { return ++request_id_; }
#if defined(ENABLE_OSR)
OffScreenWebContentsView* GetOffScreenWebContentsView() const;

View file

@ -29,11 +29,11 @@ class WebRequest : public mate::TrackableObject<WebRequest> {
~WebRequest() override;
// C++ can not distinguish overloaded member function.
template<AtomNetworkDelegate::SimpleEvent type>
template <AtomNetworkDelegate::SimpleEvent type>
void SetSimpleListener(mate::Arguments* args);
template<AtomNetworkDelegate::ResponseEvent type>
template <AtomNetworkDelegate::ResponseEvent type>
void SetResponseListener(mate::Arguments* args);
template<typename Listener, typename Method, typename Event>
template <typename Listener, typename Method, typename Event>
void SetListener(Method method, Event type, mate::Arguments* args);
private:

View file

@ -15,8 +15,7 @@ class Message;
namespace mate {
class Event : public Wrappable<Event>,
public content::WebContentsObserver {
class Event : public Wrappable<Event>, public content::WebContentsObserver {
public:
static Handle<Event> Create(v8::Isolate* isolate);

View file

@ -26,8 +26,7 @@ v8::Local<v8::Object> CreateJSEvent(v8::Isolate* isolate,
v8::Local<v8::Object> object,
content::RenderFrameHost* sender,
IPC::Message* message);
v8::Local<v8::Object> CreateCustomEvent(
v8::Isolate* isolate,
v8::Local<v8::Object> CreateCustomEvent(v8::Isolate* isolate,
v8::Local<v8::Object> object,
v8::Local<v8::Object> event);
v8::Local<v8::Object> CreateEventFromFlags(v8::Isolate* isolate, int flags);
@ -35,7 +34,7 @@ v8::Local<v8::Object> CreateEventFromFlags(v8::Isolate* isolate, int flags);
} // namespace internal
// Provide helperers to emit event in JavaScript.
template<typename T>
template <typename T>
class EventEmitter : public Wrappable<T> {
public:
typedef std::vector<v8::Local<v8::Value>> ValueArray;
@ -48,27 +47,26 @@ class EventEmitter : public Wrappable<T> {
}
// this.emit(name, event, args...);
template<typename... Args>
template <typename... Args>
bool EmitCustomEvent(const base::StringPiece& name,
v8::Local<v8::Object> event,
const Args&... args) {
return EmitWithEvent(
name,
internal::CreateCustomEvent(isolate(), GetWrapper(), event), args...);
name, internal::CreateCustomEvent(isolate(), GetWrapper(), event),
args...);
}
// this.emit(name, new Event(flags), args...);
template<typename... Args>
template <typename... Args>
bool EmitWithFlags(const base::StringPiece& name,
int flags,
const Args&... args) {
return EmitCustomEvent(
name,
internal::CreateEventFromFlags(isolate(), flags), args...);
name, internal::CreateEventFromFlags(isolate(), flags), args...);
}
// this.emit(name, new Event(), args...);
template<typename... Args>
template <typename... Args>
bool Emit(const base::StringPiece& name, const Args&... args) {
return EmitWithSender(name, nullptr, nullptr, args...);
}
@ -85,8 +83,8 @@ class EventEmitter : public Wrappable<T> {
if (wrapper.IsEmpty()) {
return false;
}
v8::Local<v8::Object> event = internal::CreateJSEvent(
isolate(), wrapper, sender, message);
v8::Local<v8::Object> event =
internal::CreateJSEvent(isolate(), wrapper, sender, message);
return EmitWithEvent(name, event, args...);
}
@ -95,15 +93,15 @@ class EventEmitter : public Wrappable<T> {
private:
// this.emit(name, event, args...);
template<typename... Args>
template <typename... Args>
bool EmitWithEvent(const base::StringPiece& name,
v8::Local<v8::Object> event,
const Args&... args) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(), name, event, args...);
return event->Get(
StringToV8(isolate(), "defaultPrevented"))->BooleanValue();
return event->Get(StringToV8(isolate(), "defaultPrevented"))
->BooleanValue();
}
DISALLOW_COPY_AND_ASSIGN(EventEmitter);

View file

@ -51,7 +51,7 @@ class TrackableObjectBase {
// All instances of TrackableObject will be kept in a weak map and can be got
// from its ID.
template<typename T>
template <typename T>
class TrackableObject : public TrackableObjectBase,
public mate::EventEmitter<T> {
public:
@ -107,13 +107,9 @@ class TrackableObject : public TrackableObjectBase,
}
protected:
TrackableObject() {
weak_map_id_ = ++next_id_;
}
TrackableObject() { weak_map_id_ = ++next_id_; }
~TrackableObject() override {
RemoveFromWeakMap();
}
~TrackableObject() override { RemoveFromWeakMap(); }
void InitWith(v8::Isolate* isolate, v8::Local<v8::Object> wrapper) override {
WrappableBase::InitWith(isolate, wrapper);
@ -130,10 +126,10 @@ class TrackableObject : public TrackableObjectBase,
DISALLOW_COPY_AND_ASSIGN(TrackableObject);
};
template<typename T>
template <typename T>
int32_t TrackableObject<T>::next_id_ = 0;
template<typename T>
template <typename T>
atom::KeyWeakMap<int32_t>* TrackableObject<T>::weak_map_ = nullptr;
} // namespace mate

View file

@ -21,13 +21,13 @@ namespace storage {
class BlobDataHandle;
class BlobReader;
class FileSystemContext;
}
} // namespace storage
namespace v8 {
template <class T>
class Local;
class Value;
}
} // namespace v8
namespace atom {
@ -41,8 +41,7 @@ class AtomBlobReader {
storage::FileSystemContext* file_system_context);
~AtomBlobReader();
void StartReading(
const std::string& uuid,
void StartReading(const std::string& uuid,
const AtomBlobReader::CompletionCallback& callback);
private:

View file

@ -17,7 +17,7 @@
namespace content {
class QuotaPermissionContext;
class ClientCertificateDelegate;
}
} // namespace content
namespace net {
class SSLCertRequestInfo;
@ -84,8 +84,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
net::ClientCertIdentityList client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
void ResourceDispatcherHostCreated() override;
bool CanCreateWindow(
content::RenderFrameHost* opener,
bool CanCreateWindow(content::RenderFrameHost* opener,
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,

View file

@ -26,7 +26,8 @@ class AtomBrowserContext : public brightray::BrowserContext {
// |in_memory|. The |options| will be passed to constructor when there is no
// existing BrowserContext.
static scoped_refptr<AtomBrowserContext> From(
const std::string& partition, bool in_memory,
const std::string& partition,
bool in_memory,
const base::DictionaryValue& options = base::DictionaryValue());
void SetUserAgent(const std::string& user_agent);
@ -67,7 +68,8 @@ class AtomBrowserContext : public brightray::BrowserContext {
}
protected:
AtomBrowserContext(const std::string& partition, bool in_memory,
AtomBrowserContext(const std::string& partition,
bool in_memory,
const base::DictionaryValue& options);
~AtomBrowserContext() override;

View file

@ -21,16 +21,14 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
explicit AtomJavaScriptDialogManager(api::WebContents* api_web_contents);
// content::JavaScriptDialogManager implementations.
void RunJavaScriptDialog(
content::WebContents* web_contents,
void RunJavaScriptDialog(content::WebContents* web_contents,
const GURL& origin_url,
content::JavaScriptDialogType dialog_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
DialogClosedCallback callback,
bool* did_suppress_message) override;
void RunBeforeUnloadDialog(
content::WebContents* web_contents,
void RunBeforeUnloadDialog(content::WebContents* web_contents,
bool is_reload,
DialogClosedCallback callback) override;
void CancelDialogs(content::WebContents* web_contents,

View file

@ -24,12 +24,10 @@ class AtomPermissionManager : public content::PermissionManager {
AtomPermissionManager();
~AtomPermissionManager() override;
using StatusCallback =
base::Callback<void(blink::mojom::PermissionStatus)>;
using StatusCallback = base::Callback<void(blink::mojom::PermissionStatus)>;
using StatusesCallback =
base::Callback<void(const std::vector<blink::mojom::PermissionStatus>&)>;
using RequestHandler =
base::Callback<void(content::WebContents*,
using RequestHandler = base::Callback<void(content::WebContents*,
content::PermissionType,
const StatusCallback&,
const base::DictionaryValue&)>;
@ -57,8 +55,8 @@ class AtomPermissionManager : public content::PermissionManager {
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<blink::mojom::PermissionStatus>&)>& callback)
const base::Callback<
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
override;
int RequestPermissionsWithDetails(
const std::vector<content::PermissionType>& permissions,
@ -66,8 +64,8 @@ class AtomPermissionManager : public content::PermissionManager {
const GURL& requesting_origin,
bool user_gesture,
const base::DictionaryValue* details,
const base::Callback<void(
const std::vector<blink::mojom::PermissionStatus>&)>& callback);
const base::Callback<
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback);
protected:
void OnPermissionResponse(int request_id,

View file

@ -17,8 +17,7 @@ class AtomQuotaPermissionContext : public content::QuotaPermissionContext {
virtual ~AtomQuotaPermissionContext();
// content::QuotaPermissionContext:
void RequestQuotaPermission(
const content::StorageQuotaParams& params,
void RequestQuotaPermission(const content::StorageQuotaParams& params,
int render_process_id,
const PermissionCallback& callback) override;

View file

@ -29,10 +29,13 @@ class AtomSpeechRecognitionManagerDelegate
void OnAudioEnd(int session_id) override;
void OnRecognitionEnd(int session_id) override;
void OnRecognitionResults(
int session_id, const content::SpeechRecognitionResults& result) override;
int session_id,
const content::SpeechRecognitionResults& result) override;
void OnRecognitionError(
int session_id, const content::SpeechRecognitionError& error) override;
void OnAudioLevelsChange(int session_id, float volume,
int session_id,
const content::SpeechRecognitionError& error) override;
void OnAudioLevelsChange(int session_id,
float volume,
float noise_volume) override;
// content::SpeechRecognitionManagerDelegate:

View file

@ -23,7 +23,8 @@ class Delegate {
// An error happened.
virtual void OnError(const std::string& error) {}
virtual void OnError(const std::string& error, const int code,
virtual void OnError(const std::string& error,
const int code,
const std::string& domain) {}
// Checking to see if there is an update

View file

@ -29,14 +29,13 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner {
base::OnceClosure task,
base::TimeDelta delay) override;
bool RunsTasksInCurrentSequence() const override;
bool PostNonNestableDelayedTask(
const base::Location& from_here,
bool PostNonNestableDelayedTask(const base::Location& from_here,
base::OnceClosure task,
base::TimeDelta delay) override;
private:
using TaskPair = std::tuple<
base::Location, base::OnceClosure, base::TimeDelta>;
using TaskPair =
std::tuple<base::Location, base::OnceClosure, base::TimeDelta>;
std::vector<TaskPair> tasks_;
std::vector<TaskPair> non_nestable_tasks_;

View file

@ -229,13 +229,9 @@ class Browser : public WindowListObserver {
void PreMainMessageLoopRun();
void AddObserver(BrowserObserver* obs) {
observers_.AddObserver(obs);
}
void AddObserver(BrowserObserver* obs) { observers_.AddObserver(obs); }
void RemoveObserver(BrowserObserver* obs) {
observers_.RemoveObserver(obs);
}
void RemoveObserver(BrowserObserver* obs) { observers_.RemoveObserver(obs); }
bool is_shutting_down() const { return is_shutdown_; }
bool is_quiting() const { return is_quiting_; }

View file

@ -34,8 +34,8 @@ class BrowserObserver {
// The browser has opened a file by double clicking in Finder or dragging the
// file to the Dock icon. (macOS only)
virtual void OnOpenFile(bool* prevent_default,
const std::string& file_path) {}
virtual void OnOpenFile(bool* prevent_default, const std::string& file_path) {
}
// Browser is used to open a url.
virtual void OnOpenURL(const std::string& url) {}
@ -60,16 +60,13 @@ class BrowserObserver {
#if defined(OS_MACOSX)
// The browser wants to report that an user activity will resume. (macOS only)
virtual void OnWillContinueUserActivity(
bool* prevent_default,
virtual void OnWillContinueUserActivity(bool* prevent_default,
const std::string& type) {}
// The browser wants to report an user activity resuming error. (macOS only)
virtual void OnDidFailToContinueUserActivity(
const std::string& type,
virtual void OnDidFailToContinueUserActivity(const std::string& type,
const std::string& error) {}
// The browser wants to resume a user activity via handoff. (macOS only)
virtual void OnContinueUserActivity(
bool* prevent_default,
virtual void OnContinueUserActivity(bool* prevent_default,
const std::string& type,
const base::DictionaryValue& user_info) {}
// The browser wants to notify that an user activity was resumed. (macOS only)

View file

@ -92,8 +92,7 @@ class CommonWebContentsDelegate
// Autofill related events.
#if defined(TOOLKIT_VIEWS)
void ShowAutofillPopup(
bool offscreen,
void ShowAutofillPopup(bool offscreen,
content::RenderFrameHost* frame_host,
const gfx::RectF& bounds,
const std::vector<base::string16>& values,
@ -123,8 +122,8 @@ class CommonWebContentsDelegate
gfx::ImageSkia GetDevToolsWindowIcon() override;
#endif
#if defined(USE_X11)
void GetDevToolsWindowWMClass(
std::string* name, std::string* class_name) override;
void GetDevToolsWindowWMClass(std::string* name,
std::string* class_name) override;
#endif
// Destroy the managed InspectableWebContents object.
@ -187,9 +186,8 @@ class CommonWebContentsDelegate
PathsMap saved_files_;
// Map id to index job, used for file system indexing requests from devtools.
typedef std::map<
int,
scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>>
typedef std::
map<int, scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>>
DevToolsIndexingJobsMap;
DevToolsIndexingJobsMap devtools_indexing_jobs_;

View file

@ -11,7 +11,7 @@
namespace node {
class Environment;
class MultiIsolatePlatform;
}
} // namespace node
namespace atom {

View file

@ -16,7 +16,7 @@ class WebContents;
namespace net {
class AuthChallengeInfo;
class URLRequest;
}
} // namespace net
namespace atom {

View file

@ -3,10 +3,10 @@
// found in the LICENSE file.
#include "base/callback.h"
#include "base/mac/scoped_sending_event.h"
#include "base/mac/scoped_nsobject.h"
#include "base/mac/scoped_sending_event.h"
@interface AtomApplication : NSApplication<CrAppProtocol,
@interface AtomApplication : NSApplication <CrAppProtocol,
CrAppControlProtocol,
NSUserActivityDelegate> {
@private

View file

@ -6,7 +6,7 @@
#import "atom/browser/ui/cocoa/atom_menu_controller.h"
@interface AtomApplicationDelegate : NSObject<NSApplicationDelegate> {
@interface AtomApplicationDelegate : NSObject <NSApplicationDelegate> {
@private
base::scoped_nsobject<AtomMenuController> menu_controller_;
}

View file

@ -15,7 +15,7 @@
namespace brightray {
class InspectableWebContents;
class InspectableWebContentsView;
}
} // namespace brightray
namespace gfx {
class Rect;

View file

@ -33,12 +33,12 @@ class Point;
class Rect;
class RectF;
class Size;
}
} // namespace gfx
namespace mate {
class Dictionary;
class PersistentDictionary;
}
} // namespace mate
namespace atom {
@ -161,8 +161,7 @@ class NativeWindow : public base::SupportsUserData {
PROGRESS_NORMAL, // progress, not marked (green)
};
virtual void SetProgressBar(double progress,
const ProgressState state) = 0;
virtual void SetProgressBar(double progress, const ProgressState state) = 0;
virtual void SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) = 0;
@ -251,13 +250,11 @@ class NativeWindow : public base::SupportsUserData {
const base::DictionaryValue& details);
void NotifyNewWindowForTab();
#if defined(OS_WIN)
#if defined(OS_WIN)
void NotifyWindowMessage(UINT message, WPARAM w_param, LPARAM l_param);
#endif
#endif
void AddObserver(NativeWindowObserver* obs) {
observers_.AddObserver(obs);
}
void AddObserver(NativeWindowObserver* obs) { observers_.AddObserver(obs); }
void RemoveObserver(NativeWindowObserver* obs) {
observers_.RemoveObserver(obs);
}
@ -273,8 +270,7 @@ class NativeWindow : public base::SupportsUserData {
bool is_modal() const { return is_modal_; }
protected:
NativeWindow(const mate::Dictionary& options,
NativeWindow* parent);
NativeWindow(const mate::Dictionary& options, NativeWindow* parent);
void set_browser_view(NativeBrowserView* browser_view) {
browser_view_ = browser_view;
@ -324,8 +320,8 @@ class NativeWindow : public base::SupportsUserData {
};
// This class provides a hook to get a NativeWindow from a WebContents.
class NativeWindowRelay :
public content::WebContentsUserData<NativeWindowRelay> {
class NativeWindowRelay
: public content::WebContentsUserData<NativeWindowRelay> {
public:
explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window)
: key(UserDataKey()), window(window) {}

View file

@ -21,8 +21,7 @@ namespace atom {
class NativeWindowMac : public NativeWindow {
public:
NativeWindowMac(const mate::Dictionary& options,
NativeWindow* parent);
NativeWindowMac(const mate::Dictionary& options, NativeWindow* parent);
~NativeWindowMac() override;
// NativeWindow:
@ -53,10 +52,10 @@ class NativeWindowMac : public NativeWindow {
void MoveTop() override;
bool IsResizable() override;
void SetMovable(bool movable) override;
void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size)
override;
void PreviewFile(const std::string& path, const std::string& display_name)
override;
void SetAspectRatio(double aspect_ratio,
const gfx::Size& extra_size) override;
void PreviewFile(const std::string& path,
const std::string& display_name) override;
void CloseFilePreview() override;
bool IsMovable() override;
void SetMinimizable(bool minimizable) override;
@ -67,8 +66,10 @@ class NativeWindowMac : public NativeWindow {
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top, const std::string& level,
int relativeLevel, std::string* error) override;
void SetAlwaysOnTop(bool top,
const std::string& level,
int relativeLevel,
std::string* error) override;
bool IsAlwaysOnTop() override;
void Center() override;
void Invalidate() override;

View file

@ -79,10 +79,10 @@ class NativeWindowObserver {
const base::DictionaryValue& details) {}
virtual void OnNewWindowForTab() {}
// Called when window message received
#if defined(OS_WIN)
// Called when window message received
#if defined(OS_WIN)
virtual void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {}
#endif
#endif
// Called on Windows when App Commands arrive (WM_APPCOMMAND)
virtual void OnExecuteWindowsCommand(const std::string& command_name) {}

View file

@ -16,11 +16,11 @@
#include "ui/views/widget/widget_observer.h"
#if defined(OS_WIN)
#include <UIAutomationCoreApi.h>
#include "atom/browser/ui/win/message_handler_delegate.h"
#include "atom/browser/ui/win/taskbar_host.h"
#include "base/win/scoped_gdi_object.h"
#include "ui/base/win/accessibility_misc_utils.h"
#include <UIAutomationCoreApi.h>
#endif
namespace views {
@ -46,8 +46,7 @@ class NativeWindowViews : public NativeWindow,
public views::WidgetDelegateView,
public views::WidgetObserver {
public:
NativeWindowViews(const mate::Dictionary& options,
NativeWindow* parent);
NativeWindowViews(const mate::Dictionary& options, NativeWindow* parent);
~NativeWindowViews() override;
// NativeWindow:
@ -91,8 +90,10 @@ class NativeWindowViews : public NativeWindow,
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top, const std::string& level,
int relativeLevel, std::string* error) override;
void SetAlwaysOnTop(bool top,
const std::string& level,
int relativeLevel,
std::string* error) override;
bool IsAlwaysOnTop() override;
void Center() override;
void Invalidate() override;
@ -150,10 +151,9 @@ class NativeWindowViews : public NativeWindow,
private:
// views::WidgetObserver:
void OnWidgetActivationChanged(
views::Widget* widget, bool active) override;
void OnWidgetBoundsChanged(
views::Widget* widget, const gfx::Rect& bounds) override;
void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
void OnWidgetBoundsChanged(views::Widget* widget,
const gfx::Rect& bounds) override;
// views::WidgetDelegate:
void DeleteDelegate() override;
@ -179,15 +179,21 @@ class NativeWindowViews : public NativeWindow,
#if defined(OS_WIN)
// MessageHandlerDelegate:
bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
bool PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result) override;
void HandleSizeEvent(WPARAM w_param, LPARAM l_param);
void SetForwardMouseMessages(bool forward);
static LRESULT CALLBACK SubclassProc(
HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param, UINT_PTR subclass_id,
static LRESULT CALLBACK SubclassProc(HWND hwnd,
UINT msg,
WPARAM w_param,
LPARAM l_param,
UINT_PTR subclass_id,
DWORD_PTR ref_data);
static LRESULT CALLBACK MouseHookProc(
int n_code, WPARAM w_param, LPARAM l_param);
static LRESULT CALLBACK MouseHookProc(int n_code,
WPARAM w_param,
LPARAM l_param);
#endif
// NativeWindow:

View file

@ -95,11 +95,11 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
private:
void OnErrorOccurred(net::URLRequest* request, bool started);
template<typename...Args>
template <typename... Args>
void HandleSimpleEvent(SimpleEvent type,
net::URLRequest* request,
Args... args);
template<typename Out, typename... Args>
template <typename Out, typename... Args>
int HandleResponseEvent(ResponseEvent type,
net::URLRequest* request,
const net::CompletionCallback& callback,
@ -107,12 +107,14 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
Args... args);
// Deal with the results of Listener.
template<typename T>
void OnListenerResultInIO(
uint64_t id, T out, std::unique_ptr<base::DictionaryValue> response);
template<typename T>
void OnListenerResultInUI(
uint64_t id, T out, const base::DictionaryValue& response);
template <typename T>
void OnListenerResultInIO(uint64_t id,
T out,
std::unique_ptr<base::DictionaryValue> response);
template <typename T>
void OnListenerResultInUI(uint64_t id,
T out,
const base::DictionaryValue& response);
std::map<SimpleEvent, SimpleListenerInfo> simple_listeners_;
std::map<ResponseEvent, ResponseListenerInfo> response_listeners_;

View file

@ -30,8 +30,7 @@ class AtomURLRequestJobFactory : public net::URLRequestJobFactory {
std::unique_ptr<ProtocolHandler> protocol_handler);
// Intercepts the ProtocolHandler for a scheme.
bool InterceptProtocol(
const std::string& scheme,
bool InterceptProtocol(const std::string& scheme,
std::unique_ptr<ProtocolHandler> protocol_handler);
bool UninterceptProtocol(const std::string& scheme);
@ -65,8 +64,8 @@ class AtomURLRequestJobFactory : public net::URLRequestJobFactory {
ProtocolHandlerMap protocol_handler_map_;
// Map that stores the original protocols of schemes.
using OriginalProtocolsMap = std::unordered_map<
std::string, std::unique_ptr<ProtocolHandler>>;
using OriginalProtocolsMap =
std::unordered_map<std::string, std::unique_ptr<ProtocolHandler>>;
// Can only be accessed in IO thread.
OriginalProtocolsMap original_protocols_;

View file

@ -42,15 +42,14 @@ bool IsErrorOptions(base::Value* value, int* error);
} // namespace internal
template<typename RequestJob>
template <typename RequestJob>
class JsAsker : public RequestJob {
public:
JsAsker(net::URLRequest* request, net::NetworkDelegate* network_delegate)
: RequestJob(request, network_delegate), weak_factory_(this) {}
// Called by |CustomProtocolHandler| to store handler related information.
void SetHandlerInfo(
v8::Isolate* isolate,
void SetHandlerInfo(v8::Isolate* isolate,
net::URLRequestContextGetter* request_context_getter,
const JavaScriptHandler& handler) {
isolate_ = isolate;
@ -75,14 +74,11 @@ class JsAsker : public RequestJob {
FillRequestDetails(request_details.get(), RequestJob::request());
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&internal::AskForOptions,
isolate_,
handler_,
base::Bind(
&internal::AskForOptions, isolate_, handler_,
base::Passed(&request_details),
base::Bind(&JsAsker::BeforeStartInUI,
weak_factory_.GetWeakPtr()),
base::Bind(&JsAsker::OnResponse,
weak_factory_.GetWeakPtr())));
base::Bind(&JsAsker::BeforeStartInUI, weak_factory_.GetWeakPtr()),
base::Bind(&JsAsker::OnResponse, weak_factory_.GetWeakPtr())));
}
int GetResponseCode() const override { return net::HTTP_OK; }

View file

@ -43,8 +43,10 @@ class URLRequestFetchJob : public JsAsker<net::URLRequestJob>,
void OnURLFetchComplete(const net::URLFetcher* source) override;
private:
int BufferCopy(net::IOBuffer* source, int num_bytes,
net::IOBuffer* target, int target_size);
int BufferCopy(net::IOBuffer* source,
int num_bytes,
net::IOBuffer* target,
int target_size);
void ClearPendingBuffer();
void ClearWriteBuffer();

View file

@ -10,7 +10,7 @@
namespace node {
class Environment;
class MultiIsolatePlatform;
}
} // namespace node
namespace atom {

View file

@ -30,8 +30,8 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_view.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer_delegate.h"
@ -88,8 +88,8 @@ class OffScreenRenderWidgetHostView
bool OnMessageReceived(const IPC::Message&) override;
void InitAsChild(gfx::NativeView) override;
content::RenderWidgetHost* GetRenderWidgetHost(void) const override;
void SetSize(const gfx::Size &) override;
void SetBounds(const gfx::Rect &) override;
void SetSize(const gfx::Size&) override;
void SetBounds(const gfx::Rect&) override;
gfx::Vector2dF GetLastScrollOffset(void) const override;
gfx::NativeView GetNativeView(void) const override;
gfx::NativeViewAccessible GetNativeViewAccessible(void) override;
@ -126,25 +126,24 @@ class OffScreenRenderWidgetHostView
viz::CompositorFrame frame) override;
void ClearCompositorFrame(void) override;
void InitAsPopup(content::RenderWidgetHostView *rwhv, const gfx::Rect& rect)
override;
void InitAsFullscreen(content::RenderWidgetHostView *) override;
void UpdateCursor(const content::WebCursor &) override;
void InitAsPopup(content::RenderWidgetHostView* rwhv,
const gfx::Rect& rect) override;
void InitAsFullscreen(content::RenderWidgetHostView*) override;
void UpdateCursor(const content::WebCursor&) override;
void SetIsLoading(bool is_loading) override;
void TextInputStateChanged(const content::TextInputState& params) override;
void ImeCancelComposition(void) override;
void RenderProcessGone(base::TerminationStatus, int) override;
void Destroy(void) override;
void SetTooltipText(const base::string16 &) override;
void SetTooltipText(const base::string16&) override;
#if defined(OS_MACOSX)
void SelectionChanged(const base::string16& text,
size_t offset,
const gfx::Range& range) override;
#endif
void SelectionBoundsChanged(const ViewHostMsg_SelectionBounds_Params &)
override;
void CopyFromSurface(
const gfx::Rect& src_subrect,
void SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params&) override;
void CopyFromSurface(const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
const content::ReadbackRequestCallback& callback,
const SkColorType color_type) override;
@ -155,13 +154,12 @@ class OffScreenRenderWidgetHostView
void BeginFrameSubscription(
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber>) override;
void EndFrameSubscription() override;
void InitAsGuest(
content::RenderWidgetHostView*,
void InitAsGuest(content::RenderWidgetHostView*,
content::RenderWidgetHostViewGuest*) override;
bool HasAcceleratedSurface(const gfx::Size &) override;
bool HasAcceleratedSurface(const gfx::Size&) override;
gfx::Rect GetBoundsInRootWindow(void) override;
void ImeCompositionRangeChanged(
const gfx::Range &, const std::vector<gfx::Rect>&) override;
void ImeCompositionRangeChanged(const gfx::Range&,
const std::vector<gfx::Rect>&) override;
gfx::Size GetPhysicalBackingSize() const override;
gfx::Size GetRequestedRendererSize() const override;
@ -173,7 +171,7 @@ class OffScreenRenderWidgetHostView
#if !defined(OS_MACOSX)
// content::DelegatedFrameHostClient:
int DelegatedFrameHostGetGpuMemoryBufferClientId(void) const;
ui::Layer *DelegatedFrameHostGetLayer(void) const override;
ui::Layer* DelegatedFrameHostGetLayer(void) const override;
bool DelegatedFrameHostIsVisible(void) const override;
SkColor DelegatedFrameHostGetGutterColor(SkColor) const override;
gfx::Size DelegatedFrameHostDesiredSizeInDIP(void) const override;
@ -188,8 +186,7 @@ class OffScreenRenderWidgetHostView
void CompositorResizeLockEnded() override;
#endif // !defined(OS_MACOSX)
bool TransformPointToLocalCoordSpace(
const gfx::Point& point,
bool TransformPointToLocalCoordSpace(const gfx::Point& point,
const viz::SurfaceId& original_surface,
gfx::Point* transformed_point) override;
bool TransformPointToCoordSpaceForView(
@ -209,8 +206,7 @@ class OffScreenRenderWidgetHostView
void OnWindowClosed() override;
void OnBeginFrameTimerTick();
void SendBeginFrame(base::TimeTicks frame_time,
base::TimeDelta vsync_period);
void SendBeginFrame(base::TimeTicks frame_time, base::TimeDelta vsync_period);
#if defined(OS_MACOSX)
void CreatePlatformWidget(bool is_guest_view_hack);
@ -233,16 +229,13 @@ class OffScreenRenderWidgetHostView
void OnPopupPaint(const gfx::Rect& damage_rect, const SkBitmap& bitmap);
void OnProxyViewPaint(const gfx::Rect& damage_rect);
bool IsPopupWidget() const {
return popup_type_ != blink::kWebPopupTypeNone;
}
bool IsPopupWidget() const { return popup_type_ != blink::kWebPopupTypeNone; }
void HoldResize();
void ReleaseResize();
void WasResized();
void ProcessKeyboardEvent(
const content::NativeWebKeyboardEvent& event,
void ProcessKeyboardEvent(const content::NativeWebKeyboardEvent& event,
const ui::LatencyInfo& latency) override;
void ProcessMouseEvent(const blink::WebMouseEvent& event,
const ui::LatencyInfo& latency) override;
@ -262,8 +255,9 @@ class OffScreenRenderWidgetHostView
void Invalidate();
void InvalidateBounds(const gfx::Rect&);
content::RenderWidgetHostImpl* render_widget_host() const
{ return render_widget_host_; }
content::RenderWidgetHostImpl* render_widget_host() const {
return render_widget_host_;
}
NativeWindow* window() const { return native_window_; }
gfx::Size size() const { return size_; }
float scale_factor() const { return scale_factor_; }
@ -276,9 +270,7 @@ class OffScreenRenderWidgetHostView
child_host_view_ = child_view;
}
viz::LocalSurfaceId local_surface_id() const {
return local_surface_id_;
}
viz::LocalSurfaceId local_surface_id() const { return local_surface_id_; }
private:
void SetupFrameRate(bool force);

View file

@ -39,6 +39,7 @@ class OffscreenViewProxy {
void OnEvent(ui::Event* event);
void ResetView() { view_ = nullptr; }
private:
views::View* view_;

View file

@ -40,8 +40,8 @@ class OffScreenWebContentsView : public content::WebContentsView,
void RestoreFocus() override;
content::DropData* GetDropData() const override;
gfx::Rect GetViewBounds() const override;
void CreateView(
const gfx::Size& initial_size, gfx::NativeView context) override;
void CreateView(const gfx::Size& initial_size,
gfx::NativeView context) override;
content::RenderWidgetHostViewBase* CreateViewForWidget(
content::RenderWidgetHost* render_widget_host,
bool is_guest_view_hack) override;

View file

@ -21,8 +21,8 @@ class SessionPreferences : public base::SupportsUserData::Data {
public:
static SessionPreferences* FromBrowserContext(
content::BrowserContext* context);
static void AppendExtraCommandLineSwitches(
content::BrowserContext* context, base::CommandLine* command_line);
static void AppendExtraCommandLineSwitches(content::BrowserContext* context,
base::CommandLine* command_line);
explicit SessionPreferences(content::BrowserContext* context);
~SessionPreferences() override;

View file

@ -13,7 +13,10 @@
namespace accelerator_util {
typedef struct { int position; atom::AtomMenuModel* model; } MenuItem;
typedef struct {
int position;
atom::AtomMenuModel* model;
} MenuItem;
typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
// Parse a string as an accelerator.

View file

@ -27,8 +27,8 @@ class AtomMenuModel : public ui::SimpleMenuModel {
// ui::SimpleMenuModel::Delegate:
bool GetAcceleratorForCommandId(int command_id,
ui::Accelerator* accelerator) const {
return GetAcceleratorForCommandIdWithParams(
command_id, false, accelerator);
return GetAcceleratorForCommandIdWithParams(command_id, false,
accelerator);
}
};

View file

@ -9,7 +9,7 @@
#import <Cocoa/Cocoa.h>
@interface NSColor(Hex)
@interface NSColor (Hex)
+ (NSColor*)colorWithHexColorString:(NSString*)hex;
@end

View file

@ -9,7 +9,7 @@
#import <Foundation/Foundation.h>
@interface NSString(ANSI)
@interface NSString (ANSI)
- (BOOL)containsANSICodes;
- (NSMutableAttributedString*)attributedStringParsingANSICodes;
@end

View file

@ -26,7 +26,8 @@ class AtomBundleMover {
static void Relaunch(NSString* destinationPath);
static NSString* ShellQuotedString(NSString* string);
static bool CopyBundle(NSString* srcPath, NSString* dstPath);
static bool AuthorizedInstall(NSString* srcPath, NSString* dstPath,
static bool AuthorizedInstall(NSString* srcPath,
NSString* dstPath,
bool* canceled);
static bool IsApplicationAtPathRunning(NSString* bundlePath);
static bool DeleteOrTrash(NSString* path);

View file

@ -22,7 +22,7 @@ class AtomMenuModel;
// allow for hierarchical menus). The tag is the index into that model for
// that particular item. It is important that the model outlives this object
// as it only maintains weak references.
@interface AtomMenuController : NSObject<NSMenuDelegate> {
@interface AtomMenuController : NSObject <NSMenuDelegate> {
@protected
atom::AtomMenuModel* model_; // weak
base::scoped_nsobject<NSMenu> menu_;

View file

@ -17,7 +17,9 @@
#include "native_mate/constructor.h"
#include "native_mate/persistent_dictionary.h"
@interface AtomTouchBar : NSObject<NSScrubberDelegate, NSScrubberDataSource, NSScrubberFlowLayoutDelegate> {
@interface AtomTouchBar : NSObject <NSScrubberDelegate,
NSScrubberDataSource,
NSScrubberFlowLayoutDelegate> {
@protected
std::vector<mate::PersistentDictionary> ordered_settings_;
std::map<std::string, mate::PersistentDictionary> settings_;
@ -25,18 +27,25 @@
atom::NativeWindow* window_;
}
- (id)initWithDelegate:(id<NSTouchBarDelegate>)delegate window:(atom::NativeWindow*)window settings:(const std::vector<mate::PersistentDictionary>&)settings;
- (id)initWithDelegate:(id<NSTouchBarDelegate>)delegate
window:(atom::NativeWindow*)window
settings:(const std::vector<mate::PersistentDictionary>&)settings;
- (NSTouchBar*)makeTouchBar;
- (NSTouchBar*)touchBarFromItemIdentifiers:(NSMutableArray*)items;
- (NSMutableArray*)identifiersFromSettings:(const std::vector<mate::PersistentDictionary>&)settings;
- (void)refreshTouchBarItem:(NSTouchBar*)touchBar id:(const std::string&)item_id;
- (void)addNonDefaultTouchBarItems:(const std::vector<mate::PersistentDictionary>&)items;
- (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item forTouchBar:(NSTouchBar*)touchBar;
- (NSMutableArray*)identifiersFromSettings:
(const std::vector<mate::PersistentDictionary>&)settings;
- (void)refreshTouchBarItem:(NSTouchBar*)touchBar
id:(const std::string&)item_id;
- (void)addNonDefaultTouchBarItems:
(const std::vector<mate::PersistentDictionary>&)items;
- (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item
forTouchBar:(NSTouchBar*)touchBar;
- (NSString*)idFromIdentifier:(NSString*)identifier withPrefix:(NSString*)prefix;
- (NSTouchBarItemIdentifier)identifierFromID:(const std::string&)item_id type:(const std::string&)typere;
- (NSString*)idFromIdentifier:(NSString*)identifier
withPrefix:(NSString*)prefix;
- (NSTouchBarItemIdentifier)identifierFromID:(const std::string&)item_id
type:(const std::string&)typere;
- (bool)hasItemWithID:(const std::string&)item_id;
- (NSColor*)colorFromHexColorString:(const std::string&)colorString;
@ -47,19 +56,30 @@
// Helpers to create touch bar items
- (NSTouchBarItem*)makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier;
- (NSTouchBarItem*)makeButtonForID:(NSString*)id withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeLabelForID:(NSString*)id withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeColorPickerForID:(NSString*)id withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeSliderForID:(NSString*)id withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makePopoverForID:(NSString*)id withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeGroupForID:(NSString*)id withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeButtonForID:(NSString*)id
withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeLabelForID:(NSString*)id
withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeColorPickerForID:(NSString*)id
withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeSliderForID:(NSString*)id
withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makePopoverForID:(NSString*)id
withIdentifier:(NSString*)identifier;
- (NSTouchBarItem*)makeGroupForID:(NSString*)id
withIdentifier:(NSString*)identifier;
// Helpers to update touch bar items
- (void)updateButton:(NSCustomTouchBarItem*)item withSettings:(const mate::PersistentDictionary&)settings;
- (void)updateLabel:(NSCustomTouchBarItem*)item withSettings:(const mate::PersistentDictionary&)settings;
- (void)updateColorPicker:(NSColorPickerTouchBarItem*)item withSettings:(const mate::PersistentDictionary&)settings;
- (void)updateSlider:(NSSliderTouchBarItem*)item withSettings:(const mate::PersistentDictionary&)settings;
- (void)updatePopover:(NSPopoverTouchBarItem*)item withSettings:(const mate::PersistentDictionary&)settings;
- (void)updateButton:(NSCustomTouchBarItem*)item
withSettings:(const mate::PersistentDictionary&)settings;
- (void)updateLabel:(NSCustomTouchBarItem*)item
withSettings:(const mate::PersistentDictionary&)settings;
- (void)updateColorPicker:(NSColorPickerTouchBarItem*)item
withSettings:(const mate::PersistentDictionary&)settings;
- (void)updateSlider:(NSSliderTouchBarItem*)item
withSettings:(const mate::PersistentDictionary&)settings;
- (void)updatePopover:(NSPopoverTouchBarItem*)item
withSettings:(const mate::PersistentDictionary&)settings;
@end

View file

@ -14,18 +14,18 @@
#pragma clang assume_nonnull begin
@class NSTouchBar, NSTouchBarItem;
@class NSScrubber, NSScrubberItemView, NSScrubberArrangedView, NSScrubberTextItemView, NSScrubberImageItemView, NSScrubberSelectionStyle;
@protocol NSTouchBarDelegate, NSScrubberDelegate, NSScrubberDataSource, NSScrubberFlowLayoutDelegate, NSScrubberFlowLayout;
@class NSScrubber, NSScrubberItemView, NSScrubberArrangedView,
NSScrubberTextItemView, NSScrubberImageItemView, NSScrubberSelectionStyle;
@protocol NSTouchBarDelegate
, NSScrubberDelegate, NSScrubberDataSource, NSScrubberFlowLayoutDelegate,
NSScrubberFlowLayout;
typedef float NSTouchBarItemPriority;
static const NSTouchBarItemPriority NSTouchBarItemPriorityHigh = 1000;
static const NSTouchBarItemPriority NSTouchBarItemPriorityNormal = 0;
static const NSTouchBarItemPriority NSTouchBarItemPriorityLow = -1000;
enum NSScrubberMode {
NSScrubberModeFixed = 0,
NSScrubberModeFree
};
enum NSScrubberMode { NSScrubberModeFixed = 0, NSScrubberModeFree };
typedef NSString* NSTouchBarItemIdentifier;
typedef NSString* NSTouchBarCustomizationIdentifier;
@ -42,7 +42,7 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFlexibleSpace =
static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
@"NSTouchBarItemIdentifierOtherItemsProxy";
@interface NSTouchBar : NSObject<NSCoding>
@interface NSTouchBar : NSObject <NSCoding>
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder*)aDecoder
@ -55,7 +55,8 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
@property(copy) NSArray* defaultItemIdentifiers;
@property(copy, readonly) NSArray* itemIdentifiers;
@property(copy, nullable) NSTouchBarItemIdentifier principalItemIdentifier;
@property(copy, nullable) NSTouchBarItemIdentifier escapeKeyReplacementItemIdentifier;
@property(copy, nullable)
NSTouchBarItemIdentifier escapeKeyReplacementItemIdentifier;
@property(copy) NSSet* templateItems;
@property(nullable, weak) id<NSTouchBarDelegate> delegate;
@ -66,7 +67,7 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
@end
@interface NSTouchBarItem : NSObject<NSCoding>
@interface NSTouchBarItem : NSObject <NSCoding>
- (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)identifier
NS_DESIGNATED_INITIALIZER;
@ -149,13 +150,15 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
@end
@interface NSScrubberFlowLayout: NSObject
@interface NSScrubberFlowLayout : NSObject
@end
@interface NSScrubberSelectionStyle : NSObject<NSCoding>
@interface NSScrubberSelectionStyle : NSObject <NSCoding>
@property(class, strong, readonly) NSScrubberSelectionStyle* outlineOverlayStyle;
@property(class, strong, readonly) NSScrubberSelectionStyle* roundedBackgroundStyle;
@property(class, strong, readonly)
NSScrubberSelectionStyle* outlineOverlayStyle;
@property(class, strong, readonly)
NSScrubberSelectionStyle* roundedBackgroundStyle;
@end
@ -209,7 +212,7 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
@end
@protocol NSTouchBarDelegate<NSObject>
@protocol NSTouchBarDelegate <NSObject>
@optional
- (nullable NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
@ -217,14 +220,16 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
@end
@protocol NSScrubberDelegate<NSObject>
@protocol NSScrubberDelegate <NSObject>
- (void)scrubber:(NSScrubber*)scrubber didHighlightItemAtIndex:(NSInteger)highlightedIndex;
- (void)scrubber:(NSScrubber*)scrubber didSelectItemAtIndex:(NSInteger)selectedIndex;
- (void)scrubber:(NSScrubber*)scrubber
didHighlightItemAtIndex:(NSInteger)highlightedIndex;
- (void)scrubber:(NSScrubber*)scrubber
didSelectItemAtIndex:(NSInteger)selectedIndex;
@end
@protocol NSScrubberDataSource<NSObject>
@protocol NSScrubberDataSource <NSObject>
- (NSInteger)numberOfItemsForScrubber:(NSScrubber*)scrubber;
- (__kindof NSScrubberItemView*)scrubber:(NSScrubber*)scrubber
@ -232,9 +237,11 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
@end
@protocol NSScrubberFlowLayoutDelegate<NSObject>
@protocol NSScrubberFlowLayoutDelegate <NSObject>
- (NSSize)scrubber:(NSScrubber *)scrubber layout:(NSScrubberFlowLayout *)layout sizeForItemAtIndex:(NSInteger)itemIndex;
- (NSSize)scrubber:(NSScrubber*)scrubber
layout:(NSScrubberFlowLayout*)layout
sizeForItemAtIndex:(NSInteger)itemIndex;
@end

View file

@ -19,7 +19,7 @@ class NativeWindow;
namespace file_dialog {
// <description, extensions>
typedef std::pair<std::string, std::vector<std::string> > Filter;
typedef std::pair<std::string, std::vector<std::string>> Filter;
typedef std::vector<Filter> Filters;
enum FileDialogProperty {
@ -34,23 +34,22 @@ enum FileDialogProperty {
};
#if defined(MAS_BUILD)
typedef base::Callback<void(
bool result,
typedef base::Callback<void(bool result,
const std::vector<base::FilePath>& paths,
const std::vector<std::string>& bookmarkData)> OpenDialogCallback;
const std::vector<std::string>& bookmarkData)>
OpenDialogCallback;
typedef base::Callback<void(
bool result,
typedef base::Callback<void(bool result,
const base::FilePath& path,
const std::string& bookmarkData)> SaveDialogCallback;
const std::string& bookmarkData)>
SaveDialogCallback;
#else
typedef base::Callback<void(
bool result,
const std::vector<base::FilePath>& paths)> OpenDialogCallback;
typedef base::Callback<void(bool result,
const std::vector<base::FilePath>& paths)>
OpenDialogCallback;
typedef base::Callback<void(
bool result,
const base::FilePath& path)> SaveDialogCallback;
typedef base::Callback<void(bool result, const base::FilePath& path)>
SaveDialogCallback;
#endif
struct DialogSettings {
@ -73,8 +72,7 @@ bool ShowOpenDialog(const DialogSettings& settings,
void ShowOpenDialog(const DialogSettings& settings,
const OpenDialogCallback& callback);
bool ShowSaveDialog(const DialogSettings& settings,
base::FilePath* path);
bool ShowSaveDialog(const DialogSettings& settings, base::FilePath* path);
void ShowSaveDialog(const DialogSettings& settings,
const SaveDialogCallback& callback);

View file

@ -17,8 +17,7 @@
namespace atom {
class TrayIconCocoa : public TrayIcon,
public AtomMenuModel::Observer {
class TrayIconCocoa : public TrayIcon, public AtomMenuModel::Observer {
public:
TrayIconCocoa();
virtual ~TrayIconCocoa();

View file

@ -16,8 +16,7 @@ class StatusIconLinux;
namespace atom {
class TrayIconGtk : public TrayIcon,
public views::StatusIconLinux::Delegate {
class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
public:
TrayIconGtk();
virtual ~TrayIconGtk();

View file

@ -11,7 +11,7 @@
namespace gfx {
class Rect;
class Point;
}
} // namespace gfx
namespace atom {

View file

@ -68,13 +68,15 @@ class AutofillPopupView : public views::WidgetDelegateView,
int GetSelectedLine() { return selected_line_.value_or(-1); }
void WriteDragDataForView(
views::View*, const gfx::Point&, ui::OSExchangeData*) override {}
void WriteDragDataForView(views::View*,
const gfx::Point&,
ui::OSExchangeData*) override {}
int GetDragOperationsForView(views::View*, const gfx::Point&) override {
return ui::DragDropTypes::DRAG_NONE;
}
bool CanStartDragForView(
views::View*, const gfx::Point&, const gfx::Point&) override {
bool CanStartDragForView(views::View*,
const gfx::Point&,
const gfx::Point&) override {
return false;
}

View file

@ -31,8 +31,7 @@ class FramelessView : public views::NonClientFrameView {
gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const override;
int NonClientHitTest(const gfx::Point& point) override;
void GetWindowMask(const gfx::Size& size,
gfx::Path* window_mask) override;
void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override;
void ResetWindowControls() override;
void UpdateWindowIcon() override;
void UpdateWindowTitle() override;

View file

@ -61,7 +61,10 @@ class GlobalMenuBarX11 {
void RegisterAccelerator(DbusmenuMenuitem* item,
const ui::Accelerator& accelerator);
CHROMEG_CALLBACK_1(GlobalMenuBarX11, void, OnItemActivated, DbusmenuMenuitem*,
CHROMEG_CALLBACK_1(GlobalMenuBarX11,
void,
OnItemActivated,
DbusmenuMenuitem*,
unsigned int);
CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnSubMenuShow, DbusmenuMenuitem*);

View file

@ -41,8 +41,7 @@ class MenuDelegate : public views::MenuDelegate {
void WillShowMenu(views::MenuItemView* menu) override;
void WillHideMenu(views::MenuItemView* menu) override;
void OnMenuClosed(views::MenuItemView* menu) override;
views::MenuItemView* GetSiblingMenu(
views::MenuItemView* menu,
views::MenuItemView* GetSiblingMenu(views::MenuItemView* menu,
const gfx::Point& screen_point,
views::MenuAnchorPosition* anchor,
bool* has_mnemonics,

View file

@ -33,9 +33,11 @@ class SubmenuButton : public views::MenuButton {
private:
bool GetUnderlinePosition(const base::string16& text,
base::char16* accelerator,
int* start, int* end) const;
void GetCharacterPosition(
const base::string16& text, int index, int* pos) const;
int* start,
int* end) const;
void GetCharacterPosition(const base::string16& text,
int index,
int* pos) const;
base::char16 accelerator_;

View file

@ -47,7 +47,8 @@ class PdfViewerHandler : public content::WebUIMessageHandler,
void SetZoom(const base::ListValue* args);
void GetStrings(const base::ListValue* args);
void Reload(const base::ListValue* args);
void OnZoomLevelChanged(content::WebContents* web_contents, double level,
void OnZoomLevelChanged(content::WebContents* web_contents,
double level,
bool is_temporary);
void AddObserver();
void RemoveObserver();

View file

@ -19,7 +19,7 @@
namespace content {
class BrowserContext;
struct StreamInfo;
}
} // namespace content
namespace atom {

View file

@ -19,8 +19,7 @@ class AtomDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
void Activate() override;
private:
void OnWindowActivated(
wm::ActivationChangeObserver::ActivationReason reason,
void OnWindowActivated(wm::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
aura::Window* lost_active) override;
DISALLOW_COPY_AND_ASSIGN(AtomDesktopNativeWidgetAura);

View file

@ -25,8 +25,10 @@ class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
~AtomDesktopWindowTreeHostWin() override;
protected:
bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
bool PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result) override;
bool HasNativeFrame() const override;
private:

View file

@ -17,8 +17,10 @@ class MessageHandlerDelegate {
// message was consumed by the delegate and should not be processed further
// by the HWNDMessageHandler. In this case, |result| is returned. |result| is
// not modified otherwise.
virtual bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result);
virtual bool PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result);
};
} // namespace atom

View file

@ -27,11 +27,15 @@ class NotifyIconHost {
typedef std::vector<NotifyIcon*> NotifyIcons;
// Static callback invoked when a message comes in to our messaging window.
static LRESULT CALLBACK
WndProcStatic(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
static LRESULT CALLBACK WndProcStatic(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam);
LRESULT CALLBACK
WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK WndProc(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam);
UINT NextIconId();

View file

@ -32,18 +32,20 @@ class TaskbarHost {
virtual ~TaskbarHost();
// Add or update the buttons in thumbar.
bool SetThumbarButtons(
HWND window, const std::vector<ThumbarButton>& buttons);
bool SetThumbarButtons(HWND window,
const std::vector<ThumbarButton>& buttons);
void RestoreThumbarButtons(HWND window);
// Set the progress state in taskbar.
bool SetProgressBar(
HWND window, double value, const NativeWindow::ProgressState state);
bool SetProgressBar(HWND window,
double value,
const NativeWindow::ProgressState state);
// Set the overlay icon in taskbar.
bool SetOverlayIcon(
HWND window, const gfx::Image& overlay, const std::string& text);
bool SetOverlayIcon(HWND window,
const gfx::Image& overlay,
const std::string& text);
// Set the region of the window to show as a thumbnail in taskbar.
bool SetThumbnailClip(HWND window, const gfx::Rect& region);

View file

@ -5,9 +5,9 @@
#ifndef ATOM_BROWSER_UI_X_X_WINDOW_UTILS_H_
#define ATOM_BROWSER_UI_X_X_WINDOW_UTILS_H_
#include <X11/Xlib.h>
#include <X11/extensions/XInput2.h>
#include <X11/extensions/Xrandr.h>
#include <X11/Xlib.h>
#include <string>

View file

@ -23,16 +23,14 @@ class WebContentsPermissionHelper
OPEN_EXTERNAL,
};
void RequestFullscreenPermission(
const base::Callback<void(bool)>& callback);
void RequestFullscreenPermission(const base::Callback<void(bool)>& callback);
void RequestMediaAccessPermission(
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback);
void RequestWebNotificationPermission(
const base::Callback<void(bool)>& callback);
void RequestPointerLockPermission(bool user_gesture);
void RequestOpenExternalPermission(
const base::Callback<void(bool)>& callback,
void RequestOpenExternalPermission(const base::Callback<void(bool)>& callback,
bool user_gesture,
const GURL& url);
@ -40,8 +38,7 @@ class WebContentsPermissionHelper
explicit WebContentsPermissionHelper(content::WebContents* web_contents);
friend class content::WebContentsUserData<WebContentsPermissionHelper>;
void RequestPermission(
content::PermissionType permission,
void RequestPermission(content::PermissionType permission,
const base::Callback<void(bool)>& callback,
bool user_gesture = false,
const base::DictionaryValue* details = nullptr);

View file

@ -15,7 +15,7 @@ namespace content {
struct FileChooserParams;
class RenderFrameHost;
class WebContents;
}
} // namespace content
namespace atom {

View file

@ -14,7 +14,7 @@ namespace atom {
namespace api {
template<typename K>
template <typename K>
class KeyWeakMap : public mate::Wrappable<KeyWeakMap<K>> {
public:
static mate::Handle<KeyWeakMap<K>> Create(v8::Isolate* isolate) {
@ -47,13 +47,9 @@ class KeyWeakMap : public mate::Wrappable<KeyWeakMap<K>> {
return key_weak_map_.Get(isolate, key).ToLocalChecked();
}
bool Has(const K& key) {
return key_weak_map_.Has(key);
}
bool Has(const K& key) { return key_weak_map_.Has(key); }
void Remove(const K& key) {
key_weak_map_.Remove(key);
}
void Remove(const K& key) { key_weak_map_.Remove(key); }
atom::KeyWeakMap<K> key_weak_map_;

View file

@ -41,20 +41,24 @@ namespace api {
class NativeImage : public mate::Wrappable<NativeImage> {
public:
static mate::Handle<NativeImage> CreateEmpty(v8::Isolate* isolate);
static mate::Handle<NativeImage> Create(
v8::Isolate* isolate, const gfx::Image& image);
static mate::Handle<NativeImage> CreateFromPNG(
v8::Isolate* isolate, const char* buffer, size_t length);
static mate::Handle<NativeImage> CreateFromJPEG(
v8::Isolate* isolate, const char* buffer, size_t length);
static mate::Handle<NativeImage> CreateFromPath(
v8::Isolate* isolate, const base::FilePath& path);
static mate::Handle<NativeImage> Create(v8::Isolate* isolate,
const gfx::Image& image);
static mate::Handle<NativeImage> CreateFromPNG(v8::Isolate* isolate,
const char* buffer,
size_t length);
static mate::Handle<NativeImage> CreateFromJPEG(v8::Isolate* isolate,
const char* buffer,
size_t length);
static mate::Handle<NativeImage> CreateFromPath(v8::Isolate* isolate,
const base::FilePath& path);
static mate::Handle<NativeImage> CreateFromBuffer(
mate::Arguments* args, v8::Local<v8::Value> buffer);
static mate::Handle<NativeImage> CreateFromDataURL(
v8::Isolate* isolate, const GURL& url);
mate::Arguments* args,
v8::Local<v8::Value> buffer);
static mate::Handle<NativeImage> CreateFromDataURL(v8::Isolate* isolate,
const GURL& url);
static mate::Handle<NativeImage> CreateFromNamedImage(
mate::Arguments* args, const std::string& name);
mate::Arguments* args,
const std::string& name);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
@ -77,13 +81,11 @@ class NativeImage : public mate::Wrappable<NativeImage> {
v8::Local<v8::Value> ToJPEG(v8::Isolate* isolate, int quality);
v8::Local<v8::Value> ToBitmap(mate::Arguments* args);
v8::Local<v8::Value> GetBitmap(mate::Arguments* args);
v8::Local<v8::Value> GetNativeHandle(
v8::Isolate* isolate,
v8::Local<v8::Value> GetNativeHandle(v8::Isolate* isolate,
mate::Arguments* args);
mate::Handle<NativeImage> Resize(v8::Isolate* isolate,
const base::DictionaryValue& options);
mate::Handle<NativeImage> Crop(v8::Isolate* isolate,
const gfx::Rect& rect);
mate::Handle<NativeImage> Crop(v8::Isolate* isolate, const gfx::Rect& rect);
std::string ToDataURL(mate::Arguments* args);
bool IsEmpty();
gfx::Size GetSize();
@ -112,16 +114,16 @@ class NativeImage : public mate::Wrappable<NativeImage> {
namespace mate {
// A custom converter that allows converting path to NativeImage.
template<>
template <>
struct Converter<mate::Handle<atom::api::NativeImage>> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const mate::Handle<atom::api::NativeImage>& val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
mate::Handle<atom::api::NativeImage>* out);
};
} // namespace mate
#endif // ATOM_COMMON_API_ATOM_API_NATIVE_IMAGE_H_

View file

@ -44,7 +44,8 @@ v8::Local<v8::Value> EmitEvent(v8::Isolate* isolate,
const StringType& name,
const Args&... args) {
internal::ValueVector converted_args = {
StringToV8(isolate, name), ConvertToV8(isolate, args)...,
StringToV8(isolate, name),
ConvertToV8(isolate, args)...,
};
return internal::CallMethodWithArgs(isolate, obj, "emit", &converted_args);
}

View file

@ -11,12 +11,14 @@ namespace atom {
class RemoteObjectFreer : public ObjectLifeMonitor {
public:
static void BindTo(
v8::Isolate* isolate, v8::Local<v8::Object> target, int object_id);
static void BindTo(v8::Isolate* isolate,
v8::Local<v8::Object> target,
int object_id);
protected:
RemoteObjectFreer(
v8::Isolate* isolate, v8::Local<v8::Object> target, int object_id);
RemoteObjectFreer(v8::Isolate* isolate,
v8::Local<v8::Object> target,
int object_id);
~RemoteObjectFreer() override;
void RunDestructor() override;

View file

@ -76,7 +76,8 @@ class Archive {
// Cached external temporary files.
std::unordered_map<base::FilePath::StringType,
std::unique_ptr<ScopedTemporaryFile>> external_files_;
std::unique_ptr<ScopedTemporaryFile>>
external_files_;
DISALLOW_COPY_AND_ASSIGN(Archive);
};

View file

@ -28,7 +28,8 @@ class ScopedTemporaryFile {
// Init an temporary file and fill it with content of |path|.
bool InitFromFile(base::File* src,
const base::FilePath::StringType& ext,
uint64_t offset, uint64_t size);
uint64_t offset,
uint64_t size);
base::FilePath path() const { return path_; }

View file

@ -16,24 +16,23 @@
#endif
#ifndef ATOM_PRE_RELEASE_VERSION
#define ATOM_VERSION_STRING ATOM_STRINGIFY(ATOM_MAJOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_PATCH_VERSION)
#define ATOM_VERSION_STRING \
ATOM_STRINGIFY(ATOM_MAJOR_VERSION) \
"." ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." ATOM_STRINGIFY( \
ATOM_PATCH_VERSION)
#else
#define ATOM_VERSION_STRING ATOM_STRINGIFY(ATOM_MAJOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_PATCH_VERSION) \
ATOM_STRINGIFY(ATOM_PRE_RELEASE_VERSION)
#define ATOM_VERSION_STRING \
ATOM_STRINGIFY(ATOM_MAJOR_VERSION) \
"." ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." ATOM_STRINGIFY( \
ATOM_PATCH_VERSION) ATOM_STRINGIFY(ATOM_PRE_RELEASE_VERSION)
#endif
#define ATOM_VERSION "v" ATOM_VERSION_STRING
#define ATOM_VERSION_AT_LEAST(major, minor, patch) \
(( (major) < ATOM_MAJOR_VERSION) \
|| ((major) == ATOM_MAJOR_VERSION && (minor) < ATOM_MINOR_VERSION) \
|| ((major) == ATOM_MAJOR_VERSION && (minor) == ATOM_MINOR_VERSION \
&& (patch) <= ATOM_PATCH_VERSION))
(((major) < ATOM_MAJOR_VERSION) || \
((major) == ATOM_MAJOR_VERSION && (minor) < ATOM_MINOR_VERSION) || \
((major) == ATOM_MAJOR_VERSION && (minor) == ATOM_MINOR_VERSION && \
(patch) <= ATOM_PATCH_VERSION))
#endif // ATOM_COMMON_ATOM_VERSION_H_

View file

@ -5,7 +5,7 @@
// Multiply-included file, no traditional include guard.
#include "atom/common/api/api_messages.h"
#include "chrome/common/chrome_utility_printing_messages.h"
#include "chrome/common/print_messages.h"
#include "chrome/common/tts_messages.h"
#include "chrome/common/widevine_cdm_messages.h"
#include "chrome/common/chrome_utility_printing_messages.h"

View file

@ -13,13 +13,14 @@
#include "base/compiler_specific.h"
namespace base {
template <typename T> struct DefaultSingletonTraits;
template <typename T>
struct DefaultSingletonTraits;
}
namespace google_breakpad {
class ExceptionHandler;
class MinidumpDescriptor;
}
} // namespace google_breakpad
namespace crash_reporter {

View file

@ -16,7 +16,8 @@
#include "vendor/crashpad/client/simple_string_dictionary.h"
namespace base {
template <typename T> struct DefaultSingletonTraits;
template <typename T>
struct DefaultSingletonTraits;
}
namespace crash_reporter {

View file

@ -14,7 +14,8 @@
#include "vendor/breakpad/src/client/windows/handler/exception_handler.h"
namespace base {
template <typename T> struct DefaultSingletonTraits;
template <typename T>
struct DefaultSingletonTraits;
}
namespace crash_reporter {

View file

@ -17,7 +17,7 @@ class CrashReportSender;
class CrashGenerationServer;
class ClientInfo;
}
} // namespace google_breakpad
namespace breakpad {
@ -70,17 +70,11 @@ class CrashService {
static const char kReporterURL[];
// Returns number of crash dumps handled.
int requests_handled() const {
return requests_handled_;
}
int requests_handled() const { return requests_handled_; }
// Returns number of crash clients registered.
int clients_connected() const {
return clients_connected_;
}
int clients_connected() const { return clients_connected_; }
// Returns number of crash clients terminated.
int clients_terminated() const {
return clients_terminated_;
}
int clients_terminated() const { return clients_terminated_; }
// Starts the processing loop. This function does not return unless the
// user is logging off or the user closes the crash service window. The

View file

@ -15,7 +15,7 @@
namespace atom {
// Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer.
template<typename K>
template <typename K>
class KeyWeakMap {
public:
// Records the key and self, used by SetWeak.
@ -48,9 +48,7 @@ class KeyWeakMap {
}
// Whethere there is an object with |key| in this WeakMap.
bool Has(const K& key) const {
return map_.find(key) != map_.end();
}
bool Has(const K& key) const { return map_.find(key) != map_.end(); }
// Returns all objects.
std::vector<v8::Local<v8::Object>> Values(v8::Isolate* isolate) const {
@ -79,8 +77,7 @@ class KeyWeakMap {
}
// Map of stored objects.
std::unordered_map<
K, std::pair<KeyObject, v8::Global<v8::Object>>> map_;
std::unordered_map<K, std::pair<KeyObject, v8::Global<v8::Object>>> map_;
DISALLOW_COPY_AND_ASSIGN(KeyWeakMap);
};

View file

@ -22,8 +22,7 @@
&member_func)) \
ipc_message__.set_dispatch_error(); \
code; \
} \
break;
} break;
namespace atom {

View file

@ -13,9 +13,10 @@ class Accelerator;
namespace mate {
template<>
template <>
struct Converter<ui::Accelerator> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
ui::Accelerator* out);
};

View file

@ -10,7 +10,6 @@
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
namespace blink {
class WebMouseEvent;
class WebMouseWheelEvent;
@ -31,99 +30,112 @@ namespace mate {
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
v8::Local<v8::Value> val);
template<>
template <>
struct Converter<blink::WebInputEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebInputEvent* out);
};
template<>
template <>
struct Converter<blink::WebKeyboardEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebKeyboardEvent* out);
};
template<>
template <>
struct Converter<content::NativeWebKeyboardEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::NativeWebKeyboardEvent* out);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::NativeWebKeyboardEvent& in);
};
template<>
template <>
struct Converter<blink::WebMouseEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebMouseEvent* out);
};
template<>
template <>
struct Converter<blink::WebMouseWheelEvent> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebMouseWheelEvent* out);
};
template<>
template <>
struct Converter<blink::WebFloatPoint> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebFloatPoint* out);
};
template<>
template <>
struct Converter<blink::WebPoint> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebPoint* out);
};
template<>
template <>
struct Converter<blink::WebSize> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebSize* out);
};
template<>
template <>
struct Converter<blink::WebDeviceEmulationParams> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebDeviceEmulationParams* out);
};
template<>
template <>
struct Converter<blink::WebFindOptions> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebFindOptions* out);
};
template<>
template <>
struct Converter<blink::WebContextMenuData::MediaType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebContextMenuData::MediaType& in);
};
template<>
template <>
struct Converter<blink::WebContextMenuData::InputFieldType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebContextMenuData::InputFieldType& in);
};
template<>
template <>
struct Converter<blink::WebCache::ResourceTypeStat> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebCache::ResourceTypeStat& stat);
};
template<>
template <>
struct Converter<blink::WebCache::ResourceTypeStats> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebCache::ResourceTypeStats& stats);
};
template<>
template <>
struct Converter<blink::WebReferrerPolicy> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const blink::WebReferrerPolicy& in);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebReferrerPolicy* out);
};

View file

@ -20,7 +20,7 @@ namespace mate {
namespace internal {
template<typename T>
template <typename T>
class RefCountedGlobal;
// Manages the V8 function with RAII.
@ -55,7 +55,7 @@ struct V8FunctionInvoker<v8::Local<v8::Value>(ArgTypes...)> {
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args { ConvertToV8(isolate, raw)... };
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
v8::Local<v8::Value> ret(holder->Call(
holder, args.size(), args.empty() ? nullptr : &args.front()));
return handle_scope.Escape(ret);
@ -76,9 +76,8 @@ struct V8FunctionInvoker<void(ArgTypes...)> {
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args { ConvertToV8(isolate, raw)... };
holder->Call(
holder, args.size(), args.empty() ? nullptr : &args.front());
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
holder->Call(holder, args.size(), args.empty() ? nullptr : &args.front());
}
};
@ -97,10 +96,10 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args { ConvertToV8(isolate, raw)... };
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
v8::Local<v8::Value> result;
auto maybe_result = holder->Call(
context, holder, args.size(), args.empty() ? nullptr : &args.front());
auto maybe_result = holder->Call(context, holder, args.size(),
args.empty() ? nullptr : &args.front());
if (maybe_result.ToLocal(&result))
Converter<ReturnType>::FromV8(isolate, result, &ret);
return ret;
@ -109,8 +108,8 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
// Helper to pass a C++ funtion to JavaScript.
using Translater = base::Callback<void(Arguments* args)>;
v8::Local<v8::Value> CreateFunctionFromTranslater(
v8::Isolate* isolate, const Translater& translater);
v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate,
const Translater& translater);
v8::Local<v8::Value> BindFunctionWith(v8::Isolate* isolate,
v8::Local<v8::Context> context,
v8::Local<v8::Function> func,

View file

@ -18,65 +18,70 @@ namespace content {
struct ContextMenuParams;
class ResourceRequestBody;
class WebContents;
}
} // namespace content
using ContextMenuParamsWithWebContents =
std::pair<content::ContextMenuParams, content::WebContents*>;
namespace mate {
template<>
template <>
struct Converter<content::MenuItem::Type> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::MenuItem::Type& val);
};
template<>
template <>
struct Converter<ContextMenuParamsWithWebContents> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const ContextMenuParamsWithWebContents& val);
};
template<>
template <>
struct Converter<blink::mojom::PermissionStatus> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::mojom::PermissionStatus* out);
};
template<>
template <>
struct Converter<content::PermissionType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::PermissionType& val);
};
template<>
template <>
struct Converter<scoped_refptr<content::ResourceRequestBody>> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const scoped_refptr<content::ResourceRequestBody>& val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
scoped_refptr<content::ResourceRequestBody>* out);
};
template<>
template <>
struct Converter<content::StopFindAction> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::StopFindAction* out);
};
template<>
template <>
struct Converter<content::WebContents*> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
content::WebContents* val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::WebContents** out);
};
template<>
template <>
struct Converter<content::Referrer> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::Referrer& val);
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
content::Referrer* out);
};

Some files were not shown because too many files have changed in this diff Show more