handle reload api call from pdf ui
This commit is contained in:
parent
010193ef44
commit
528853efbf
2 changed files with 8 additions and 0 deletions
|
@ -62,6 +62,8 @@ void PdfViewerHandler::RegisterMessages() {
|
||||||
web_ui()->RegisterMessageCallback(
|
web_ui()->RegisterMessageCallback(
|
||||||
"getStrings",
|
"getStrings",
|
||||||
base::Bind(&PdfViewerHandler::GetStrings, base::Unretained(this)));
|
base::Bind(&PdfViewerHandler::GetStrings, base::Unretained(this)));
|
||||||
|
web_ui()->RegisterMessageCallback(
|
||||||
|
"reload", base::Bind(&PdfViewerHandler::Reload, base::Unretained(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdfViewerHandler::OnJavascriptAllowed() {
|
void PdfViewerHandler::OnJavascriptAllowed() {
|
||||||
|
@ -158,6 +160,11 @@ void PdfViewerHandler::GetStrings(const base::ListValue* args) {
|
||||||
ResolveJavascriptCallback(*callback_id, *result);
|
ResolveJavascriptCallback(*callback_id, *result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PdfViewerHandler::Reload(const base::ListValue* args) {
|
||||||
|
CHECK_EQ(0U, args->GetSize());
|
||||||
|
web_ui()->GetWebContents()->ReloadFocusedFrame(false);
|
||||||
|
}
|
||||||
|
|
||||||
void PdfViewerHandler::OnZoomLevelChanged(
|
void PdfViewerHandler::OnZoomLevelChanged(
|
||||||
const content::HostZoomMap::ZoomLevelChange& change) {
|
const content::HostZoomMap::ZoomLevelChange& change) {
|
||||||
// TODO(deepak1556): This will work only if zoom level is changed through host
|
// TODO(deepak1556): This will work only if zoom level is changed through host
|
||||||
|
|
|
@ -37,6 +37,7 @@ class PdfViewerHandler : public content::WebUIMessageHandler {
|
||||||
void GetDefaultZoom(const base::ListValue* args);
|
void GetDefaultZoom(const base::ListValue* args);
|
||||||
void GetInitialZoom(const base::ListValue* args);
|
void GetInitialZoom(const base::ListValue* args);
|
||||||
void GetStrings(const base::ListValue* args);
|
void GetStrings(const base::ListValue* args);
|
||||||
|
void Reload(const base::ListValue* args);
|
||||||
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
|
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
|
||||||
|
|
||||||
// Keeps track of events related to zooming.
|
// Keeps track of events related to zooming.
|
||||||
|
|
Loading…
Add table
Reference in a new issue