Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 const char kJSDocumentWidth[] = "width"; | 66 const char kJSDocumentWidth[] = "width"; |
| 67 const char kJSDocumentHeight[] = "height"; | 67 const char kJSDocumentHeight[] = "height"; |
| 68 const char kJSPageDimensions[] = "pageDimensions"; | 68 const char kJSPageDimensions[] = "pageDimensions"; |
| 69 const char kJSPageX[] = "x"; | 69 const char kJSPageX[] = "x"; |
| 70 const char kJSPageY[] = "y"; | 70 const char kJSPageY[] = "y"; |
| 71 const char kJSPageWidth[] = "width"; | 71 const char kJSPageWidth[] = "width"; |
| 72 const char kJSPageHeight[] = "height"; | 72 const char kJSPageHeight[] = "height"; |
| 73 // Document load progress arguments (Plugin -> Page) | 73 // Document load progress arguments (Plugin -> Page) |
| 74 const char kJSLoadProgressType[] = "loadProgress"; | 74 const char kJSLoadProgressType[] = "loadProgress"; |
| 75 const char kJSProgressPercentage[] = "progress"; | 75 const char kJSProgressPercentage[] = "progress"; |
| 76 // Bookmarks | |
| 77 const char kJSBookmarksType[] = "bookmarks"; | |
| 76 // Get password arguments (Plugin -> Page) | 78 // Get password arguments (Plugin -> Page) |
| 77 const char kJSGetPasswordType[] = "getPassword"; | 79 const char kJSGetPasswordType[] = "getPassword"; |
| 78 // Get password complete arguments (Page -> Plugin) | 80 // Get password complete arguments (Page -> Plugin) |
| 79 const char kJSGetPasswordCompleteType[] = "getPasswordComplete"; | 81 const char kJSGetPasswordCompleteType[] = "getPasswordComplete"; |
| 80 const char kJSPassword[] = "password"; | 82 const char kJSPassword[] = "password"; |
| 81 // Print (Page -> Plugin) | 83 // Print (Page -> Plugin) |
| 82 const char kJSPrintType[] = "print"; | 84 const char kJSPrintType[] = "print"; |
| 83 // Save (Page -> Plugin) | 85 // Save (Page -> Plugin) |
| 84 const char kJSSaveType[] = "save"; | 86 const char kJSSaveType[] = "save"; |
| 85 // Go to page (Plugin -> Page) | 87 // Go to page (Plugin -> Page) |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1104 if (IsPrintPreview()) { | 1106 if (IsPrintPreview()) { |
| 1105 AppendBlankPrintPreviewPages(); | 1107 AppendBlankPrintPreviewPages(); |
| 1106 OnGeometryChanged(0, 0); | 1108 OnGeometryChanged(0, 0); |
| 1107 } | 1109 } |
| 1108 | 1110 |
| 1109 pp::VarDictionary message; | 1111 pp::VarDictionary message; |
| 1110 message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType)); | 1112 message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType)); |
| 1111 message.Set(pp::Var(kJSProgressPercentage), pp::Var(100)) ; | 1113 message.Set(pp::Var(kJSProgressPercentage), pp::Var(100)) ; |
| 1112 PostMessage(message); | 1114 PostMessage(message); |
| 1113 | 1115 |
| 1116 pp::VarDictionary bookmarksMessage; | |
| 1117 bookmarksMessage.Set(pp::Var(kType), pp::Var(kJSBookmarksType)); | |
| 1118 bookmarksMessage.Set(pp::Var(kJSBookmarksType), engine_->GetBookmarks()); | |
|
raymes
2015/01/16 02:44:23
We should have a separate constant here as the key
Alexandre Carlton
2015/01/16 03:01:40
Done.
| |
| 1119 PostMessage(bookmarksMessage); | |
| 1120 | |
| 1114 if (!full_) | 1121 if (!full_) |
| 1115 return; | 1122 return; |
| 1116 | 1123 |
| 1117 if (did_call_start_loading_) { | 1124 if (did_call_start_loading_) { |
| 1118 pp::PDF::DidStopLoading(this); | 1125 pp::PDF::DidStopLoading(this); |
| 1119 did_call_start_loading_ = false; | 1126 did_call_start_loading_ = false; |
| 1120 } | 1127 } |
| 1121 | 1128 |
| 1122 int content_restrictions = | 1129 int content_restrictions = |
| 1123 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE; | 1130 CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1395 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1402 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
| 1396 const pp::FloatPoint& scroll_offset) { | 1403 const pp::FloatPoint& scroll_offset) { |
| 1397 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1404 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1398 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1405 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1399 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1406 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1400 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1407 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
| 1401 return pp::FloatPoint(x, y); | 1408 return pp::FloatPoint(x, y); |
| 1402 } | 1409 } |
| 1403 | 1410 |
| 1404 } // namespace chrome_pdf | 1411 } // namespace chrome_pdf |
| OLD | NEW |