electron/atom/browser/ui/webui/pdf_viewer_handler.h

53 lines
1.4 KiB
C
Raw Normal View History

2017-01-18 13:58:20 +00:00
// Copyright (c) 2017 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_UI_WEBUI_PDF_VIEWER_HANDLER_H_
#define ATOM_BROWSER_UI_WEBUI_PDF_VIEWER_HANDLER_H_
#include <string>
#include "base/macros.h"
2017-01-18 16:25:36 +00:00
#include "content/public/browser/host_zoom_map.h"
2017-01-18 13:58:20 +00:00
#include "content/public/browser/web_ui_message_handler.h"
namespace base {
class ListValue;
}
2017-01-20 19:16:38 +00:00
namespace content {
class StreamInfo;
}
2017-01-18 13:58:20 +00:00
namespace atom {
class PdfViewerHandler : public content::WebUIMessageHandler {
public:
2017-01-20 19:16:38 +00:00
explicit PdfViewerHandler(const std::string& view_id);
2017-01-18 13:58:20 +00:00
~PdfViewerHandler() override;
// WebUIMessageHandler implementation.
void RegisterMessages() override;
2017-01-18 16:25:36 +00:00
void OnJavascriptAllowed() override;
void OnJavascriptDisallowed() override;
2017-01-18 13:58:20 +00:00
private:
void Initialize(const base::ListValue* args);
2017-01-18 16:25:36 +00:00
void GetDefaultZoom(const base::ListValue* args);
void GetInitialZoom(const base::ListValue* args);
2017-01-22 14:50:38 +00:00
void GetStrings(const base::ListValue* args);
2017-01-18 16:25:36 +00:00
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
2017-01-18 13:58:20 +00:00
2017-01-18 16:25:36 +00:00
// Keeps track of events related to zooming.
std::unique_ptr<content::HostZoomMap::Subscription>
host_zoom_map_subscription_;
2017-01-20 19:16:38 +00:00
std::unique_ptr<content::StreamInfo> stream_;
std::string view_id_;
2017-01-18 13:58:20 +00:00
DISALLOW_COPY_AND_ASSIGN(PdfViewerHandler);
};
} // namespace atom
#endif // ATOM_BROWSER_UI_WEBUI_PDF_VIEWER_HANDLER_H_