#include "pdf/paint_manager.h"
#include "pdf/pdf_engine.h"
#include "pdf/preview_mode_client.h"
-#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/c/private/ppp_pdf.h"
#include "ppapi/cpp/dev/printing_dev.h"
-#include "ppapi/cpp/dev/scriptable_object_deprecated.h"
-#include "ppapi/cpp/graphics_2d.h"
#include "ppapi/cpp/image_data.h"
-#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/private/find_private.h"
#include "ppapi/cpp/private/uma_private.h"
void SetSelectionBounds(const pp::FloatPoint& base,
const pp::FloatPoint& extent);
bool CanEditText();
+ bool HasEditableText();
void ReplaceSelection(const std::string& text);
+ bool CanUndo();
+ bool CanRedo();
+ void Undo();
+ void Redo();
+ int32_t PdfPrintBegin(const PP_PrintSettings_Dev* print_settings,
+ const PP_PdfPrintSettings_Dev* pdf_print_settings);
void FlushCallback(int32_t result);
void DidOpen(int32_t result);
void DidOpenPreview(int32_t result);
- // Called when the timer is fired.
- void OnClientTimerFired(int32_t id);
- void OnClientTouchTimerFired(int32_t id);
-
// Called to print without re-entrancy issues.
void OnPrint(int32_t);
const PDFEngine::PageFeatures* page_features) override;
void GetDocumentPassword(
pp::CompletionCallbackWithOutput<pp::Var> callback) override;
+ void Beep() override;
void Alert(const std::string& message) override;
bool Confirm(const std::string& message) override;
std::string Prompt(const std::string& question,
const void* data,
int length) override;
pp::URLLoader CreateURLLoader() override;
- void ScheduleCallback(int id, base::TimeDelta delay) override;
- void ScheduleTouchTimerCallback(int id, base::TimeDelta delay) override;
std::vector<SearchStringResult> SearchString(const base::char16* string,
const base::char16* term,
bool case_sensitive) override;
- void DocumentPaintOccurred() override;
void DocumentLoadComplete(
const PDFEngine::DocumentFeatures& document_features,
uint32_t file_size) override;
void RotateClockwise();
void RotateCounterclockwise();
+ // Creates a file name for saving a PDF file, given the source URL. Exposed
+ // for testing.
+ static std::string GetFileNameFromUrl(const std::string& url);
+
private:
void ResetRecentlySentFindUpdate(int32_t);
// frame's origin.
pp::URLLoader CreateURLLoaderInternal();
+ bool ShouldSaveEdits() const;
+ void SaveToFile(const std::string& token);
+ void SaveToBuffer(const std::string& token);
+ void ConsumeSaveToken(const std::string& token);
+
void FormDidOpen(int32_t result);
void UserMetricsRecordAction(const std::string& action);
struct PrintSettings {
PrintSettings() { Clear(); }
- void Clear() {
- is_printing = false;
- print_pages_called_ = false;
- memset(&pepper_print_settings, 0, sizeof(pepper_print_settings));
- }
- // This is set to true when PrintBegin is called and false when PrintEnd is
- // called.
+
+ void Clear();
+
+ // This is set to true when PdfPrintBegin() is called and false when
+ // PrintEnd() is called.
bool is_printing;
+
// To know whether this was an actual print operation, so we don't double
// count UMA logging.
- bool print_pages_called_;
+ bool print_pages_called;
+
+ // Generic print settings.
PP_PrintSettings_Dev pepper_print_settings;
+
+ // PDF-specific print settings.
+ PP_PdfPrintSettings_Dev pdf_print_settings;
};
PrintSettings print_settings_;
// Annotation types that were already counted for this document.
std::set<int> annotation_types_counted_;
+ bool edit_mode_ = false;
+
// The current state of accessibility: either off, enabled but waiting
// for the document to load, or fully loaded.
enum AccessibilityState {