-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove duplicated separator in page context menu
fixes brave/brave-browser#15714 Override of RenderViewContextMenuViews::Show is used
- Loading branch information
1 parent
6fd2784
commit 702d950
Showing
6 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
browser/ui/views/renderer_context_menu/brave_render_view_context_menu_views.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/ui/views/renderer_context_menu/brave_render_view_context_menu_views.h" | ||
|
||
BraveRenderViewContextMenuViews::BraveRenderViewContextMenuViews( | ||
content::RenderFrameHost* render_frame_host, | ||
const content::ContextMenuParams& params) | ||
: RenderViewContextMenuViews(render_frame_host, params) {} | ||
|
||
BraveRenderViewContextMenuViews::~BraveRenderViewContextMenuViews() = default; | ||
|
||
// static | ||
RenderViewContextMenuViews* BraveRenderViewContextMenuViews::Create( | ||
content::RenderFrameHost* render_frame_host, | ||
const content::ContextMenuParams& params) { | ||
return new BraveRenderViewContextMenuViews(render_frame_host, params); | ||
} | ||
|
||
void BraveRenderViewContextMenuViews::Show() { | ||
// Removes duplicated separator if any. The duplicated separator may appear | ||
// in |BraveRenderViewContextMenu::InitMenu| after remove the translate menu | ||
// item. | ||
RemoveAdjacentSeparators(); | ||
RenderViewContextMenuViews::Show(); | ||
} |
31 changes: 31 additions & 0 deletions
31
browser/ui/views/renderer_context_menu/brave_render_view_context_menu_views.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_UI_VIEWS_RENDERER_CONTEXT_MENU_BRAVE_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_ | ||
#define BRAVE_BROWSER_UI_VIEWS_RENDERER_CONTEXT_MENU_BRAVE_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_ | ||
|
||
#include "chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.h" | ||
|
||
class BraveRenderViewContextMenuViews : public RenderViewContextMenuViews { | ||
public: | ||
~BraveRenderViewContextMenuViews() override; | ||
BraveRenderViewContextMenuViews(const BraveRenderViewContextMenuViews&) = | ||
delete; | ||
BraveRenderViewContextMenuViews& operator=( | ||
const BraveRenderViewContextMenuViews&) = delete; | ||
|
||
// Factory function to create an instance. | ||
static RenderViewContextMenuViews* Create( | ||
content::RenderFrameHost* render_frame_host, | ||
const content::ContextMenuParams& params); | ||
|
||
void Show() override; | ||
|
||
protected: | ||
BraveRenderViewContextMenuViews(content::RenderFrameHost* render_frame_host, | ||
const content::ContextMenuParams& params); | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_UI_VIEWS_RENDERER_CONTEXT_MENU_BRAVE_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include_rules = [ | ||
"+../../../../../../../chrome/browser/ui/views/tab_contents", | ||
] |
10 changes: 10 additions & 0 deletions
10
chromium_src/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/ui/views/renderer_context_menu/brave_render_view_context_menu_views.h" | ||
|
||
#define RenderViewContextMenuViews BraveRenderViewContextMenuViews | ||
#include "../../../../../../../chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc" | ||
#undef RenderViewContextMenuViews |