| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> // for min/max() | 10 #include <algorithm> // for min/max() |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const char kJSDocumentWidth[] = "width"; | 63 const char kJSDocumentWidth[] = "width"; |
| 64 const char kJSDocumentHeight[] = "height"; | 64 const char kJSDocumentHeight[] = "height"; |
| 65 const char kJSPageDimensions[] = "pageDimensions"; | 65 const char kJSPageDimensions[] = "pageDimensions"; |
| 66 const char kJSPageX[] = "x"; | 66 const char kJSPageX[] = "x"; |
| 67 const char kJSPageY[] = "y"; | 67 const char kJSPageY[] = "y"; |
| 68 const char kJSPageWidth[] = "width"; | 68 const char kJSPageWidth[] = "width"; |
| 69 const char kJSPageHeight[] = "height"; | 69 const char kJSPageHeight[] = "height"; |
| 70 // Document load progress arguments (Plugin -> Page) | 70 // Document load progress arguments (Plugin -> Page) |
| 71 const char kJSLoadProgressType[] = "loadProgress"; | 71 const char kJSLoadProgressType[] = "loadProgress"; |
| 72 const char kJSProgressPercentage[] = "progress"; | 72 const char kJSProgressPercentage[] = "progress"; |
| 73 // Document load URL (Plugin -> Page) |
| 74 const char kJSGotActualURLType[] = "gotActualURL"; |
| 75 const char kJSActualURL[] = "actualURL"; |
| 73 // Metadata | 76 // Metadata |
| 74 const char kJSMetadataType[] = "metadata"; | 77 const char kJSMetadataType[] = "metadata"; |
| 75 const char kJSBookmarks[] = "bookmarks"; | 78 const char kJSBookmarks[] = "bookmarks"; |
| 76 const char kJSTitle[] = "title"; | 79 const char kJSTitle[] = "title"; |
| 77 // Get password arguments (Plugin -> Page) | 80 // Get password arguments (Plugin -> Page) |
| 78 const char kJSGetPasswordType[] = "getPassword"; | 81 const char kJSGetPasswordType[] = "getPassword"; |
| 79 // Get password complete arguments (Page -> Plugin) | 82 // Get password complete arguments (Page -> Plugin) |
| 80 const char kJSGetPasswordCompleteType[] = "getPasswordComplete"; | 83 const char kJSGetPasswordCompleteType[] = "getPasswordComplete"; |
| 81 const char kJSPassword[] = "password"; | 84 const char kJSPassword[] = "password"; |
| 82 // Print (Page -> Plugin) | 85 // Print (Page -> Plugin) |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 (*results)[i].length = pp_results[i].length; | 1193 (*results)[i].length = pp_results[i].length; |
| 1191 } | 1194 } |
| 1192 | 1195 |
| 1193 pp::Memory_Dev memory; | 1196 pp::Memory_Dev memory; |
| 1194 memory.MemFree(pp_results); | 1197 memory.MemFree(pp_results); |
| 1195 } | 1198 } |
| 1196 | 1199 |
| 1197 void OutOfProcessInstance::DocumentPaintOccurred() { | 1200 void OutOfProcessInstance::DocumentPaintOccurred() { |
| 1198 } | 1201 } |
| 1199 | 1202 |
| 1203 void OutOfProcessInstance::OnGotActualURL(const std::string& url) { |
| 1204 pp::VarDictionary message; |
| 1205 message.Set(pp::Var(kType), pp::Var(kJSGotActualURLType)); |
| 1206 message.Set(pp::Var(kJSActualURL), pp::Var(url)); |
| 1207 PostMessage(message); |
| 1208 } |
| 1209 |
| 1200 void OutOfProcessInstance::DocumentLoadComplete(int page_count) { | 1210 void OutOfProcessInstance::DocumentLoadComplete(int page_count) { |
| 1201 // Clear focus state for OSK. | 1211 // Clear focus state for OSK. |
| 1202 FormTextFieldFocusChange(false); | 1212 FormTextFieldFocusChange(false); |
| 1203 | 1213 |
| 1204 DCHECK(document_load_state_ == LOAD_STATE_LOADING); | 1214 DCHECK(document_load_state_ == LOAD_STATE_LOADING); |
| 1205 document_load_state_ = LOAD_STATE_COMPLETE; | 1215 document_load_state_ = LOAD_STATE_COMPLETE; |
| 1206 UserMetricsRecordAction("PDF.LoadSuccess"); | 1216 UserMetricsRecordAction("PDF.LoadSuccess"); |
| 1207 uma_.HistogramEnumeration("PDF.DocumentFeature", LOADED_DOCUMENT, | 1217 uma_.HistogramEnumeration("PDF.DocumentFeature", LOADED_DOCUMENT, |
| 1208 FEATURES_COUNT); | 1218 FEATURES_COUNT); |
| 1209 | 1219 |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 const pp::FloatPoint& scroll_offset) { | 1544 const pp::FloatPoint& scroll_offset) { |
| 1535 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1545 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1536 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1546 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1537 float min_y = -top_toolbar_height_; | 1547 float min_y = -top_toolbar_height_; |
| 1538 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1548 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1539 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); | 1549 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); |
| 1540 return pp::FloatPoint(x, y); | 1550 return pp::FloatPoint(x, y); |
| 1541 } | 1551 } |
| 1542 | 1552 |
| 1543 } // namespace chrome_pdf | 1553 } // namespace chrome_pdf |
| OLD | NEW |