chore: run clang-format

- atom/
 - brightray/
 - chromium_src/
This commit is contained in:
Aleksei Kuzmin 2018-09-19 13:10:26 +02:00
parent ec125b761c
commit 7fc3bcaa02
35 changed files with 98 additions and 98 deletions

View file

@ -65,7 +65,7 @@ void StartHandlingTask(bool capture_window,
atom::api::DesktopCapturer* cap) {
#if defined(OS_WIN)
if (content::desktop_capture::CreateDesktopCaptureOptions()
.allow_directx_capturer()) {
.allow_directx_capturer()) {
// DxgiDuplicatorController should be alive in this scope according to
// screen_capturer_win.cc.
auto duplicator = webrtc::DxgiDuplicatorController::Instance();

View file

@ -8,7 +8,7 @@
#import <Cocoa/Cocoa.h>
@interface MacLockMonitor : NSObject {
@private
@private
std::vector<atom::api::PowerMonitor*> emitters;
}
@ -21,15 +21,15 @@
- (id)init {
if ((self = [super init])) {
NSDistributedNotificationCenter* distCenter =
[NSDistributedNotificationCenter defaultCenter];
[NSDistributedNotificationCenter defaultCenter];
[distCenter addObserver:self
selector:@selector(onScreenLocked:)
name:@"com.apple.screenIsLocked"
object:nil];
selector:@selector(onScreenLocked:)
name:@"com.apple.screenIsLocked"
object:nil];
[distCenter addObserver:self
selector:@selector(onScreenUnlocked:)
name:@"com.apple.screenIsUnlocked"
object:nil];
selector:@selector(onScreenUnlocked:)
name:@"com.apple.screenIsUnlocked"
object:nil];
}
return self;
}

View file

