clang-format brightray
This commit is contained in:
parent
7a8a0f6b4b
commit
284aca68c0
25 changed files with 268 additions and 273 deletions
|
@ -32,8 +32,8 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
|||
public:
|
||||
// Get the BrowserContext according to its |partition| and |in_memory|,
|
||||
// empty pointer when be returned when there is no matching BrowserContext.
|
||||
static scoped_refptr<BrowserContext> Get(
|
||||
const std::string& partition, bool in_memory);
|
||||
static scoped_refptr<BrowserContext> Get(const std::string& partition,
|
||||
bool in_memory);
|
||||
|
||||
base::WeakPtr<BrowserContext> GetWeakPtr() {
|
||||
return weak_factory_.GetWeakPtr();
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
class DevToolsContentsResizingStrategy {
|
||||
public:
|
||||
DevToolsContentsResizingStrategy();
|
||||
explicit DevToolsContentsResizingStrategy(
|
||||
const gfx::Rect& bounds);
|
||||
explicit DevToolsContentsResizingStrategy(const gfx::Rect& bounds);
|
||||
|
||||
void CopyFrom(const DevToolsContentsResizingStrategy& strategy);
|
||||
bool Equals(const DevToolsContentsResizingStrategy& strategy);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace base {
|
||||
class ListValue;
|
||||
class Value;
|
||||
}
|
||||
} // namespace base
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace base {
|
|||
class FilePath;
|
||||
class FileEnumerator;
|
||||
class Time;
|
||||
}
|
||||
} // namespace base
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
|
@ -56,9 +56,7 @@ class DevToolsFileSystemIndexer
|
|||
void IndexFiles();
|
||||
void StartFileIndexing(base::File::Error error);
|
||||
void ReadFromFile();
|
||||
void OnRead(base::File::Error error,
|
||||
const char* data,
|
||||
int bytes_read);
|
||||
void OnRead(base::File::Error error, const char* data, int bytes_read);
|
||||
void FinishFileIndexing(bool success);
|
||||
void CloseFile();
|
||||
void CloseCallback(base::File::Error error);
|
||||
|
|
|
@ -22,8 +22,7 @@ class DevToolsManagerDelegate : public content::DevToolsManagerDelegate {
|
|||
|
||||
// DevToolsManagerDelegate implementation.
|
||||
void Inspect(content::DevToolsAgentHost* agent_host) override;
|
||||
bool HandleCommand(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
bool HandleCommand(content::DevToolsAgentHost* agent_host,
|
||||
int session_id,
|
||||
base::DictionaryValue* command) override;
|
||||
scoped_refptr<content::DevToolsAgentHost> CreateNewTarget(
|
||||
|
|
|
@ -11,20 +11,19 @@ class InspectableWebContentsDelegate {
|
|||
|
||||
// Requested by WebContents of devtools.
|
||||
virtual void DevToolsReloadPage() {}
|
||||
virtual void DevToolsSaveToFile(
|
||||
const std::string& url, const std::string& content, bool save_as) {}
|
||||
virtual void DevToolsAppendToFile(
|
||||
const std::string& url, const std::string& content) {}
|
||||
virtual void DevToolsSaveToFile(const std::string& url,
|
||||
const std::string& content,
|
||||
bool save_as) {}
|
||||
virtual void DevToolsAppendToFile(const std::string& url,
|
||||
const std::string& content) {}
|
||||
virtual void DevToolsRequestFileSystems() {}
|
||||
virtual void DevToolsAddFileSystem(
|
||||
const base::FilePath& file_system_path) {}
|
||||
virtual void DevToolsAddFileSystem(const base::FilePath& file_system_path) {}
|
||||
virtual void DevToolsRemoveFileSystem(
|
||||
const base::FilePath& file_system_path) {}
|
||||
virtual void DevToolsIndexPath(
|
||||
int request_id, const std::string& file_system_path) {}
|
||||
virtual void DevToolsIndexPath(int request_id,
|
||||
const std::string& file_system_path) {}
|
||||
virtual void DevToolsStopIndexing(int request_id) {}
|
||||
virtual void DevToolsSearchInPath(
|
||||
int request_id,
|
||||
virtual void DevToolsSearchInPath(int request_id,
|
||||
const std::string& file_system_path,
|
||||
const std::string& query) {}
|
||||
};
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace brightray {
|
|||
class InspectableWebContentsDelegate;
|
||||
class InspectableWebContentsView;
|
||||
|
||||
class InspectableWebContentsImpl :
|
||||
public InspectableWebContents,
|
||||
class InspectableWebContentsImpl
|
||||
: public InspectableWebContents,
|
||||
public content::DevToolsAgentHostClient,
|
||||
public content::WebContentsObserver,
|
||||
public content::WebContentsDelegate,
|
||||
|
@ -156,8 +156,8 @@ class InspectableWebContentsImpl :
|
|||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace) override;
|
||||
void HandleKeyboardEvent(
|
||||
content::WebContents*, const content::NativeWebKeyboardEvent&) override;
|
||||
void HandleKeyboardEvent(content::WebContents*,
|
||||
const content::NativeWebKeyboardEvent&) override;
|
||||
void CloseContents(content::WebContents* source) override;
|
||||
content::ColorChooser* OpenColorChooser(
|
||||
content::WebContents* source,
|
||||
|
@ -172,8 +172,7 @@ class InspectableWebContentsImpl :
|
|||
// net::URLFetcherDelegate:
|
||||
void OnURLFetchComplete(const net::URLFetcher* source) override;
|
||||
|
||||
void SendMessageAck(int request_id,
|
||||
const base::Value* arg1);
|
||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||
|
||||
bool frontend_loaded_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
|
|
|
@ -25,9 +25,7 @@ class InspectableWebContentsView {
|
|||
void SetDelegate(InspectableWebContentsViewDelegate* delegate) {
|
||||
delegate_ = delegate;
|
||||
}
|
||||
InspectableWebContentsViewDelegate* GetDelegate() const {
|
||||
return delegate_;
|
||||
}
|
||||
InspectableWebContentsViewDelegate* GetDelegate() const { return delegate_; }
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
// Returns the container control, which has devtools view attached.
|
||||
|
|
|
@ -20,8 +20,8 @@ class InspectableWebContentsViewDelegate {
|
|||
|
||||
#if defined(USE_X11)
|
||||
// Called when creating devtools window.
|
||||
virtual void GetDevToolsWindowWMClass(
|
||||
std::string* name, std::string* class_name) {}
|
||||
virtual void GetDevToolsWindowWMClass(std::string* name,
|
||||
std::string* class_name) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace net {
|
||||
class URLRequestContext;
|
||||
class URLRequestContextGetter;
|
||||
}
|
||||
} // namespace net
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
|
|
@ -27,10 +27,15 @@ class LibnotifyNotification : public Notification {
|
|||
void Dismiss() override;
|
||||
|
||||
private:
|
||||
CHROMEG_CALLBACK_0(LibnotifyNotification, void, OnNotificationClosed,
|
||||
CHROMEG_CALLBACK_0(LibnotifyNotification,
|
||||
void,
|
||||
OnNotificationClosed,
|
||||
NotifyNotification*);
|
||||
CHROMEG_CALLBACK_1(LibnotifyNotification, void, OnNotificationView,
|
||||
NotifyNotification*, char*);
|
||||
CHROMEG_CALLBACK_1(LibnotifyNotification,
|
||||
void,
|
||||
OnNotificationView,
|
||||
NotifyNotification*,
|
||||
char*);
|
||||
|
||||
NotifyNotification* notification_;
|
||||
|
||||
|
|
|
@ -22,14 +22,16 @@ using brightray::InspectableWebContentsViewMac;
|
|||
DevToolsContentsResizingStrategy strategy_;
|
||||
}
|
||||
|
||||
- (instancetype)initWithInspectableWebContentsViewMac:(InspectableWebContentsViewMac*)view;
|
||||
- (instancetype)initWithInspectableWebContentsViewMac:
|
||||
(InspectableWebContentsViewMac*)view;
|
||||
- (void)removeObservers;
|
||||
- (void)notifyDevToolsFocused;
|
||||
- (void)setDevToolsVisible:(BOOL)visible;
|
||||
- (BOOL)isDevToolsVisible;
|
||||
- (BOOL)isDevToolsFocused;
|
||||
- (void)setIsDocked:(BOOL)docked;
|
||||
- (void)setContentsResizingStrategy:(const DevToolsContentsResizingStrategy&)strategy;
|
||||
- (void)setContentsResizingStrategy:
|
||||
(const DevToolsContentsResizingStrategy&)strategy;
|
||||
- (void)setTitle:(NSString*)title;
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,12 +11,13 @@ namespace brightray {
|
|||
class NotificationPresenterMac;
|
||||
}
|
||||
|
||||
@interface NotificationCenterDelegate :
|
||||
NSObject<NSUserNotificationCenterDelegate> {
|
||||
@interface NotificationCenterDelegate
|
||||
: NSObject <NSUserNotificationCenterDelegate> {
|
||||
@private
|
||||
brightray::NotificationPresenterMac* presenter_;
|
||||
}
|
||||
- (instancetype)initWithPresenter:(brightray::NotificationPresenterMac*)presenter;
|
||||
- (instancetype)initWithPresenter:
|
||||
(brightray::NotificationPresenterMac*)presenter;
|
||||
@end
|
||||
|
||||
#endif // BROWSER_MAC_NOTIFICATION_DELEGATE_H_
|
||||
|
|
|
@ -34,10 +34,10 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
|
|||
|
||||
// Helpers for picking particular requested devices, identified by raw id.
|
||||
// If the device requested is not available it will return NULL.
|
||||
const content::MediaStreamDevice*
|
||||
GetRequestedAudioDevice(const std::string& requested_audio_device_id);
|
||||
const content::MediaStreamDevice*
|
||||
GetRequestedVideoDevice(const std::string& requested_video_device_id);
|
||||
const content::MediaStreamDevice* GetRequestedAudioDevice(
|
||||
const std::string& requested_audio_device_id);
|
||||
const content::MediaStreamDevice* GetRequestedVideoDevice(
|
||||
const std::string& requested_video_device_id);
|
||||
|
||||
// Returns the first available audio or video device, or NULL if no devices
|
||||
// are available.
|
||||
|
@ -52,8 +52,7 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
|
|||
// Overridden from content::MediaObserver:
|
||||
void OnAudioCaptureDevicesChanged() override;
|
||||
void OnVideoCaptureDevicesChanged() override;
|
||||
void OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
void OnMediaRequestStateChanged(int render_process_id,
|
||||
int render_view_id,
|
||||
int page_request_id,
|
||||
const GURL& security_origin,
|
||||
|
|
|
@ -45,8 +45,7 @@ class NetworkDelegate : public net::NetworkDelegate {
|
|||
int64_t bytes_sent) override;
|
||||
void OnCompleted(net::URLRequest* request, bool started) override;
|
||||
void OnURLRequestDestroyed(net::URLRequest* request) override;
|
||||
void OnPACScriptError(int line_number,
|
||||
const base::string16& error) override;
|
||||
void OnPACScriptError(int line_number, const base::string16& error) override;
|
||||
AuthRequiredResponse OnAuthRequired(
|
||||
net::URLRequest* request,
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
|
|
|
@ -34,7 +34,7 @@ class NetworkDelegate;
|
|||
class ProxyConfigService;
|
||||
class URLRequestContextStorage;
|
||||
class URLRequestJobFactory;
|
||||
}
|
||||
} // namespace net
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace views {
|
|||
class WebView;
|
||||
class Widget;
|
||||
class WidgetDelegate;
|
||||
}
|
||||
} // namespace views
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
|
|
@ -23,13 +23,12 @@ class ViewsDelegate : public views::ViewsDelegate {
|
|||
const std::string& window_name,
|
||||
const gfx::Rect& bounds,
|
||||
ui::WindowShowState show_state) override;
|
||||
bool GetSavedWindowPlacement(
|
||||
const views::Widget* widget,
|
||||
bool GetSavedWindowPlacement(const views::Widget* widget,
|
||||
const std::string& window_name,
|
||||
gfx::Rect* bounds,
|
||||
ui::WindowShowState* show_state) const override;
|
||||
void NotifyAccessibilityEvent(
|
||||
views::View* view, ui::AXEvent event_type) override;
|
||||
void NotifyAccessibilityEvent(views::View* view,
|
||||
ui::AXEvent event_type) override;
|
||||
void NotifyMenuItemFocused(const base::string16& menu_name,
|
||||
const base::string16& menu_item_name,
|
||||
int item_index,
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
#include "content/public/browser/web_ui_controller_factory.h"
|
||||
|
||||
namespace base {
|
||||
template <typename T> struct DefaultSingletonTraits;
|
||||
template <typename T>
|
||||
struct DefaultSingletonTraits;
|
||||
}
|
||||
|
||||
namespace brightray {
|
||||
|
@ -24,8 +25,8 @@ class WebUIControllerFactory : public content::WebUIControllerFactory {
|
|||
WebUIControllerFactory();
|
||||
virtual ~WebUIControllerFactory();
|
||||
|
||||
content::WebUI::TypeID GetWebUIType(
|
||||
content::BrowserContext* browser_context, const GURL& url) const override;
|
||||
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
|
||||
const GURL& url) const override;
|
||||
bool UseWebUIForURL(content::BrowserContext* browser_context,
|
||||
const GURL& url) const override;
|
||||
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
|
||||
|
|
|
@ -6,8 +6,7 @@ namespace brightray {
|
|||
|
||||
class Win32Notification;
|
||||
|
||||
class NotificationPresenterWin7 :
|
||||
public NotificationPresenter,
|
||||
class NotificationPresenterWin7 : public NotificationPresenter,
|
||||
public DesktopNotificationController {
|
||||
public:
|
||||
NotificationPresenterWin7() = default;
|
||||
|
|
|
@ -13,7 +13,8 @@ struct NotificationData {
|
|||
NotificationData() = default;
|
||||
|
||||
~NotificationData() {
|
||||
if (image) DeleteObject(image);
|
||||
if (image)
|
||||
DeleteObject(image);
|
||||
}
|
||||
|
||||
NotificationData(const NotificationData& other) = delete;
|
||||
|
@ -32,8 +33,7 @@ struct ScreenMetrics {
|
|||
typedef HRESULT WINAPI GetDpiForMonitor_t(HMONITOR, int, UINT*, UINT*);
|
||||
|
||||
auto GetDpiForMonitor = reinterpret_cast<GetDpiForMonitor_t*>(
|
||||
GetProcAddress(GetModuleHandle(TEXT("shcore")),
|
||||
"GetDpiForMonitor"));
|
||||
GetProcAddress(GetModuleHandle(TEXT("shcore")), "GetDpiForMonitor"));
|
||||
|
||||
if (GetDpiForMonitor) {
|
||||
auto monitor = MonitorFromPoint({}, MONITOR_DEFAULTTOPRIMARY);
|
||||
|
@ -47,8 +47,14 @@ struct ScreenMetrics {
|
|||
ReleaseDC(NULL, hdc);
|
||||
}
|
||||
|
||||
template<class T> T X(T value) const { return ScaleForDpi(value, dpi_x); }
|
||||
template<class T> T Y(T value) const { return ScaleForDpi(value, dpi_y); }
|
||||
template <class T>
|
||||
T X(T value) const {
|
||||
return ScaleForDpi(value, dpi_x);
|
||||
}
|
||||
template <class T>
|
||||
T Y(T value) const {
|
||||
return ScaleForDpi(value, dpi_y);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
#include <Windows.h>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Windows.h>
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
@ -15,7 +15,8 @@ class DesktopNotificationController {
|
|||
~DesktopNotificationController();
|
||||
|
||||
class Notification;
|
||||
Notification AddNotification(std::wstring caption, std::wstring body_text,
|
||||
Notification AddNotification(std::wstring caption,
|
||||
std::wstring body_text,
|
||||
HBITMAP image);
|
||||
void CloseNotification(Notification& notification);
|
||||
|
||||
|
@ -32,9 +33,7 @@ class DesktopNotificationController {
|
|||
HFONT GetBodyFont();
|
||||
|
||||
private:
|
||||
enum TimerID {
|
||||
TimerID_Animate = 1
|
||||
};
|
||||
enum TimerID { TimerID_Animate = 1 };
|
||||
|
||||
static constexpr int toast_margin_ = 20;
|
||||
|
||||
|
@ -57,15 +56,16 @@ class DesktopNotificationController {
|
|||
|
||||
class Toast;
|
||||
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam);
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam);
|
||||
static DesktopNotificationController* Get(HWND hwnd) {
|
||||
return reinterpret_cast<DesktopNotificationController*>(
|
||||
GetWindowLongPtr(hwnd, 0));
|
||||
}
|
||||
|
||||
DesktopNotificationController(
|
||||
const DesktopNotificationController&) = delete;
|
||||
DesktopNotificationController(const DesktopNotificationController&) = delete;
|
||||
|
||||
void InitializeFonts();
|
||||
void ClearAssets();
|
||||
|
|
|
@ -12,8 +12,10 @@ class DesktopNotificationController::Toast {
|
|||
return reinterpret_cast<Toast*>(GetWindowLongPtr(hwnd, 0));
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
WPARAM wparam, LPARAM lparam);
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam);
|
||||
|
||||
const std::shared_ptr<NotificationData>& GetNotification() const {
|
||||
return data_;
|
||||
|
@ -25,12 +27,8 @@ class DesktopNotificationController::Toast {
|
|||
|
||||
void PopUp(int y);
|
||||
void SetVerticalPosition(int y);
|
||||
int GetVerticalPosition() const {
|
||||
return vertical_pos_target_;
|
||||
}
|
||||
int GetHeight() const {
|
||||
return toast_size_.cy;
|
||||
}
|
||||
int GetVerticalPosition() const { return vertical_pos_target_; }
|
||||
int GetHeight() const { return toast_size_.cy; }
|
||||
HDWP Animate(HDWP hdwp, const POINT& origin);
|
||||
bool IsAnimationActive() const {
|
||||
return ease_in_active_ || ease_out_active_ || IsStackCollapseActive();
|
||||
|
@ -41,9 +39,7 @@ class DesktopNotificationController::Toast {
|
|||
}
|
||||
|
||||
private:
|
||||
enum TimerID {
|
||||
TimerID_AutoDismiss = 1
|
||||
};
|
||||
enum TimerID { TimerID_AutoDismiss = 1 };
|
||||
|
||||
Toast(HWND hwnd, std::shared_ptr<NotificationData>* data);
|
||||
~Toast();
|
||||
|
@ -68,8 +64,7 @@ class DesktopNotificationController::Toast {
|
|||
float AnimateStackCollapse();
|
||||
|
||||
private:
|
||||
static constexpr const TCHAR class_name_[] =
|
||||
TEXT("DesktopNotificationToast");
|
||||
static constexpr const TCHAR class_name_[] = TEXT("DesktopNotificationToast");
|
||||
|
||||
const HWND hwnd_;
|
||||
HDC hdc_;
|
||||
|
|
|
@ -7,9 +7,8 @@ namespace brightray {
|
|||
class Win32Notification : public brightray::Notification {
|
||||
public:
|
||||
Win32Notification(NotificationDelegate* delegate,
|
||||
NotificationPresenterWin7* presenter) :
|
||||
Notification(delegate, presenter) {
|
||||
}
|
||||
NotificationPresenterWin7* presenter)
|
||||
: Notification(delegate, presenter) {}
|
||||
void Show(const NotificationOptions& options) override;
|
||||
void Dismiss() override;
|
||||
|
||||
|
@ -17,9 +16,7 @@ class Win32Notification : public brightray::Notification {
|
|||
return notification_ref_;
|
||||
}
|
||||
|
||||
const std::string& GetTag() const {
|
||||
return tag_;
|
||||
}
|
||||
const std::string& GetTag() const { return tag_; }
|
||||
|
||||
private:
|
||||
DesktopNotificationController::Notification notification_ref_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue