From 30f1d0991b708226a2b53feffb051e657e654741 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 18 Apr 2018 15:39:45 +0530 Subject: [PATCH] enable chromium style checker plugin for electron and brightray targets --- atom/browser/api/atom_api_menu_mac.mm | 25 ++++++----- atom/browser/api/atom_api_web_contents.cc | 3 +- atom/browser/net/atom_network_delegate.cc | 6 ++- atom/browser/ui/atom_menu_model.h | 5 ++- atom/browser/ui/cocoa/atom_touch_bar.h | 44 +++++++++++++------- atom/browser/ui/views/autofill_popup_view.cc | 13 ++++-- toolchain.gypi | 37 ++++++++++++++++ 7 files changed, 96 insertions(+), 37 deletions(-) diff --git a/atom/browser/api/atom_api_menu_mac.mm b/atom/browser/api/atom_api_menu_mac.mm index 6e7c891da176..c2516f4528aa 100644 --- a/atom/browser/api/atom_api_menu_mac.mm +++ b/atom/browser/api/atom_api_menu_mac.mm @@ -21,23 +21,22 @@ namespace atom { namespace api { MenuMac::MenuMac(v8::Isolate* isolate, v8::Local wrapper) - : Menu(isolate, wrapper), - weak_factory_(this) { -} + : Menu(isolate, wrapper), weak_factory_(this) {} MenuMac::~MenuMac() = default; void MenuMac::PopupAt(TopLevelWindow* window, - int x, int y, int positioning_item, + int x, + int y, + int positioning_item, const base::Closure& callback) { NativeWindow* native_window = window->window(); if (!native_window) return; auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(), - native_window->GetWeakPtr(), - window->weak_map_id(), x, y, - positioning_item, callback); + native_window->GetWeakPtr(), window->weak_map_id(), x, + y, positioning_item, callback); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, popup); } @@ -53,9 +52,9 @@ void MenuMac::PopupOnUI(const base::WeakPtr& native_window, auto close_callback = base::Bind( &MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback); - popup_controllers_[window_id] = base::scoped_nsobject( - [[AtomMenuController alloc] initWithModel:model() - useDefaultAccelerator:NO]); + popup_controllers_[window_id] = base::scoped_nsobject([ + [AtomMenuController alloc] initWithModel:model() + useDefaultAccelerator:NO]); NSMenu* menu = [popup_controllers_[window_id] menu]; NSView* view = [nswindow contentView]; @@ -130,9 +129,9 @@ void MenuMac::OnClosed(int32_t window_id, base::Closure callback) { // static void Menu::SetApplicationMenu(Menu* base_menu) { MenuMac* menu = static_cast(base_menu); - base::scoped_nsobject menu_controller( - [[AtomMenuController alloc] initWithModel:menu->model_.get() - useDefaultAccelerator:YES]); + base::scoped_nsobject menu_controller([ + [AtomMenuController alloc] initWithModel:menu->model_.get() + useDefaultAccelerator:YES]); [NSApp setMainMenu:[menu_controller menu]]; // Ensure the menu_controller_ is destroyed after main menu is set. diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 0d136268e3fe..69911ae1a182 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -675,7 +675,8 @@ content::KeyboardEventProcessingResult WebContents::PreHandleKeyboardEvent( void WebContents::EnterFullscreenModeForTab(content::WebContents* source, const GURL& origin) { - auto* permission_helper = WebContentsPermissionHelper::FromWebContents(source); + auto* permission_helper = + WebContentsPermissionHelper::FromWebContents(source); auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab, base::Unretained(this), source, origin); permission_helper->RequestFullscreenPermission(callback); diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index f5225f25e0fa..62d6769263c8 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -219,13 +219,15 @@ void ReadFromResponseObject(const base::DictionaryValue& response, AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo( URLPatterns patterns_, - SimpleListener listener_): url_patterns(patterns_), listener(listener_) {} + SimpleListener listener_) + : url_patterns(patterns_), listener(listener_) {} AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo() = default; AtomNetworkDelegate::SimpleListenerInfo::~SimpleListenerInfo() = default; AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo( URLPatterns patterns_, - ResponseListener listener_): url_patterns(patterns_), listener(listener_) {} + ResponseListener listener_) + : url_patterns(patterns_), listener(listener_) {} AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo() = default; AtomNetworkDelegate::ResponseListenerInfo::~ResponseListenerInfo() = default; diff --git a/atom/browser/ui/atom_menu_model.h b/atom/browser/ui/atom_menu_model.h index e77082adcb1a..efdd8ec9d883 100644 --- a/atom/browser/ui/atom_menu_model.h +++ b/atom/browser/ui/atom_menu_model.h @@ -25,8 +25,9 @@ class AtomMenuModel : public ui::SimpleMenuModel { private: // ui::SimpleMenuModel::Delegate: - bool GetAcceleratorForCommandId(int command_id, - ui::Accelerator* accelerator) const override; + bool GetAcceleratorForCommandId( + int command_id, + ui::Accelerator* accelerator) const override; }; class Observer { diff --git a/atom/browser/ui/cocoa/atom_touch_bar.h b/atom/browser/ui/cocoa/atom_touch_bar.h index 80fda66ee642..fd6bb0cdc449 100644 --- a/atom/browser/ui/cocoa/atom_touch_bar.h +++ b/atom/browser/ui/cocoa/atom_touch_bar.h @@ -32,15 +32,18 @@ settings:(const std::vector&)settings; - (NSTouchBar*)makeTouchBar API_AVAILABLE(macosx(10.12.2)); -- (NSTouchBar*)touchBarFromItemIdentifiers:(NSMutableArray*)items API_AVAILABLE(macosx(10.12.2)); +- (NSTouchBar*)touchBarFromItemIdentifiers:(NSMutableArray*)items + API_AVAILABLE(macosx(10.12.2)); - (NSMutableArray*)identifiersFromSettings: (const std::vector&)settings; - (void)refreshTouchBarItem:(NSTouchBar*)touchBar - id:(const std::string&)item_id API_AVAILABLE(macosx(10.12.2)); + id:(const std::string&)item_id + API_AVAILABLE(macosx(10.12.2)); - (void)addNonDefaultTouchBarItems: (const std::vector&)items; - (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item - forTouchBar:(NSTouchBar*)touchBar API_AVAILABLE(macosx(10.12.2)); + forTouchBar:(NSTouchBar*)touchBar + API_AVAILABLE(macosx(10.12.2)); - (NSString*)idFromIdentifier:(NSString*)identifier withPrefix:(NSString*)prefix; @@ -56,31 +59,42 @@ // Helpers to create touch bar items - (NSTouchBarItem*)makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier - API_AVAILABLE(macosx(10.12.2)); + API_AVAILABLE(macosx(10.12.2)); - (NSTouchBarItem*)makeButtonForID:(NSString*)id - withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)); + withIdentifier:(NSString*)identifier + API_AVAILABLE(macosx(10.12.2)); - (NSTouchBarItem*)makeLabelForID:(NSString*)id - withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)); + withIdentifier:(NSString*)identifier + API_AVAILABLE(macosx(10.12.2)); - (NSTouchBarItem*)makeColorPickerForID:(NSString*)id - withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)); + withIdentifier:(NSString*)identifier + API_AVAILABLE(macosx(10.12.2)); - (NSTouchBarItem*)makeSliderForID:(NSString*)id - withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)); + withIdentifier:(NSString*)identifier + API_AVAILABLE(macosx(10.12.2)); - (NSTouchBarItem*)makePopoverForID:(NSString*)id - withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)); + withIdentifier:(NSString*)identifier + API_AVAILABLE(macosx(10.12.2)); - (NSTouchBarItem*)makeGroupForID:(NSString*)id - withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)); + withIdentifier:(NSString*)identifier + API_AVAILABLE(macosx(10.12.2)); // Helpers to update touch bar items - (void)updateButton:(NSCustomTouchBarItem*)item - withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)); + withSettings:(const mate::PersistentDictionary&)settings + API_AVAILABLE(macosx(10.12.2)); - (void)updateLabel:(NSCustomTouchBarItem*)item - withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)); + withSettings:(const mate::PersistentDictionary&)settings + API_AVAILABLE(macosx(10.12.2)); - (void)updateColorPicker:(NSColorPickerTouchBarItem*)item - withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)); + withSettings:(const mate::PersistentDictionary&)settings + API_AVAILABLE(macosx(10.12.2)); - (void)updateSlider:(NSSliderTouchBarItem*)item - withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)); + withSettings:(const mate::PersistentDictionary&)settings + API_AVAILABLE(macosx(10.12.2)); - (void)updatePopover:(NSPopoverTouchBarItem*)item - withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)); + withSettings:(const mate::PersistentDictionary&)settings + API_AVAILABLE(macosx(10.12.2)); @end diff --git a/atom/browser/ui/views/autofill_popup_view.cc b/atom/browser/ui/views/autofill_popup_view.cc index bad75ec9b19c..bea0e949d87d 100644 --- a/atom/browser/ui/views/autofill_popup_view.cc +++ b/atom/browser/ui/views/autofill_popup_view.cc @@ -133,13 +133,18 @@ void AutofillPopupView::OnSuggestionsChanged() { DoUpdateBoundsAndRedrawPopup(); } -int AutofillPopupView::GetDragOperationsForView( - views::View*, const gfx::Point&) { +void AutofillPopupView::WriteDragDataForView(views::View*, + const gfx::Point&, + ui::OSExchangeData*) {} + +int AutofillPopupView::GetDragOperationsForView(views::View*, + const gfx::Point&) { return ui::DragDropTypes::DRAG_NONE; } -bool AutofillPopupView::CanStartDragForView( - views::View*, const gfx::Point&, const gfx::Point&) { +bool AutofillPopupView::CanStartDragForView(views::View*, + const gfx::Point&, + const gfx::Point&) { return false; } diff --git a/toolchain.gypi b/toolchain.gypi index 0b4ffa3e5eb9..74d8e7508e6a 100644 --- a/toolchain.gypi +++ b/toolchain.gypi @@ -122,6 +122,43 @@ 'CLANG_CXX_LANGUAGE_STANDARD': 'c++14', # -std=c++14 }, 'target_conditions': [ + ['_target_name in ["electron", "brightray"]', { + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'OTHER_CFLAGS': [ + "-Xclang", + "-load", + "-Xclang", + "<(source_root)/<(make_clang_dir)/lib/libFindBadConstructs.dylib", + "-Xclang", + "-add-plugin", + "-Xclang", + "find-bad-constructs", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "check-auto-raw-pointer", + ], + }, + }, { # OS=="mac" + 'cflags_cc': [ + "-Xclang", + "-load", + "-Xclang", + "<(source_root)/<(make_clang_dir)/lib/libFindBadConstructs.so", + "-Xclang", + "-add-plugin", + "-Xclang", + "find-bad-constructs", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "check-auto-raw-pointer", + ], + }], + ], + }], ['OS=="mac" and _type in ["executable", "shared_library"]', { 'xcode_settings': { # On some machines setting CLANG_CXX_LIBRARY doesn't work for