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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 301223004: Fix loading PDFs with no HTTP response headers in OOP PDF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « pdf/document_loader.cc ('k') | no next file » | 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 const char* headers = NULL; 309 const char* headers = NULL;
310 for (uint32_t i = 0; i < argc; ++i) { 310 for (uint32_t i = 0; i < argc; ++i) {
311 if (strcmp(argn[i], "src") == 0) 311 if (strcmp(argn[i], "src") == 0)
312 original_url = argv[i]; 312 original_url = argv[i];
313 else if (strcmp(argn[i], "stream-url") == 0) 313 else if (strcmp(argn[i], "stream-url") == 0)
314 stream_url = argv[i]; 314 stream_url = argv[i];
315 else if (strcmp(argn[i], "headers") == 0) 315 else if (strcmp(argn[i], "headers") == 0)
316 headers = argv[i]; 316 headers = argv[i];
317 } 317 }
318 318
319 // TODO(raymes): This is a hack to ensure that if no headers are passed in
320 // then we get the right MIME type. When the in process plugin is removed we
321 // can fix the document loader properly and remove this hack.
322 if (!headers || strcmp(headers, "") == 0)
323 headers = "content-type: application/pdf";
324
319 if (!original_url) 325 if (!original_url)
320 return false; 326 return false;
321 327
322 if (!stream_url) 328 if (!stream_url)
323 stream_url = original_url; 329 stream_url = original_url;
324 330
325 // If we're in print preview mode we don't need to load the document yet. 331 // If we're in print preview mode we don't need to load the document yet.
326 // A |kJSResetPrintPreviewModeType| message will be sent to the plugin letting 332 // A |kJSResetPrintPreviewModeType| message will be sent to the plugin letting
327 // it know the url to load. By not loading here we avoid loading the same 333 // it know the url to load. By not loading here we avoid loading the same
328 // document twice. 334 // document twice.
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 LoadPreviewUrl(url); 1389 LoadPreviewUrl(url);
1384 } 1390 }
1385 1391
1386 void OutOfProcessInstance::UserMetricsRecordAction( 1392 void OutOfProcessInstance::UserMetricsRecordAction(
1387 const std::string& action) { 1393 const std::string& action) {
1388 // TODO(raymes): Move this function to PPB_UMA_Private. 1394 // TODO(raymes): Move this function to PPB_UMA_Private.
1389 pp::PDF::UserMetricsRecordAction(this, pp::Var(action)); 1395 pp::PDF::UserMetricsRecordAction(this, pp::Var(action));
1390 } 1396 }
1391 1397
1392 } // namespace chrome_pdf 1398 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/document_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698