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

Side by Side Diff: pdf/instance.cc

Issue 838103002: Fix for #US#US issue in inprocess PDF case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nit. Created 5 years, 11 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 | « no previous file | 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/instance.h" 5 #include "pdf/instance.h"
6 6
7 #include <algorithm> // for min() 7 #include <algorithm> // for min()
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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 void Instance::NavigateTo(const std::string& url, bool open_in_new_tab) { 1219 void Instance::NavigateTo(const std::string& url, bool open_in_new_tab) {
1220 std::string url_copy(url); 1220 std::string url_copy(url);
1221 1221
1222 // Empty |url_copy| is ok, and will effectively be a reload. 1222 // Empty |url_copy| is ok, and will effectively be a reload.
1223 // Skip the code below so an empty URL does not turn into "http://", which 1223 // Skip the code below so an empty URL does not turn into "http://", which
1224 // will cause GURL to fail a DCHECK. 1224 // will cause GURL to fail a DCHECK.
1225 if (!url_copy.empty()) { 1225 if (!url_copy.empty()) {
1226 // If |url_copy| starts with '#', then it's for the same URL with a 1226 // If |url_copy| starts with '#', then it's for the same URL with a
1227 // different URL fragment. 1227 // different URL fragment.
1228 if (url_copy[0] == '#') { 1228 if (url_copy[0] == '#') {
1229 url_copy = url_ + url_copy; 1229 // if '#' is already present in |url_| then remove old fragment and add
1230 // new |url_copy| fragment.
1231 std::size_t index = url_.find('#');
1232 if (index != std::string::npos)
1233 url_copy = url_.substr(0, index) + url_copy;
1234 else
1235 url_copy = url_ + url_copy;
1230 // Changing the href does not actually do anything when navigating in the 1236 // Changing the href does not actually do anything when navigating in the
1231 // same tab, so do the actual page scroll here. Then fall through so the 1237 // same tab, so do the actual page scroll here. Then fall through so the
1232 // href gets updated. 1238 // href gets updated.
1233 if (!open_in_new_tab) { 1239 if (!open_in_new_tab) {
1234 int page_number = GetInitialPage(url_copy); 1240 int page_number = GetInitialPage(url_copy);
1235 if (page_number >= 0) 1241 if (page_number >= 0)
1236 ScrollToPage(page_number); 1242 ScrollToPage(page_number);
1237 } 1243 }
1238 } 1244 }
1239 // If there's no scheme, add http. 1245 // If there's no scheme, add http.
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 return instance_->HasScriptableMethod(name, exception); 2809 return instance_->HasScriptableMethod(name, exception);
2804 } 2810 }
2805 2811
2806 pp::Var PDFScriptableObject::Call(const pp::Var& method, 2812 pp::Var PDFScriptableObject::Call(const pp::Var& method,
2807 const std::vector<pp::Var>& args, 2813 const std::vector<pp::Var>& args,
2808 pp::Var* exception) { 2814 pp::Var* exception) {
2809 return instance_->CallScriptableMethod(method, args, exception); 2815 return instance_->CallScriptableMethod(method, args, exception);
2810 } 2816 }
2811 2817
2812 } // namespace chrome_pdf 2818 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698