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 {
MenuMac::MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> 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<NativeWindow>& native_window,
auto close_callback = base::Bind(
&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback);
popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>(
[[AtomMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO]);
popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>([
[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<MenuMac*>(base_menu);
base::scoped_nsobject<AtomMenuController> menu_controller(
[[AtomMenuController alloc] initWithModel:menu->model_.get()
useDefaultAccelerator:YES]);
base::scoped_nsobject<AtomMenuController> 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.

View file

@ -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);

View file

@ -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;

View file

@ -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 {

View file

@ -32,15 +32,18 @@
settings:(const std::vector<mate::PersistentDictionary>&)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<mate::PersistentDictionary>&)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<mate::PersistentDictionary>&)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

View file

@ -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;
}

View file

@ -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