Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fc-pregmod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pregmodfan
fc-pregmod
Commits
db77ff9d
Commit
db77ff9d
authored
1 year ago
by
svornost
Browse files
Options
Downloads
Patches
Plain Diff
Add context menu item to allow saving images from FCHost.
parent
49f4a26d
No related branches found
No related tags found
1 merge request
!11639
Add context menu item to allow saving images from FCHost
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
FCHost/fchost/fchost_handler.cc
+29
-0
29 additions, 0 deletions
FCHost/fchost/fchost_handler.cc
FCHost/fchost/fchost_handler.h
+13
-0
13 additions, 0 deletions
FCHost/fchost/fchost_handler.h
with
42 additions
and
0 deletions
FCHost/fchost/fchost_handler.cc
+
29
−
0
View file @
db77ff9d
...
...
@@ -242,6 +242,35 @@ bool FCHostHandler::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
}
void
FCHostHandler
::
OnBeforeContextMenu
(
CefRefPtr
<
CefBrowser
>
browser
,
CefRefPtr
<
CefFrame
>
frame
,
CefRefPtr
<
CefContextMenuParams
>
params
,
CefRefPtr
<
CefMenuModel
>
model
)
{
CEF_REQUIRE_UI_THREAD
();
if
(
params
->
HasImageContents
()
&&
params
->
GetSourceUrl
()
!=
""
)
model
->
AddItem
(
MENU_ID_USER_FIRST
,
"Save Image..."
);
}
bool
FCHostHandler
::
OnContextMenuCommand
(
CefRefPtr
<
CefBrowser
>
browser
,
CefRefPtr
<
CefFrame
>
frame
,
CefRefPtr
<
CefContextMenuParams
>
params
,
int
command_id
,
EventFlags
event_flags
)
{
CEF_REQUIRE_UI_THREAD
();
switch
(
command_id
)
{
case
MENU_ID_USER_FIRST
:
browser
->
GetHost
()
->
StartDownload
(
params
->
GetSourceUrl
());
return
true
;
default:
return
false
;
}
}
void
FCHostHandler
::
CloseAllBrowsers
(
bool
force_close
)
{
if
(
!
CefCurrentlyOn
(
TID_UI
))
{
// Execute on the UI thread.
...
...
This diff is collapsed.
Click to expand it.
FCHost/fchost/fchost_handler.h
+
13
−
0
View file @
db77ff9d
...
...
@@ -14,6 +14,7 @@ class FCHostHandler : public CefClient,
public
CefLoadHandler
,
public
CefDownloadHandler
,
public
CefKeyboardHandler
,
public
CefContextMenuHandler
,
private
CefDialogHandler
{
public:
explicit
FCHostHandler
(
bool
use_views
);
...
...
@@ -32,6 +33,7 @@ class FCHostHandler : public CefClient,
virtual
CefRefPtr
<
CefLoadHandler
>
GetLoadHandler
()
override
{
return
this
;
}
virtual
CefRefPtr
<
CefDownloadHandler
>
GetDownloadHandler
()
override
{
return
this
;
}
virtual
CefRefPtr
<
CefKeyboardHandler
>
GetKeyboardHandler
()
override
{
return
this
;
}
virtual
CefRefPtr
<
CefContextMenuHandler
>
GetContextMenuHandler
()
override
{
return
this
;
}
CefRefPtr
<
CefDialogHandler
>
GetDialogHandler
()
override
{
return
this
;
}
bool
OnFileDialog
(
CefRefPtr
<
CefBrowser
>
browser
,
CefDialogHandler
::
FileDialogMode
mode
,
...
...
@@ -74,6 +76,17 @@ class FCHostHandler : public CefClient,
CefEventHandle
os_event
,
bool
*
is_keyboard_shortcut
)
override
;
// CefContextMenuHandler methods:
virtual
void
OnBeforeContextMenu
(
CefRefPtr
<
CefBrowser
>
browser
,
CefRefPtr
<
CefFrame
>
frame
,
CefRefPtr
<
CefContextMenuParams
>
params
,
CefRefPtr
<
CefMenuModel
>
model
)
override
;
virtual
bool
OnContextMenuCommand
(
CefRefPtr
<
CefBrowser
>
browser
,
CefRefPtr
<
CefFrame
>
frame
,
CefRefPtr
<
CefContextMenuParams
>
params
,
int
command_id
,
EventFlags
event_flags
)
override
;
// Request that all existing browser windows close.
void
CloseAllBrowsers
(
bool
force_close
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment