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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 814573004: Fix for Multipage selection by dragging mouse in OOP case in PDF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nit. Created 5 years, 10 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 | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Get the selected text in the document (Page -> Plugin) 137 // Get the selected text in the document (Page -> Plugin)
138 const char kJSGetSelectedTextType[] = "getSelectedText"; 138 const char kJSGetSelectedTextType[] = "getSelectedText";
139 // Reply with selected text (Plugin -> Page) 139 // Reply with selected text (Plugin -> Page)
140 const char kJSGetSelectedTextReplyType[] = "getSelectedTextReply"; 140 const char kJSGetSelectedTextReplyType[] = "getSelectedTextReply";
141 const char kJSSelectedText[] = "selectedText"; 141 const char kJSSelectedText[] = "selectedText";
142 142
143 // List of named destinations (Plugin -> Page) 143 // List of named destinations (Plugin -> Page)
144 const char kJSSetNamedDestinationsType[] = "setNamedDestinations"; 144 const char kJSSetNamedDestinationsType[] = "setNamedDestinations";
145 const char kJSNamedDestinations[] = "namedDestinations"; 145 const char kJSNamedDestinations[] = "namedDestinations";
146 146
147 // Selecting text in document (Plugin -> Page)
148 const char kJSSetIsSelectingType[] = "setIsSelecting";
149 const char kJSIsSelecting[] = "isSelecting";
150
147 const int kFindResultCooldownMs = 100; 151 const int kFindResultCooldownMs = 100;
148 152
149 const double kMinZoom = 0.01; 153 const double kMinZoom = 0.01;
150 154
151 namespace { 155 namespace {
152 156
153 static const char kPPPPdfInterface[] = PPP_PDF_INTERFACE_1; 157 static const char kPPPPdfInterface[] = PPP_PDF_INTERFACE_1;
154 158
155 PP_Var GetLinkAtPosition(PP_Instance instance, PP_Point point) { 159 PP_Var GetLinkAtPosition(PP_Instance instance, PP_Point point) {
156 pp::Var var; 160 pp::Var var;
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 } 1348 }
1345 1349
1346 bool OutOfProcessInstance::IsPrintPreview() { 1350 bool OutOfProcessInstance::IsPrintPreview() {
1347 return IsPrintPreviewUrl(url_); 1351 return IsPrintPreviewUrl(url_);
1348 } 1352 }
1349 1353
1350 uint32 OutOfProcessInstance::GetBackgroundColor() { 1354 uint32 OutOfProcessInstance::GetBackgroundColor() {
1351 return background_color_; 1355 return background_color_;
1352 } 1356 }
1353 1357
1358 void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) {
1359 pp::VarDictionary message;
1360 message.Set(kType, kJSSetIsSelectingType);
1361 message.Set(kJSIsSelecting, pp::Var(is_selecting));
1362 PostMessage(message);
1363 }
1364
1354 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url, 1365 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url,
1355 int dst_page_index) { 1366 int dst_page_index) {
1356 if (!IsPrintPreview()) 1367 if (!IsPrintPreview())
1357 return; 1368 return;
1358 1369
1359 int src_page_index = ExtractPrintPreviewPageIndex(url); 1370 int src_page_index = ExtractPrintPreviewPageIndex(url);
1360 if (src_page_index < 1) 1371 if (src_page_index < 1)
1361 return; 1372 return;
1362 1373
1363 preview_pages_info_.push(std::make_pair(url, dst_page_index)); 1374 preview_pages_info_.push(std::make_pair(url, dst_page_index));
(...skipping 28 matching lines...) Expand all
1392 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( 1403 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument(
1393 const pp::FloatPoint& scroll_offset) { 1404 const pp::FloatPoint& scroll_offset) {
1394 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1405 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1395 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);
1396 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1407 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1397 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);
1398 return pp::FloatPoint(x, y); 1409 return pp::FloatPoint(x, y);
1399 } 1410 }
1400 1411
1401 } // namespace chrome_pdf 1412 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698