enable chromium style checker plugin for electron and brightray targets

This commit is contained in:
deepak1556 2018-04-18 15:39:45 +05:30 committed by Jeremy Apthorp
parent 7c5fcecbec
commit 30f1d0991b
7 changed files with 96 additions and 37 deletions

View file

@ -21,23 +21,22 @@ namespace atom {
namespace api { namespace api {
MenuMac::MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper) MenuMac::MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
: Menu(isolate, wrapper), : Menu(isolate, wrapper), weak_factory_(this) {}
weak_factory_(this) {
}
MenuMac::~MenuMac() = default; MenuMac::~MenuMac() = default;
void MenuMac::PopupAt(TopLevelWindow* window, void MenuMac::PopupAt(TopLevelWindow* window,
int x, int y, int positioning_item, int x,
int y,
int positioning_item,
const base::Closure& callback) { const base::Closure& callback) {
NativeWindow* native_window = window->window(); NativeWindow* native_window = window->window();
if (!native_window) if (!native_window)
return; return;
auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(), auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(),
native_window->GetWeakPtr(), native_window->GetWeakPtr(), window->weak_map_id(), x,
window->weak_map_id(), x, y, y, positioning_item, callback);
positioning_item, callback);
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, popup); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, popup);
} }
@ -53,9 +52,9 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
auto close_callback = base::Bind( auto close_callback = base::Bind(
&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback); &MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback);
popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>( popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>([
[[AtomMenuController alloc] initWithModel:model() [AtomMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO]); useDefaultAccelerator:NO]);
NSMenu* menu = [popup_controllers_[window_id] menu]; NSMenu* menu = [popup_controllers_[window_id] menu];
NSView* view = [nswindow contentView]; NSView* view = [nswindow contentView];
@ -130,9 +129,9 @@ void MenuMac::OnClosed(int32_t window_id, base::Closure callback) {
// static // static
void Menu::SetApplicationMenu(Menu* base_menu) { void Menu::SetApplicationMenu(Menu* base_menu) {
MenuMac* menu = static_cast<MenuMac*>(base_menu); MenuMac* menu = static_cast<MenuMac*>(base_menu);
base::scoped_nsobject<AtomMenuController> menu_controller( base::scoped_nsobject<AtomMenuController> menu_controller([
[[AtomMenuController alloc] initWithModel:menu->model_.get() [AtomMenuController alloc] initWithModel:menu->model_.get()
useDefaultAccelerator:YES]); useDefaultAccelerator:YES]);
[NSApp setMainMenu:[menu_controller menu]]; [NSApp setMainMenu:[menu_controller menu]];
// Ensure the menu_controller_ is destroyed after main menu is set. // Ensure the menu_controller_ is destroyed after main menu is set.

View file

@ -675,7 +675,8 @@ content::KeyboardEventProcessingResult WebContents::PreHandleKeyboardEvent(
void WebContents::EnterFullscreenModeForTab(content::WebContents* source, void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
const GURL& origin) { const GURL& origin) {
auto* permission_helper = WebContentsPermissionHelper::FromWebContents(source); auto* permission_helper =
WebContentsPermissionHelper::FromWebContents(source);
auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab, auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab,
base::Unretained(this), source, origin); base::Unretained(this), source, origin);
permission_helper->RequestFullscreenPermission(callback); permission_helper->RequestFullscreenPermission(callback);

View file

@ -219,13 +219,15 @@ void ReadFromResponseObject(const base::DictionaryValue& response,
AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo( AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo(
URLPatterns patterns_, 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::SimpleListenerInfo::~SimpleListenerInfo() = default; AtomNetworkDelegate::SimpleListenerInfo::~SimpleListenerInfo() = default;
AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo( AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo(
URLPatterns patterns_, URLPatterns patterns_,
ResponseListener listener_): url_patterns(patterns_), listener(listener_) {} ResponseListener listener_)
: url_patterns(patterns_), listener(listener_) {}
AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo() = default; AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo() = default;
AtomNetworkDelegate::ResponseListenerInfo::~ResponseListenerInfo() = default; AtomNetworkDelegate::ResponseListenerInfo::~ResponseListenerInfo() = default;

View file

@ -25,8 +25,9 @@ class AtomMenuModel : public ui::SimpleMenuModel {
private: private:
// ui::SimpleMenuModel::Delegate: // ui::SimpleMenuModel::Delegate:
bool GetAcceleratorForCommandId(int command_id, bool GetAcceleratorForCommandId(
ui::Accelerator* accelerator) const override; int command_id,
ui::Accelerator* accelerator) const override;
}; };
class Observer { class Observer {

View file

@ -32,15 +32,18 @@
settings:(const std::vector<mate::PersistentDictionary>&)settings; settings:(const std::vector<mate::PersistentDictionary>&)settings;
- (NSTouchBar*)makeTouchBar API_AVAILABLE(macosx(10.12.2)); - (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: - (NSMutableArray*)identifiersFromSettings:
(const std::vector<mate::PersistentDictionary>&)settings; (const std::vector<mate::PersistentDictionary>&)settings;
- (void)refreshTouchBarItem:(NSTouchBar*)touchBar - (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: - (void)addNonDefaultTouchBarItems:
(const std::vector<mate::PersistentDictionary>&)items; (const std::vector<mate::PersistentDictionary>&)items;
- (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item - (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 - (NSString*)idFromIdentifier:(NSString*)identifier
withPrefix:(NSString*)prefix; withPrefix:(NSString*)prefix;
@ -56,31 +59,42 @@
// Helpers to create touch bar items // Helpers to create touch bar items
- (NSTouchBarItem*)makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier - (NSTouchBarItem*)makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
API_AVAILABLE(macosx(10.12.2)); API_AVAILABLE(macosx(10.12.2));
- (NSTouchBarItem*)makeButtonForID:(NSString*)id - (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 - (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 - (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 - (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 - (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 - (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 // Helpers to update touch bar items
- (void)updateButton:(NSCustomTouchBarItem*)item - (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 - (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 - (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 - (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 - (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 @end

View file

@ -133,13 +133,18 @@ void AutofillPopupView::OnSuggestionsChanged() {
DoUpdateBoundsAndRedrawPopup(); DoUpdateBoundsAndRedrawPopup();
} }
int AutofillPopupView::GetDragOperationsForView( void AutofillPopupView::WriteDragDataForView(views::View*,
views::View*, const gfx::Point&) { const gfx::Point&,
ui::OSExchangeData*) {}
int AutofillPopupView::GetDragOperationsForView(views::View*,
const gfx::Point&) {
return ui::DragDropTypes::DRAG_NONE; return ui::DragDropTypes::DRAG_NONE;
} }
bool AutofillPopupView::CanStartDragForView( bool AutofillPopupView::CanStartDragForView(views::View*,
views::View*, const gfx::Point&, const gfx::Point&) { const gfx::Point&,
const gfx::Point&) {
return false; return false;
} }

View file

@ -122,6 +122,43 @@
'CLANG_CXX_LANGUAGE_STANDARD': 'c++14', # -std=c++14 'CLANG_CXX_LANGUAGE_STANDARD': 'c++14', # -std=c++14
}, },
'target_conditions': [ '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"]', { ['OS=="mac" and _type in ["executable", "shared_library"]', {
'xcode_settings': { 'xcode_settings': {
# On some machines setting CLANG_CXX_LIBRARY doesn't work for # On some machines setting CLANG_CXX_LIBRARY doesn't work for