JNIEXPORT jobject JNICALL Java_org_cef_misc_CefPrintSettings_1N_N_1Copy
  (JNIEnv *env, jobject obj) {
  CefRefPtr<CefPrintSettings> settings =
      GetCefFromJNIObject<CefPrintSettings>(env, obj, "CefPrintSettings");
  if (!settings)
    return NULL;

  jobject jresult = NewJNIObject(env, "org/cef/misc/CefPrintSettings_N");
  if (!jresult)
    return NULL;

  CefRefPtr<CefPrintSettings> copy_of_settings = settings->Copy();
  if (!copy_of_settings)
    return NULL;
  SetCefForJNIObject(env, jresult, copy_of_settings.get(), "CefPrintSettings");
  return jresult;
}
void FUnrealCEFSubProcessRemoteScripting::InitPermanentBindings(int32 BrowserID, CefRefPtr<CefDictionaryValue> Values)
{
	// The CefDictionary in PermanentBindings needs to be writable, so we'll copy the Values argument before saving it.
	PermanentBindings.Add(BrowserID, Values->Copy(true));
}
Example #3
0
bool FWebBrowserHandler::OnKeyEvent(CefRefPtr<CefBrowser> Browser,
	const CefKeyEvent& Event,
	CefEventHandle OsEvent)
{
#if UE_BUILD_DEBUG
	// Show dev tools on CMD/CTRL+ALT+I
	if( (Event.type == KEYEVENT_RAWKEYDOWN || Event.type == KEYEVENT_KEYDOWN) &&
#if PLATFORM_MAC
		(Event.modifiers == (EVENTFLAG_COMMAND_DOWN | EVENTFLAG_SHIFT_DOWN)) &&
#else
		(Event.modifiers == (EVENTFLAG_CONTROL_DOWN | EVENTFLAG_SHIFT_DOWN)) &&
#endif
		(Event.unmodified_character == 'i' || Event.unmodified_character == 'I')
	  )
	{
		return ShowDevTools(Browser);
	}
#endif

#if PLATFORM_MAC
	// We need to handle standard Copy/Paste/etc... shortcuts on OS X
	if( (Event.type == KEYEVENT_RAWKEYDOWN || Event.type == KEYEVENT_KEYDOWN) &&
		(Event.modifiers & EVENTFLAG_COMMAND_DOWN) != 0 &&
		(Event.modifiers & EVENTFLAG_CONTROL_DOWN) == 0 &&
		(Event.modifiers & EVENTFLAG_ALT_DOWN) == 0 &&
		( (Event.modifiers & EVENTFLAG_SHIFT_DOWN) == 0 || Event.unmodified_character == 'z' )
	  )
	{
		CefRefPtr<CefFrame> Frame = Browser->GetFocusedFrame();
		if (Frame)
		{
			switch (Event.unmodified_character)
			{
				case 'a':
					Frame->SelectAll();
					return true;
				case 'c':
					Frame->Copy();
					return true;
				case 'v':
					Frame->Paste();
					return true;
				case 'x':
					Frame->Cut();
					return true;
				case 'z':
					if( (Event.modifiers & EVENTFLAG_SHIFT_DOWN) == 0 )
					{
						Frame->Undo();
					}
					else
					{
						Frame->Redo();
					}
					return true;
			}
		}
	}
#endif
	TSharedPtr<FWebBrowserWindow> BrowserWindow = BrowserWindowPtr.Pin();
	if (BrowserWindow.IsValid())
	{
		return BrowserWindow->OnUnhandledKeyEvent(Event);
	}

	return false;
}