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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
« no previous file with comments | « net/tools/net_watcher/net_watcher.cc ('k') | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } else { 462 } else {
463 base::DictionaryValue node; 463 base::DictionaryValue node;
464 node.SetInteger(kAccessibleNumberOfPages, engine_->GetNumberOfPages()); 464 node.SetInteger(kAccessibleNumberOfPages, engine_->GetNumberOfPages());
465 node.SetBoolean(kAccessibleLoaded, 465 node.SetBoolean(kAccessibleLoaded,
466 document_load_state_ != LOAD_STATE_LOADING); 466 document_load_state_ != LOAD_STATE_LOADING);
467 bool has_permissions = 467 bool has_permissions =
468 engine_->HasPermission(PDFEngine::PERMISSION_COPY) || 468 engine_->HasPermission(PDFEngine::PERMISSION_COPY) ||
469 engine_->HasPermission(PDFEngine::PERMISSION_COPY_ACCESSIBLE); 469 engine_->HasPermission(PDFEngine::PERMISSION_COPY_ACCESSIBLE);
470 node.SetBoolean(kAccessibleCopyable, has_permissions); 470 node.SetBoolean(kAccessibleCopyable, has_permissions);
471 std::string json; 471 std::string json;
472 base::JSONWriter::Write(&node, &json); 472 base::JSONWriter::Write(node, &json);
473 reply.Set(pp::Var(kJSAccessibilityJSON), pp::Var(json)); 473 reply.Set(pp::Var(kJSAccessibilityJSON), pp::Var(json));
474 } 474 }
475 PostMessage(reply); 475 PostMessage(reply);
476 } else if (type == kJSStopScrollingType) { 476 } else if (type == kJSStopScrollingType) {
477 stop_scrolling_ = true; 477 stop_scrolling_ = true;
478 } else if (type == kJSGetSelectedTextType) { 478 } else if (type == kJSGetSelectedTextType) {
479 std::string selected_text = engine_->GetSelectedText(); 479 std::string selected_text = engine_->GetSelectedText();
480 // Always return unix newlines to JS. 480 // Always return unix newlines to JS.
481 base::ReplaceChars(selected_text, "\r", std::string(), &selected_text); 481 base::ReplaceChars(selected_text, "\r", std::string(), &selected_text);
482 pp::VarDictionary reply; 482 pp::VarDictionary reply;
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( 1417 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument(
1418 const pp::FloatPoint& scroll_offset) { 1418 const pp::FloatPoint& scroll_offset) {
1419 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1419 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1420 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1420 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1421 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1421 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1422 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); 1422 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f);
1423 return pp::FloatPoint(x, y); 1423 return pp::FloatPoint(x, y);
1424 } 1424 }
1425 1425
1426 } // namespace chrome_pdf 1426 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « net/tools/net_watcher/net_watcher.cc ('k') | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698