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) #if defined(OS_MACOSX)
extern "C" { extern "C" {
__attribute__((visibility("default"))) __attribute__((visibility("default"))) int AtomMain(int argc, char* argv[]);
int AtomMain(int argc, char* argv[]);
#ifdef ENABLE_RUN_AS_NODE #ifdef ENABLE_RUN_AS_NODE
__attribute__((visibility("default"))) __attribute__((visibility("default"))) int AtomInitializeICUandStartNode(
int AtomInitializeICUandStartNode(int argc, char *argv[]); int argc,
char* argv[]);
#endif #endif
} }
#endif // OS_MACOSX #endif // OS_MACOSX

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,7 +49,8 @@ class Cookies : public mate::TrackableObject<Cookies> {
~Cookies() override; ~Cookies() override;
void Get(const base::DictionaryValue& filter, const GetCallback& callback); 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); const base::Closure& callback);
void Set(const base::DictionaryValue& details, const SetCallback& callback); void Set(const base::DictionaryValue& details, const SetCallback& callback);
void FlushStore(const base::Closure& callback); void FlushStore(const base::Closure& callback);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,8 +15,7 @@ class Message;
namespace mate { namespace mate {
class Event : public Wrappable<Event>, class Event : public Wrappable<Event>, public content::WebContentsObserver {
public content::WebContentsObserver {
public: public:
static Handle<Event> Create(v8::Isolate* isolate); 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, v8::Local<v8::Object> object,
content::RenderFrameHost* sender, content::RenderFrameHost* sender,
IPC::Message* message); IPC::Message* message);
v8::Local<v8::Object> CreateCustomEvent( v8::Local<v8::Object> CreateCustomEvent(v8::Isolate* isolate,
v8::Isolate* isolate,
v8::Local<v8::Object> object, v8::Local<v8::Object> object,
v8::Local<v8::Object> event); v8::Local<v8::Object> event);
v8::Local<v8::Object> CreateEventFromFlags(v8::Isolate* isolate, int flags); 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 } // namespace internal
// Provide helperers to emit event in JavaScript. // Provide helperers to emit event in JavaScript.
template<typename T> template <typename T>
class EventEmitter : public Wrappable<T> { class EventEmitter : public Wrappable<T> {
public: public:
typedef std::vector<v8::Local<v8::Value>> ValueArray; typedef std::vector<v8::Local<v8::Value>> ValueArray;
@ -48,27 +47,26 @@ class EventEmitter : public Wrappable<T> {
} }
// this.emit(name, event, args...); // this.emit(name, event, args...);
template<typename... Args> template <typename... Args>
bool EmitCustomEvent(const base::StringPiece& name, bool EmitCustomEvent(const base::StringPiece& name,
v8::Local<v8::Object> event, v8::Local<v8::Object> event,
const Args&... args) { const Args&... args) {
return EmitWithEvent( return EmitWithEvent(
name, name, internal::CreateCustomEvent(isolate(), GetWrapper(), event),
internal::CreateCustomEvent(isolate(), GetWrapper(), event), args...); args...);
} }
// this.emit(name, new Event(flags), args...); // this.emit(name, new Event(flags), args...);
template<typename... Args> template <typename... Args>
bool EmitWithFlags(const base::StringPiece& name, bool EmitWithFlags(const base::StringPiece& name,
int flags, int flags,
const Args&... args) { const Args&... args) {
return EmitCustomEvent( return EmitCustomEvent(
name, name, internal::CreateEventFromFlags(isolate(), flags), args...);
internal::CreateEventFromFlags(isolate(), flags), args...);
} }
// this.emit(name, new Event(), args...); // this.emit(name, new Event(), args...);
template<typename... Args> template <typename... Args>
bool Emit(const base::StringPiece& name, const Args&... args) { bool Emit(const base::StringPiece& name, const Args&... args) {
return EmitWithSender(name, nullptr, nullptr, args...); return EmitWithSender(name, nullptr, nullptr, args...);
} }
@ -85,8 +83,8 @@ class EventEmitter : public Wrappable<T> {
if (wrapper.IsEmpty()) { if (wrapper.IsEmpty()) {
return false; return false;
} }
v8::Local<v8::Object> event = internal::CreateJSEvent( v8::Local<v8::Object> event =
isolate(), wrapper, sender, message); internal::CreateJSEvent(isolate(), wrapper, sender, message);
return EmitWithEvent(name, event, args...); return EmitWithEvent(name, event, args...);
} }
@ -95,15 +93,15 @@ class EventEmitter : public Wrappable<T> {
private: private:
// this.emit(name, event, args...); // this.emit(name, event, args...);
template<typename... Args> template <typename... Args>
bool EmitWithEvent(const base::StringPiece& name, bool EmitWithEvent(const base::StringPiece& name,
v8::Local<v8::Object> event, v8::Local<v8::Object> event,
const Args&... args) { const Args&... args) {
v8::Locker locker(isolate()); v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate()); v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(), name, event, args...); EmitEvent(isolate(), GetWrapper(), name, event, args...);
return event->Get( return event->Get(StringToV8(isolate(), "defaultPrevented"))
StringToV8(isolate(), "defaultPrevented"))->BooleanValue(); ->BooleanValue();
} }
DISALLOW_COPY_AND_ASSIGN(EventEmitter); 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 // All instances of TrackableObject will be kept in a weak map and can be got
// from its ID. // from its ID.
template<typename T> template <typename T>
class TrackableObject : public TrackableObjectBase, class TrackableObject : public TrackableObjectBase,
public mate::EventEmitter<T> { public mate::EventEmitter<T> {
public: public:
@ -107,13 +107,9 @@ class TrackableObject : public TrackableObjectBase,
} }
protected: protected:
TrackableObject() { TrackableObject() { weak_map_id_ = ++next_id_; }
weak_map_id_ = ++next_id_;
}
~TrackableObject() override { ~TrackableObject() override { RemoveFromWeakMap(); }
RemoveFromWeakMap();
}
void InitWith(v8::Isolate* isolate, v8::Local<v8::Object> wrapper) override { void InitWith(v8::Isolate* isolate, v8::Local<v8::Object> wrapper) override {
WrappableBase::InitWith(isolate, wrapper); WrappableBase::InitWith(isolate, wrapper);
@ -130,10 +126,10 @@ class TrackableObject : public TrackableObjectBase,
DISALLOW_COPY_AND_ASSIGN(TrackableObject); DISALLOW_COPY_AND_ASSIGN(TrackableObject);
}; };
template<typename T> template <typename T>
int32_t TrackableObject<T>::next_id_ = 0; int32_t TrackableObject<T>::next_id_ = 0;
template<typename T> template <typename T>
atom::KeyWeakMap<int32_t>* TrackableObject<T>::weak_map_ = nullptr; atom::KeyWeakMap<int32_t>* TrackableObject<T>::weak_map_ = nullptr;
} // namespace mate } // namespace mate

