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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 2398763002: Add font substitution metric for Linux (Closed)
Patch Set: Created 4 years, 2 months 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 <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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 cursor_(PP_CURSORTYPE_POINTER), 275 cursor_(PP_CURSORTYPE_POINTER),
276 zoom_(1.0), 276 zoom_(1.0),
277 device_scale_(1.0), 277 device_scale_(1.0),
278 full_(false), 278 full_(false),
279 paint_manager_(this, this, true), 279 paint_manager_(this, this, true),
280 first_paint_(true), 280 first_paint_(true),
281 document_load_state_(LOAD_STATE_LOADING), 281 document_load_state_(LOAD_STATE_LOADING),
282 preview_document_load_state_(LOAD_STATE_COMPLETE), 282 preview_document_load_state_(LOAD_STATE_COMPLETE),
283 uma_(this), 283 uma_(this),
284 told_browser_about_unsupported_feature_(false), 284 told_browser_about_unsupported_feature_(false),
285 font_substitution_reported(false),
285 print_preview_page_count_(0), 286 print_preview_page_count_(0),
286 last_progress_sent_(0), 287 last_progress_sent_(0),
287 recently_sent_find_update_(false), 288 recently_sent_find_update_(false),
288 received_viewport_message_(false), 289 received_viewport_message_(false),
289 did_call_start_loading_(false), 290 did_call_start_loading_(false),
290 stop_scrolling_(false), 291 stop_scrolling_(false),
291 background_color_(0), 292 background_color_(0),
292 top_toolbar_height_(0), 293 top_toolbar_height_(0),
293 accessibility_state_(ACCESSIBILITY_STATE_OFF) { 294 accessibility_state_(ACCESSIBILITY_STATE_OFF) {
294 loader_factory_.Initialize(this); 295 loader_factory_.Initialize(this);
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 document_load_state_ = LOAD_STATE_FAILED; 1306 document_load_state_ = LOAD_STATE_FAILED;
1306 paint_manager_.InvalidateRect(pp::Rect(pp::Point(), plugin_size_)); 1307 paint_manager_.InvalidateRect(pp::Rect(pp::Point(), plugin_size_));
1307 1308
1308 // Send a progress value of -1 to indicate a failure. 1309 // Send a progress value of -1 to indicate a failure.
1309 pp::VarDictionary message; 1310 pp::VarDictionary message;
1310 message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType)); 1311 message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType));
1311 message.Set(pp::Var(kJSProgressPercentage), pp::Var(-1)); 1312 message.Set(pp::Var(kJSProgressPercentage), pp::Var(-1));
1312 PostMessage(message); 1313 PostMessage(message);
1313 } 1314 }
1314 1315
1316 void OutOfProcessInstance::FontSubstituted() {
1317 if (font_substitution_reported)
1318 return;
1319 font_substitution_reported = true;
rkaplow 2016/10/05 19:40:28 UserAction should generally be used when a user ha
npm 2016/10/05 19:53:03 I see this method being called for LoadFailure, Lo
rkaplow 2016/10/05 21:03:10 Yes, it's not ideal. It is still better for it to
1320 UserMetricsRecordAction("PDF.FontSubstituted");
1321 }
1322
1315 void OutOfProcessInstance::PreviewDocumentLoadFailed() { 1323 void OutOfProcessInstance::PreviewDocumentLoadFailed() {
1316 UserMetricsRecordAction("PDF.PreviewDocumentLoadFailure"); 1324 UserMetricsRecordAction("PDF.PreviewDocumentLoadFailure");
1317 if (preview_document_load_state_ != LOAD_STATE_LOADING || 1325 if (preview_document_load_state_ != LOAD_STATE_LOADING ||
1318 preview_pages_info_.empty()) { 1326 preview_pages_info_.empty()) {
1319 return; 1327 return;
1320 } 1328 }
1321 1329
1322 preview_document_load_state_ = LOAD_STATE_FAILED; 1330 preview_document_load_state_ = LOAD_STATE_FAILED;
1323 preview_pages_info_.pop(); 1331 preview_pages_info_.pop();
1324 1332
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 const pp::FloatPoint& scroll_offset) { 1542 const pp::FloatPoint& scroll_offset) {
1535 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1543 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); 1544 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1537 float min_y = -top_toolbar_height_; 1545 float min_y = -top_toolbar_height_;
1538 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1546 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); 1547 float y = std::max(std::min(scroll_offset.y(), max_y), min_y);
1540 return pp::FloatPoint(x, y); 1548 return pp::FloatPoint(x, y);
1541 } 1549 }
1542 1550
1543 } // namespace chrome_pdf 1551 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698