1、在 ..\src\ui\base\events\event.h 里面添加鼠标双击判断事件
bool IsRightMouseDoubleClick() const {
return (flags() & EF_IS_DOUBLE_CLICK) != 0;
}
2、在..\src\chrome\browser\ui\views\tabs\tab.cc
bool Tab::OnMousePressed(const ui::MouseEvent& event) {
if (!controller())
return false;
controller()->OnMouseEventInTab(this, event);
// add by acai 2014-07-01
if (event.IsRightMouseDoubleClick()){
Tab* closest_tab = controller()->GetTabAt(this, event.location());
if (closest_tab){
controller()->CloseTab(closest_tab, CLOSE_TAB_FROM_MOUSE);
return true;
}
}// end add by acai
// Allow a right click from touch to drag, which corresponds to a long click.
if (event.IsOnlyLeftMouseButton() ||
(event.IsOnlyRightMouseButton() && event.flags() & ui::EF_FROM_TOUCH)) {
ui::ListSelectionModel original_selection;
original_selection.Copy(controller()->GetSelectionModel());
// Changing the selection may cause our bounds to change. If that happens
// the location of the event may no longer be valid. Create a copy of the
// event in the parents coordinate, which won't change, and recreate an
// event after changing so the coordinates are correct.
ui::MouseEvent event_in_parent(event, static_cast<View*>(this), parent());
if (controller()->SupportsMultipleSelection()) {
if (event.IsShiftDown() && event.IsControlDown()) {
controller()->AddSelectionFromAnchorTo(this);
} else if (event.IsShiftDown()) {
controller()->ExtendSelectionTo(this);
} else if (event.IsControlDown()) {
controller()->ToggleSelected(this);
if (!IsSelected()) {
// Don't allow dragging non-selected tabs.
return false;
}
} else if (!IsSelected()) {
controller()->SelectTab(this);
}
} else if (!IsSelected()) {
controller()->SelectTab(this);
}
ui::MouseEvent cloned_event(event_in_parent, parent(),
static_cast<View*>(this));
controller()->MaybeStartDrag(this, cloned_event, original_selection);
}
return true;
}
OK,搞定。。。