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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 scoped_ptr<ViewerHandle> CreateViewRequest( | 177 scoped_ptr<ViewerHandle> CreateViewRequest( |
178 DomDistillerServiceInterface* dom_distiller_service, | 178 DomDistillerServiceInterface* dom_distiller_service, |
179 const std::string& path, | 179 const std::string& path, |
180 ViewRequestDelegate* view_request_delegate, | 180 ViewRequestDelegate* view_request_delegate, |
181 const gfx::Size& render_view_size) { | 181 const gfx::Size& render_view_size) { |
182 std::string entry_id = | 182 std::string entry_id = |
183 url_utils::GetValueForKeyInUrlPathQuery(path, kEntryIdKey); | 183 url_utils::GetValueForKeyInUrlPathQuery(path, kEntryIdKey); |
184 bool has_valid_entry_id = !entry_id.empty(); | 184 bool has_valid_entry_id = !entry_id.empty(); |
185 entry_id = StringToUpperASCII(entry_id); | 185 entry_id = base::StringToUpperASCII(entry_id); |
186 | 186 |
187 std::string requested_url_str = | 187 std::string requested_url_str = |
188 url_utils::GetValueForKeyInUrlPathQuery(path, kUrlKey); | 188 url_utils::GetValueForKeyInUrlPathQuery(path, kUrlKey); |
189 GURL requested_url(requested_url_str); | 189 GURL requested_url(requested_url_str); |
190 bool has_valid_url = url_utils::IsUrlDistillable(requested_url); | 190 bool has_valid_url = url_utils::IsUrlDistillable(requested_url); |
191 | 191 |
192 if (has_valid_entry_id && has_valid_url) { | 192 if (has_valid_entry_id && has_valid_url) { |
193 // It is invalid to specify a query param for both |kEntryIdKey| and | 193 // It is invalid to specify a query param for both |kEntryIdKey| and |
194 // |kUrlKey|. | 194 // |kUrlKey|. |
195 return scoped_ptr<ViewerHandle>(); | 195 return scoped_ptr<ViewerHandle>(); |
(...skipping 15 matching lines...) Expand all Loading... |
211 return scoped_ptr<ViewerHandle>(); | 211 return scoped_ptr<ViewerHandle>(); |
212 } | 212 } |
213 | 213 |
214 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme) { | 214 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme) { |
215 return "useTheme('" + GetJsTheme(theme) + "');"; | 215 return "useTheme('" + GetJsTheme(theme) + "');"; |
216 } | 216 } |
217 | 217 |
218 } // namespace viewer | 218 } // namespace viewer |
219 | 219 |
220 } // namespace dom_distiller | 220 } // namespace dom_distiller |
OLD | NEW |