View file

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

View file

@ -17,7 +17,7 @@
namespace content { namespace content {
class QuotaPermissionContext; class QuotaPermissionContext;
class ClientCertificateDelegate; class ClientCertificateDelegate;
} } // namespace content
namespace net { namespace net {
class SSLCertRequestInfo; class SSLCertRequestInfo;
@ -84,8 +84,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
net::ClientCertIdentityList client_certs, net::ClientCertIdentityList client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) override; std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
void ResourceDispatcherHostCreated() override; void ResourceDispatcherHostCreated() override;
bool CanCreateWindow( bool CanCreateWindow(content::RenderFrameHost* opener,
content::RenderFrameHost* opener,
const GURL& opener_url, const GURL& opener_url,
const GURL& opener_top_level_frame_url, const GURL& opener_top_level_frame_url,
const GURL& source_origin, 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 // |in_memory|. The |options| will be passed to constructor when there is no
// existing BrowserContext. // existing BrowserContext.
static scoped_refptr<AtomBrowserContext> From( 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()); const base::DictionaryValue& options = base::DictionaryValue());
void SetUserAgent(const std::string& user_agent); void SetUserAgent(const std::string& user_agent);
@ -67,7 +68,8 @@ class AtomBrowserContext : public brightray::BrowserContext {
} }
protected: protected:
AtomBrowserContext(const std::string& partition, bool in_memory, AtomBrowserContext(const std::string& partition,
bool in_memory,
const base::DictionaryValue& options); const base::DictionaryValue& options);
~AtomBrowserContext() override; ~AtomBrowserContext() override;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -229,13 +229,9 @@ class Browser : public WindowListObserver {
void PreMainMessageLoopRun(); void PreMainMessageLoopRun();
void AddObserver(BrowserObserver* obs) { void AddObserver(BrowserObserver* obs) { observers_.AddObserver(obs); }
observers_.AddObserver(obs);
}
void RemoveObserver(BrowserObserver* obs) { void RemoveObserver(BrowserObserver* obs) { observers_.RemoveObserver(obs); }
observers_.RemoveObserver(obs);
}
bool is_shutting_down() const { return is_shutdown_; } bool is_shutting_down() const { return is_shutdown_; }
bool is_quiting() const { return is_quiting_; } 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 // The browser has opened a file by double clicking in Finder or dragging the
// file to the Dock icon. (macOS only) // file to the Dock icon. (macOS only)
virtual void OnOpenFile(bool* prevent_default, virtual void OnOpenFile(bool* prevent_default, const std::string& file_path) {
const std::string& file_path) {} }
// Browser is used to open a url. // Browser is used to open a url.
virtual void OnOpenURL(const std::string& url) {} virtual void OnOpenURL(const std::string& url) {}
@ -60,16 +60,13 @@ class BrowserObserver {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// The browser wants to report that an user activity will resume. (macOS only) // The browser wants to report that an user activity will resume. (macOS only)
virtual void OnWillContinueUserActivity( virtual void OnWillContinueUserActivity(bool* prevent_default,
bool* prevent_default,
const std::string& type) {} const std::string& type) {}
// The browser wants to report an user activity resuming error. (macOS only) // The browser wants to report an user activity resuming error. (macOS only)
virtual void OnDidFailToContinueUserActivity( virtual void OnDidFailToContinueUserActivity(const std::string& type,
const std::string& type,
const std::string& error) {} const std::string& error) {}
// The browser wants to resume a user activity via handoff. (macOS only) // The browser wants to resume a user activity via handoff. (macOS only)
virtual void OnContinueUserActivity( virtual void OnContinueUserActivity(bool* prevent_default,
bool* prevent_default,
const std::string& type, const std::string& type,
const base::DictionaryValue& user_info) {} const base::DictionaryValue& user_info) {}
// The browser wants to notify that an user activity was resumed. (macOS only) // The browser wants to notify that an user activity was resumed. (macOS only)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,7 +13,10 @@
namespace accelerator_util { 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; typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
// Parse a string as an accelerator. // Parse a string as an accelerator.

View file

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

View file

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

View file

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

View file

@ -26,7 +26,8 @@ class AtomBundleMover {
static void Relaunch(NSString* destinationPath); static void Relaunch(NSString* destinationPath);
static NSString* ShellQuotedString(NSString* string); static NSString* ShellQuotedString(NSString* string);
static bool CopyBundle(NSString* srcPath, NSString* dstPath); static bool CopyBundle(NSString* srcPath, NSString* dstPath);
static bool AuthorizedInstall(NSString* srcPath, NSString* dstPath, static bool AuthorizedInstall(NSString* srcPath,
NSString* dstPath,
bool* canceled); bool* canceled);
static bool IsApplicationAtPathRunning(NSString* bundlePath); static bool IsApplicationAtPathRunning(NSString* bundlePath);
static bool DeleteOrTrash(NSString* path); 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 // 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 // that particular item. It is important that the model outlives this object
// as it only maintains weak references. // as it only maintains weak references.
@interface AtomMenuController : NSObject<NSMenuDelegate> { @interface AtomMenuController : NSObject <NSMenuDelegate> {
@protected @protected
atom::AtomMenuModel* model_; // weak atom::AtomMenuModel* model_; // weak
base::scoped_nsobject<NSMenu> menu_; base::scoped_nsobject<NSMenu> menu_;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -61,7 +61,10 @@ class GlobalMenuBarX11 {
void RegisterAccelerator(DbusmenuMenuitem* item, void RegisterAccelerator(DbusmenuMenuitem* item,
const ui::Accelerator& accelerator); const ui::Accelerator& accelerator);
CHROMEG_CALLBACK_1(GlobalMenuBarX11, void, OnItemActivated, DbusmenuMenuitem*, CHROMEG_CALLBACK_1(GlobalMenuBarX11,
void,
OnItemActivated,
DbusmenuMenuitem*,
unsigned int); unsigned int);
CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnSubMenuShow, DbusmenuMenuitem*); 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 WillShowMenu(views::MenuItemView* menu) override;
void WillHideMenu(views::MenuItemView* menu) override; void WillHideMenu(views::MenuItemView* menu) override;
void OnMenuClosed(views::MenuItemView* menu) override; void OnMenuClosed(views::MenuItemView* menu) override;
views::MenuItemView* GetSiblingMenu( views::MenuItemView* GetSiblingMenu(views::MenuItemView* menu,
views::MenuItemView* menu,
const gfx::Point& screen_point, const gfx::Point& screen_point,
views::MenuAnchorPosition* anchor, views::MenuAnchorPosition* anchor,
bool* has_mnemonics, bool* has_mnemonics,

View file

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

View file

@ -47,7 +47,8 @@ class PdfViewerHandler : public content::WebUIMessageHandler,
void SetZoom(const base::ListValue* args); void SetZoom(const base::ListValue* args);
void GetStrings(const base::ListValue* args); void GetStrings(const base::ListValue* args);
void Reload(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); bool is_temporary);
void AddObserver(); void AddObserver();
void RemoveObserver(); void RemoveObserver();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
// Multiply-included file, no traditional include guard. // Multiply-included file, no traditional include guard.
#include "atom/common/api/api_messages.h" #include "atom/common/api/api_messages.h"
#include "chrome/common/chrome_utility_printing_messages.h"
#include "chrome/common/print_messages.h" #include "chrome/common/print_messages.h"
#include "chrome/common/tts_messages.h" #include "chrome/common/tts_messages.h"
#include "chrome/common/widevine_cdm_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" #include "base/compiler_specific.h"
namespace base { namespace base {
template <typename T> struct DefaultSingletonTraits; template <typename T>
struct DefaultSingletonTraits;
} }
namespace google_breakpad { namespace google_breakpad {
class ExceptionHandler; class ExceptionHandler;
class MinidumpDescriptor; class MinidumpDescriptor;
} } // namespace google_breakpad
namespace crash_reporter { namespace crash_reporter {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,9 +13,10 @@ class Accelerator;
namespace mate { namespace mate {
template<> template <>
struct Converter<ui::Accelerator> { 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); ui::Accelerator* out);
}; };

View file

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

View file

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

View file

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

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