- Add window.print() JavaScript support.
- Add File -> Print option to cefclient. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@89 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
0e29c2e840
commit
38ded6eec6
|
@ -185,6 +185,12 @@ void BrowserWebViewDelegate::didAddMessageToConsole(
|
|||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::printPage(WebFrame* frame) {
|
||||
if(frame == NULL)
|
||||
frame = browser_->GetWebView()->mainFrame();
|
||||
browser_->UIT_PrintPages(frame);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didStartLoading() {
|
||||
// clear the title so we can tell if it wasn't provided by the page
|
||||
browser_->UIT_SetTitle(std::wstring());
|
||||
|
|
|
@ -57,6 +57,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
virtual void didAddMessageToConsole(
|
||||
const WebKit::WebConsoleMessage& message,
|
||||
const WebKit::WebString& source_name, unsigned source_line);
|
||||
virtual void printPage(WebKit::WebFrame* frame);
|
||||
virtual void didStartLoading();
|
||||
virtual void didStopLoading();
|
||||
virtual bool shouldBeginEditing(const WebKit::WebRange& range);
|
||||
|
|
|
@ -920,6 +920,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
::SetFocus(hFindDlg);
|
||||
}
|
||||
return 0;
|
||||
case ID_PRINT:
|
||||
if(browser.get())
|
||||
browser->GetMainFrame()->Print();
|
||||
return 0;
|
||||
case IDC_NAV_BACK: // Back button
|
||||
if(browser.get())
|
||||
browser->GoBack();
|
||||
|
|
|
@ -51,9 +51,11 @@ IDC_CEFCLIENT MENU
|
|||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Find...", ID_FIND
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print...", ID_PRINT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define IDC_NAV_STOP 203
|
||||
#define ID_WARN_CONSOLEMESSAGE 32000
|
||||
#define ID_FIND 32001
|
||||
#define ID_PRINT 32002
|
||||
#define ID_TESTS_GETSOURCE 32769
|
||||
#define ID_TESTS_GETTEXT 32770
|
||||
#define ID_TESTS_JAVASCRIPT_HANDLER 32771
|
||||
|
|
Loading…
Reference in New Issue