Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 810623003: Add functions to collect bookmarks from Pdfium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove empty line Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pdf/out_of_process_instance.h" 5 #include "pdf/out_of_process_instance.h"
6 6
7 #include <algorithm> // for min/max() 7 #include <algorithm> // for min/max()
8 #define _USE_MATH_DEFINES // for M_PI 8 #define _USE_MATH_DEFINES // for M_PI
9 #include <cmath> // for log() and pow() 9 #include <cmath> // for log() and pow()
10 #include <math.h> 10 #include <math.h>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const char kJSDocumentWidth[] = "width"; 71 const char kJSDocumentWidth[] = "width";
72 const char kJSDocumentHeight[] = "height"; 72 const char kJSDocumentHeight[] = "height";
73 const char kJSPageDimensions[] = "pageDimensions"; 73 const char kJSPageDimensions[] = "pageDimensions";
74 const char kJSPageX[] = "x"; 74 const char kJSPageX[] = "x";
75 const char kJSPageY[] = "y"; 75 const char kJSPageY[] = "y";
76 const char kJSPageWidth[] = "width"; 76 const char kJSPageWidth[] = "width";
77 const char kJSPageHeight[] = "height"; 77 const char kJSPageHeight[] = "height";
78 // Document load progress arguments (Plugin -> Page) 78 // Document load progress arguments (Plugin -> Page)
79 const char kJSLoadProgressType[] = "loadProgress"; 79 const char kJSLoadProgressType[] = "loadProgress";
80 const char kJSProgressPercentage[] = "progress"; 80 const char kJSProgressPercentage[] = "progress";
81 // Bookmarks
82 const char kJSBookmarksType[] = "bookmarks";
81 // Get password arguments (Plugin -> Page) 83 // Get password arguments (Plugin -> Page)
82 const char kJSGetPasswordType[] = "getPassword"; 84 const char kJSGetPasswordType[] = "getPassword";
83 // Get password complete arguments (Page -> Plugin) 85 // Get password complete arguments (Page -> Plugin)
84 const char kJSGetPasswordCompleteType[] = "getPasswordComplete"; 86 const char kJSGetPasswordCompleteType[] = "getPasswordComplete";
85 const char kJSPassword[] = "password"; 87 const char kJSPassword[] = "password";
86 // Print (Page -> Plugin) 88 // Print (Page -> Plugin)
87 const char kJSPrintType[] = "print"; 89 const char kJSPrintType[] = "print";
88 // Save (Page -> Plugin) 90 // Save (Page -> Plugin)
89 const char kJSSaveType[] = "save"; 91 const char kJSSaveType[] = "save";
90 // Go to page (Plugin -> Page) 92 // Go to page (Plugin -> Page)
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 if (IsPrintPreview()) { 1107 if (IsPrintPreview()) {
1106 AppendBlankPrintPreviewPages(); 1108 AppendBlankPrintPreviewPages();
1107 OnGeometryChanged(0, 0); 1109 OnGeometryChanged(0, 0);
1108 } 1110 }
1109 1111
1110 pp::VarDictionary message; 1112 pp::VarDictionary message;
1111 message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType)); 1113 message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType));
1112 message.Set(pp::Var(kJSProgressPercentage), pp::Var(100)) ; 1114 message.Set(pp::Var(kJSProgressPercentage), pp::Var(100)) ;
1113 PostMessage(message); 1115 PostMessage(message);
1114 1116
1117 pp::VarDictionary bookmarksMessage;
1118 bookmarksMessage.Set(pp::Var(kType), pp::Var(kJSBookmarksType));
1119 bookmarksMessage.Set(pp::Var(kJSBookmarksType), engine_->GetBookmarks());
1120 PostMessage(bookmarksMessage);
1121
1115 if (!full_) 1122 if (!full_)
1116 return; 1123 return;
1117 1124
1118 if (did_call_start_loading_) { 1125 if (did_call_start_loading_) {
1119 pp::PDF::DidStopLoading(this); 1126 pp::PDF::DidStopLoading(this);
1120 did_call_start_loading_ = false; 1127 did_call_start_loading_ = false;
1121 } 1128 }
1122 1129
1123 int content_restrictions = 1130 int content_restrictions =
1124 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE; 1131 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE;
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( 1403 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument(
1397 const pp::FloatPoint& scroll_offset) { 1404 const pp::FloatPoint& scroll_offset) {
1398 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1405 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1399 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1406 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1400 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1407 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1401 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); 1408 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f);
1402 return pp::FloatPoint(x, y); 1409 return pp::FloatPoint(x, y);
1403 } 1410 }
1404 1411
1405 } // namespace chrome_pdf 1412 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698