mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
chrome: Support customization of context menus (see issue #2969)
This commit is contained in:
@@ -321,24 +321,32 @@ void ClientHandler::OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
if (model->GetCount() > 0)
|
||||
model->AddSeparator();
|
||||
|
||||
// Add DevTools items to all context menus.
|
||||
model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools");
|
||||
model->AddItem(CLIENT_ID_CLOSE_DEVTOOLS, "Close DevTools");
|
||||
model->AddSeparator();
|
||||
model->AddItem(CLIENT_ID_INSPECT_ELEMENT, "Inspect Element");
|
||||
const bool use_chrome_runtime = MainContext::Get()->UseChromeRuntime();
|
||||
if (!use_chrome_runtime) {
|
||||
// TODO(chrome-runtime): Add support for this.
|
||||
// Add DevTools items to all context menus.
|
||||
model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools");
|
||||
model->AddItem(CLIENT_ID_CLOSE_DEVTOOLS, "Close DevTools");
|
||||
model->AddSeparator();
|
||||
model->AddItem(CLIENT_ID_INSPECT_ELEMENT, "Inspect Element");
|
||||
}
|
||||
|
||||
if (HasSSLInformation(browser)) {
|
||||
model->AddSeparator();
|
||||
model->AddItem(CLIENT_ID_SHOW_SSL_INFO, "Show SSL information");
|
||||
}
|
||||
|
||||
model->AddSeparator();
|
||||
model->AddItem(CLIENT_ID_CURSOR_CHANGE_DISABLED, "Cursor change disabled");
|
||||
if (mouse_cursor_change_disabled_)
|
||||
model->SetChecked(CLIENT_ID_CURSOR_CHANGE_DISABLED, true);
|
||||
if (!use_chrome_runtime) {
|
||||
// TODO(chrome-runtime): Add support for this.
|
||||
model->AddSeparator();
|
||||
model->AddCheckItem(CLIENT_ID_CURSOR_CHANGE_DISABLED,
|
||||
"Cursor change disabled");
|
||||
if (mouse_cursor_change_disabled_)
|
||||
model->SetChecked(CLIENT_ID_CURSOR_CHANGE_DISABLED, true);
|
||||
}
|
||||
|
||||
model->AddSeparator();
|
||||
model->AddItem(CLIENT_ID_OFFLINE, "Offline mode");
|
||||
model->AddCheckItem(CLIENT_ID_OFFLINE, "Offline mode");
|
||||
if (offline_)
|
||||
model->SetChecked(CLIENT_ID_OFFLINE, true);
|
||||
|
||||
|
@@ -38,6 +38,9 @@ class MainContext {
|
||||
// Returns the background color.
|
||||
virtual cef_color_t GetBackgroundColor() = 0;
|
||||
|
||||
// Returns true if the Chrome runtime will be used.
|
||||
virtual bool UseChromeRuntime() = 0;
|
||||
|
||||
// Returns true if the Views framework will be used.
|
||||
virtual bool UseViews() = 0;
|
||||
|
||||
|
@@ -171,6 +171,10 @@ cef_color_t MainContextImpl::GetBackgroundColor() {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
bool MainContextImpl::UseChromeRuntime() {
|
||||
return use_chrome_runtime_;
|
||||
}
|
||||
|
||||
bool MainContextImpl::UseViews() {
|
||||
return use_views_;
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ class MainContextImpl : public MainContext {
|
||||
std::string GetAppWorkingDirectory() OVERRIDE;
|
||||
std::string GetMainURL() OVERRIDE;
|
||||
cef_color_t GetBackgroundColor() OVERRIDE;
|
||||
bool UseChromeRuntime() OVERRIDE;
|
||||
bool UseViews() OVERRIDE;
|
||||
bool UseWindowlessRendering() OVERRIDE;
|
||||
bool TouchEventsEnabled() OVERRIDE;
|
||||
|
Reference in New Issue
Block a user