@ -4,17 +4,18 @@
#include "atom/browser/api/atom_api_power_monitor.h"
#include <windows.h>
#include <wtsapi32.h>
#include "base/win/wrapped_window_proc.h"
#include "ui/base/win/shell.h"
#include "ui/gfx/win/hwnd_util.h"
#include "Wtsapi32.h"
namespace atom {
namespace {
const wchar_t kPowerMonitorWindowClass[] =
L"Electron_PowerMonitorHostWindow";
const wchar_t kPowerMonitorWindowClass[] = L"Electron_PowerMonitorHostWindow";
} // namespace
@ -24,8 +25,8 @@ void PowerMonitor::InitPlatformSpecificMonitors() {
WNDCLASSEX window_class;
base::win::InitializeWindowClass(
kPowerMonitorWindowClass,
&base::win::WrappedWindowProc<PowerMonitor::WndProcStatic>, 0, 0, 0,
NULL, NULL, NULL, NULL, NULL, &window_class);
&base::win::WrappedWindowProc<PowerMonitor::WndProcStatic>, 0, 0, 0, NULL,
NULL, NULL, NULL, NULL, &window_class);
instance_ = window_class.hInstance;
atom_ = RegisterClassEx(&window_class);
@ -41,11 +42,11 @@ void PowerMonitor::InitPlatformSpecificMonitors() {
}
LRESULT CALLBACK PowerMonitor::WndProcStatic(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam) {
PowerMonitor* msg_wnd = reinterpret_cast<PowerMonitor*>(
GetWindowLongPtr(hwnd, GWLP_USERDATA));
UINT message,
WPARAM wparam,
LPARAM lparam) {
PowerMonitor* msg_wnd =
reinterpret_cast<PowerMonitor*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (msg_wnd)
return msg_wnd->WndProc(hwnd, message, wparam, lparam);
else
@ -53,9 +54,9 @@ LRESULT CALLBACK PowerMonitor::WndProcStatic(HWND hwnd,
}
LRESULT CALLBACK PowerMonitor::WndProc(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam) {
UINT message,
WPARAM wparam,
LPARAM lparam) {
if (message == WM_WTSSESSION_CHANGE) {
if (wparam == WTS_SESSION_LOCK) {
Emit("lock-screen");

View file

@ -61,10 +61,8 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() {
device::mojom::WakeLockType new_blocker_type =
device::mojom::WakeLockType::kPreventAppSuspension;
for (const auto& element : power_save_blocker_types_) {
if (element.second ==
device::mojom::WakeLockType::kPreventDisplaySleep) {
new_blocker_type =
device::mojom::WakeLockType::kPreventDisplaySleep;
if (element.second == device::mojom::WakeLockType::kPreventDisplaySleep) {
new_blocker_type = device::mojom::WakeLockType::kPreventDisplaySleep;
break;
}
}

View file

@ -223,7 +223,7 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
// Remove this window from parent window's |child_windows_|.
void RemoveFromParentChildWindows();
template<typename... Args>
template <typename... Args>
void EmitEventSoon(base::StringPiece eventName) {
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,

View file

@ -150,8 +150,8 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
if (!save_path.empty()) {
callback.Run(save_path,
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
save_path, download::DOWNLOAD_INTERRUPT_REASON_NONE);
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, save_path,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}

View file

@ -11,7 +11,8 @@
NSUserActivityDelegate> {
@private
BOOL handlingSendEvent_;
base::scoped_nsobject<NSUserActivity> currentActivity_ API_AVAILABLE(macosx(10.10));
base::scoped_nsobject<NSUserActivity> currentActivity_
API_AVAILABLE(macosx(10.10));
NSCondition* handoffLock_;
BOOL updateReceived_;
base::Callback<bool()> shouldShutdown_;

View file

@ -5,8 +5,8 @@
#include "atom/browser/net/atom_url_request.h"
#include <string>
#include <memory>
#include <string>
#include <utility>
#include "atom/browser/api/atom_api_url_request.h"

View file

@ -6,8 +6,8 @@
#ifndef ATOM_BROWSER_NET_ATOM_URL_REQUEST_H_
#define ATOM_BROWSER_NET_ATOM_URL_REQUEST_H_
#include <string>
#include <memory>
#include <string>
#include <vector>
#include "atom/browser/api/atom_api_url_request.h"

View file

@ -8,10 +8,10 @@
namespace atom {
bool AtomMenuModel::Delegate::GetAcceleratorForCommandId(int command_id,
bool AtomMenuModel::Delegate::GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) const {
return GetAcceleratorForCommandIdWithParams(
command_id, false, accelerator);
return GetAcceleratorForCommandIdWithParams(command_id, false, accelerator);
}
AtomMenuModel::AtomMenuModel(Delegate* delegate)

View file

@ -224,17 +224,21 @@ bool ScopedDisableResize::disable_resize_ = false;
// Custom window button methods
- (BOOL)windowShouldClose:(id)sender { return YES; }
- (BOOL)windowShouldClose:(id)sender {
return YES;
}
- (void)performClose:(id)sender {
if (shell_->title_bar_style() ==
atom::NativeWindowMac::CUSTOM_BUTTONS_ON_HOVER) {
[[self delegate] windowShouldClose:self];
} else if (shell_->IsSimpleFullScreen()) {
if([[self delegate] respondsToSelector:@selector(windowShouldClose:)]) {
if(![[self delegate] windowShouldClose:self]) return;
} else if([self respondsToSelector:@selector(windowShouldClose:)]) {
if(![self windowShouldClose:self]) return;
if ([[self delegate] respondsToSelector:@selector(windowShouldClose:)]) {
if (![[self delegate] windowShouldClose:self])
return;
} else if ([self respondsToSelector:@selector(windowShouldClose:)]) {
if (![self windowShouldClose:self])
return;
}
[self close];
} else {

View file

@ -13,9 +13,8 @@ namespace atom {
class NativeWindowMac;
}
@interface AtomNSWindowDelegate :
ViewsNSWindowDelegate<NSTouchBarDelegate,
QLPreviewPanelDataSource> {
@interface AtomNSWindowDelegate
: ViewsNSWindowDelegate <NSTouchBarDelegate, QLPreviewPanelDataSource> {
@private
atom::NativeWindowMac* shell_;
bool is_zooming_;

View file

@ -8,9 +8,9 @@
#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>
@interface AtomPreviewItem : NSObject<QLPreviewItem>
@property (nonatomic, retain) NSURL* previewItemURL;
@property (nonatomic, retain) NSString* previewItemTitle;
@interface AtomPreviewItem : NSObject <QLPreviewItem>
@property(nonatomic, retain) NSURL* previewItemURL;
@property(nonatomic, retain) NSString* previewItemTitle;
- (id)initWithURL:(NSURL*)url title:(NSString*)title;
@end

View file

@ -150,8 +150,7 @@ static HRESULT ShowFileDialog(IFileDialog* dialog,
return dialog->Show(parent_window);
}
static void ApplySettings(IFileDialog* dialog,
const DialogSettings& settings) {
static void ApplySettings(IFileDialog* dialog, const DialogSettings& settings) {
std::wstring file_part;
if (!IsDirectory(settings.default_path))
@ -271,7 +270,7 @@ bool ShowSaveDialog(const DialogSettings& settings, base::FilePath* path) {
return false;
file_save_dialog->SetOptions(FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST |
FOS_OVERWRITEPROMPT);
FOS_OVERWRITEPROMPT);
ApplySettings(file_save_dialog, settings);
hr = ShowFileDialog(file_save_dialog, settings);

View file

@ -105,20 +105,20 @@ void WebContentsPermissionHelper::RequestMediaAccessPermission(
base::DictionaryValue details;
std::unique_ptr<base::ListValue> media_types(new base::ListValue);
if (request.audio_type
== content::MediaStreamType::MEDIA_DEVICE_AUDIO_CAPTURE) {
if (request.audio_type ==
content::MediaStreamType::MEDIA_DEVICE_AUDIO_CAPTURE) {
media_types->AppendString("audio");
}
if (request.video_type
== content::MediaStreamType::MEDIA_DEVICE_VIDEO_CAPTURE) {
if (request.video_type ==
content::MediaStreamType::MEDIA_DEVICE_VIDEO_CAPTURE) {
media_types->AppendString("video");
}
details.SetList("mediaTypes", std::move(media_types));
// The permission type doesn't matter here, AUDIO_CAPTURE/VIDEO_CAPTURE
// are presented as same type in content_converter.h.
RequestPermission(content::PermissionType::AUDIO_CAPTURE, callback,
false, &details);
RequestPermission(content::PermissionType::AUDIO_CAPTURE, callback, false,
&details);
}
void WebContentsPermissionHelper::RequestWebNotificationPermission(

View file

@ -4,8 +4,8 @@
#include "atom/common/native_mate_converters/net_converter.h"
#include <string>
#include <memory>
#include <string>
#include <utility>
#include <vector>

View file

@ -20,8 +20,8 @@
#include "chrome/renderer/printing/print_web_view_helper.h"
#include "content/public/renderer/render_frame.h"
#include "native_mate/dictionary.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_document.h"
#include "atom/common/node_includes.h"
#include "atom_natives.h" // NOLINT: This file is generated with js2c

View file

@ -26,13 +26,13 @@
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "native_mate/dictionary.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_custom_element.h" // NOLINT(build/include_alpha)
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_plugin_params.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_security_policy.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#if defined(OS_MACOSX)
#include "base/strings/sys_string_conversions.h"

View file

@ -29,7 +29,6 @@ base::LazyInstance<std::string>::DestructorAtExit
base::NoDestructor<std::string> g_application_locale;
void SetApplicationLocaleOnIOThread(const std::string& locale) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
g_io_thread_application_locale.Get() = locale;

View file

@ -56,8 +56,7 @@ scoped_refptr<BrowserContext> BrowserContext::Get(const std::string& partition,
}
BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
: in_memory_(in_memory),
weak_factory_(this) {
: in_memory_(in_memory), weak_factory_(this) {
if (!PathService::Get(DIR_USER_DATA, &path_)) {
PathService::Get(DIR_APP_DATA, &path_);
path_ = path_.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));

View file

@ -30,7 +30,7 @@ class CocoaNotification : public Notification {
void NotificationReplied(const std::string& reply);
void NotificationActivated();
void NotificationActivated(NSUserNotificationAction* action)
API_AVAILABLE(macosx(10.10));
API_AVAILABLE(macosx(10.10));
void NotificationDismissed();
NSUserNotification* notification() const { return notification_; }

View file

@ -40,7 +40,7 @@ HBITMAP CopyBitmap(HBITMAP bitmap) {
}
const TCHAR DesktopNotificationController::class_name_[] =
TEXT("DesktopNotificationController");
TEXT("DesktopNotificationController");
HINSTANCE DesktopNotificationController::RegisterWndClasses() {
// We keep a static `module` variable which serves a dual purpose:
@ -365,7 +365,7 @@ void DesktopNotificationController::DestroyToast(ToastInstance& inst) {
DesktopNotificationController::Notification::Notification() = default;
DesktopNotificationController::Notification::Notification(
const DesktopNotificationController::Notification&) = default;
const DesktopNotificationController::Notification&) = default;
DesktopNotificationController::Notification::Notification(
const shared_ptr<NotificationData>& data)

View file

@ -61,15 +61,14 @@ bool WindowsToastNotification::Initialize() {
if (IsRunningInDesktopBridge()) {
// Ironically, the Desktop Bridge / UWP environment
// requires us to not give Windows an appUserModelId.
return SUCCEEDED(
toast_manager_->CreateToastNotifier(&toast_notifier_));
return SUCCEEDED(toast_manager_->CreateToastNotifier(&toast_notifier_));
} else {
ScopedHString app_id;
if (!GetAppUserModelID(&app_id))
return false;
return SUCCEEDED(
toast_manager_->CreateToastNotifierWithId(app_id, &toast_notifier_));
toast_manager_->CreateToastNotifierWithId(app_id, &toast_notifier_));
}
}

View file

@ -1,6 +1,7 @@
#include "base/no_destructor.h"
#include "brightray/common/application_info.h"
#include "base/no_destructor.h"
namespace brightray {
namespace {

View file

@ -2,9 +2,9 @@
#include <windows.h> // windows.h must be included first
#include <VersionHelpers.h>
#include <appmodel.h>
#include <shlobj.h>
#include <VersionHelpers.h>
#include <memory>
@ -93,7 +93,7 @@ bool IsRunningInDesktopBridgeImpl() {
wchar_t packageFamilyName[PACKAGE_FAMILY_NAME_MAX_LENGTH + 1];
HANDLE proc = GetCurrentProcess();
LONG result =
(*get_package_family_namePtr)(proc, &length, packageFamilyName);
(*get_package_family_namePtr)(proc, &length, packageFamilyName);
return result == ERROR_SUCCESS;
} else {

View file

@ -28,8 +28,8 @@ bool SubprocessNeedsResourceBundle(const std::string& process_type) {
process_type == switches::kZygoteProcess ||
#endif
#if defined(OS_MACOSX)
// Mac needs them too for scrollbar related images and for sandbox
// profiles.
// Mac needs them too for scrollbar related images and for sandbox
// profiles.
process_type == switches::kPpapiPluginProcess ||
process_type == switches::kPpapiBrokerProcess ||
process_type == switches::kGpuProcess ||
@ -61,9 +61,10 @@ void LoadResourceBundle(const std::string& locale) {
bundle.AddDataPackFromPath(pak_dir.Append(FILE_PATH_LITERAL("resources.pak")),
ui::SCALE_FACTOR_NONE);
#if defined(ENABLE_PDF_VIEWER)
NOTIMPLEMENTED() << "Hi, whoever's fixing PDF support! Thanks! The pdf "
"viewer resources haven't been ported over to the GN build yet, so "
"you'll probably need to change this bit of code.";
NOTIMPLEMENTED()
<< "Hi, whoever's fixing PDF support! Thanks! The pdf "
"viewer resources haven't been ported over to the GN build yet, so "
"you'll probably need to change this bit of code.";
bundle.AddDataPackFromPath(
pak_dir.Append(FILE_PATH_LITERAL("pdf_viewer_resources.pak")),
ui::GetSupportedScaleFactors()[0]);

View file

@ -44,10 +44,8 @@ class GlobalShortcutListenerMac : public GlobalShortcutListener {
// GlobalShortcutListener implementation.
void StartListening() override;
void StopListening() override;
bool RegisterAcceleratorImpl(
const ui::Accelerator& accelerator) override;
void UnregisterAcceleratorImpl(
const ui::Accelerator& accelerator) override;
bool RegisterAcceleratorImpl(const ui::Accelerator& accelerator) override;
void UnregisterAcceleratorImpl(const ui::Accelerator& accelerator) override;
// Mac-specific functions for registering hot keys with modifiers.
bool RegisterHotKey(const ui::Accelerator& accelerator, KeyId hot_key_id);

View file

@ -5,6 +5,7 @@
#include "chrome/browser/icon_loader.h"
#include <windows.h>
#include <shellapi.h>
#include "base/bind.h"

View file

@ -24,10 +24,10 @@
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/common/chrome_utility_printing_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
#include "content/browser/utility_process_host.h"
#include "content/browser/utility_process_host_client.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
#include "printing/emf_win.h"
#include "printing/pdf_render_settings.h"
#include "ui/base/l10n/l10n_util.h"
@ -39,8 +39,8 @@ namespace printing {
namespace {
void CloseFileOnBlockingTaskRunner(base::File temp_file) {
base::AssertBlockingAllowed();
temp_file.Close();
base::AssertBlockingAllowed();
temp_file.Close();
}
class PdfConverterImpl;

View file

@ -24,8 +24,8 @@
#if defined(OS_WIN)
#include "chrome/browser/printing/pdf_to_emf_converter.h"
#include "printing/pdf_render_settings.h"
#include "printing/metafile.h"
#include "printing/pdf_render_settings.h"
#endif
using base::TimeDelta;
@ -264,8 +264,8 @@ void PrintJob::StartPdfToEmfConversion(
std::make_unique<PdfConversionState>(page_size, content_area);
const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings(
content_area, gfx::Point(0, 0), gfx::Size(kPrinterDpi, kPrinterDpi), /*autorotate=*/true,
settings_.color() == COLOR,
content_area, gfx::Point(0, 0), gfx::Size(kPrinterDpi, kPrinterDpi),
/*autorotate=*/true, settings_.color() == COLOR,
print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT
: PdfRenderSettings::Mode::NORMAL);
pdf_conversion_state_->Start(
@ -313,8 +313,8 @@ void PrintJob::StartPdfToPostScriptConversion(
std::make_unique<PdfConversionState>(gfx::Size(), gfx::Rect());
const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings(
content_area, physical_offsets, gfx::Size(kPrinterDpi, kPrinterDpi), true /* autorotate? */,
settings_.color() == COLOR,
content_area, physical_offsets, gfx::Size(kPrinterDpi, kPrinterDpi),
true /* autorotate? */, settings_.color() == COLOR,
ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3);
pdf_conversion_state_->Start(
@ -466,6 +466,8 @@ PrintedDocument* JobEventDetails::document() const {
}
#if defined(OS_WIN)
PrintedPage* JobEventDetails::page() const { return page_.get(); }
PrintedPage* JobEventDetails::page() const {
return page_.get();
}
#endif
} // namespace printing

View file

@ -41,10 +41,8 @@ class TtsControllerImpl : public TtsController {
void GetVoices(content::BrowserContext* browser_context,
std::vector<VoiceData>* out_voices) override;
void VoicesChanged() override;
void AddVoicesChangedDelegate(
VoicesChangedDelegate* delegate) override;
void RemoveVoicesChangedDelegate(
VoicesChangedDelegate* delegate) override;
void AddVoicesChangedDelegate(VoicesChangedDelegate* delegate) override;
void RemoveVoicesChangedDelegate(VoicesChangedDelegate* delegate) override;
void SetTtsEngineDelegate(TtsEngineDelegate* delegate) override;
TtsEngineDelegate* GetTtsEngineDelegate() override;
void SetPlatformImpl(TtsPlatformImpl* platform_impl) override;

View file

@ -5,8 +5,8 @@
#include <math.h>
#include <objbase.h>
#include <sapi.h>
#include <wrl/client.h>
#include <sphelper.h>
#include <wrl/client.h>
#include "base/memory/singleton.h"
#include "base/strings/string_number_conversions.h"

View file

@ -416,7 +416,7 @@ bool PathProvider(int key, base::FilePath* result) {
return false;
cur =
cur.Append(GetWidevinePath())
.AppendASCII(base::GetNativeLibraryName(kWidevineCdmLibraryName));
.AppendASCII(base::GetNativeLibraryName(kWidevineCdmLibraryName));
break;
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
case chrome::FILE_RESOURCES_PACK:

View file

@ -37,8 +37,7 @@ class TtsDispatcher : public blink::WebSpeechSynthesizer,
// blink::WebSpeechSynthesizer implementation.
void UpdateVoiceList() override;
void Speak(const blink::WebSpeechSynthesisUtterance& utterance)
override;
void Speak(const blink::WebSpeechSynthesisUtterance& utterance) override;
void Pause() override;
void Resume() override;
void Cancel() override;

View file

@ -156,7 +156,8 @@ bool PrintingHandlerWin::RenderPdfPageToMetafile(int page_number,
if (!chrome_pdf::RenderPDFPageToDC(
&pdf_data_.front(), pdf_data_.size(), page_number, metafile.context(),
pdf_rendering_settings_.dpi.width(), pdf_rendering_settings_.dpi.height(),
pdf_rendering_settings_.dpi.width(),
pdf_rendering_settings_.dpi.height(),
pdf_rendering_settings_.area.x() - offset_x,
pdf_rendering_settings_.area.y() - offset_y,
pdf_rendering_settings_.area.width(),