OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/dom_distiller/core/viewer.h" | 5 #include "components/dom_distiller/core/viewer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 scoped_ptr<ViewerHandle> CreateViewRequest( | 255 scoped_ptr<ViewerHandle> CreateViewRequest( |
256 DomDistillerServiceInterface* dom_distiller_service, | 256 DomDistillerServiceInterface* dom_distiller_service, |
257 const std::string& path, | 257 const std::string& path, |
258 ViewRequestDelegate* view_request_delegate, | 258 ViewRequestDelegate* view_request_delegate, |
259 const gfx::Size& render_view_size) { | 259 const gfx::Size& render_view_size) { |
260 std::string entry_id = | 260 std::string entry_id = |
261 url_utils::GetValueForKeyInUrlPathQuery(path, kEntryIdKey); | 261 url_utils::GetValueForKeyInUrlPathQuery(path, kEntryIdKey); |
262 bool has_valid_entry_id = !entry_id.empty(); | 262 bool has_valid_entry_id = !entry_id.empty(); |
263 entry_id = base::StringToUpperASCII(entry_id); | 263 entry_id = base::ToUpperASCII(entry_id); |
264 | 264 |
265 std::string requested_url_str = | 265 std::string requested_url_str = |
266 url_utils::GetValueForKeyInUrlPathQuery(path, kUrlKey); | 266 url_utils::GetValueForKeyInUrlPathQuery(path, kUrlKey); |
267 GURL requested_url(requested_url_str); | 267 GURL requested_url(requested_url_str); |
268 bool has_valid_url = url_utils::IsUrlDistillable(requested_url); | 268 bool has_valid_url = url_utils::IsUrlDistillable(requested_url); |
269 | 269 |
270 if (has_valid_entry_id && has_valid_url) { | 270 if (has_valid_entry_id && has_valid_url) { |
271 // It is invalid to specify a query param for both |kEntryIdKey| and | 271 // It is invalid to specify a query param for both |kEntryIdKey| and |
272 // |kUrlKey|. | 272 // |kUrlKey|. |
273 return scoped_ptr<ViewerHandle>(); | 273 return scoped_ptr<ViewerHandle>(); |
(...skipping 20 matching lines...) Expand all Loading... |
294 } | 294 } |
295 | 295 |
296 const std::string GetDistilledPageFontFamilyJs( | 296 const std::string GetDistilledPageFontFamilyJs( |
297 DistilledPagePrefs::FontFamily font_family) { | 297 DistilledPagePrefs::FontFamily font_family) { |
298 return "useFontFamily('" + GetJsFontFamily(font_family) + "');"; | 298 return "useFontFamily('" + GetJsFontFamily(font_family) + "');"; |
299 } | 299 } |
300 | 300 |
301 } // namespace viewer | 301 } // namespace viewer |
302 | 302 |
303 } // namespace dom_distiller | 303 } // namespace dom_distiller |
OLD | NEW |