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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 GURL requested_url(requested_url_str); | 104 GURL requested_url(requested_url_str); |
105 bool has_valid_url = url_utils::IsUrlDistillable(requested_url); | 105 bool has_valid_url = url_utils::IsUrlDistillable(requested_url); |
106 | 106 |
107 if (has_valid_entry_id && has_valid_url) { | 107 if (has_valid_entry_id && has_valid_url) { |
108 // It is invalid to specify a query param for both |kEntryIdKey| and | 108 // It is invalid to specify a query param for both |kEntryIdKey| and |
109 // |kUrlKey|. | 109 // |kUrlKey|. |
110 return scoped_ptr<ViewerHandle>(); | 110 return scoped_ptr<ViewerHandle>(); |
111 } | 111 } |
112 | 112 |
113 if (has_valid_entry_id) { | 113 if (has_valid_entry_id) { |
114 return dom_distiller_service->ViewEntry(view_request_delegate, entry_id) | 114 return dom_distiller_service->ViewEntry(view_request_delegate, |
115 .Pass(); | 115 dom_distiller_service |
| 116 ->CreateDefaultDistillerPage(), |
| 117 entry_id).Pass(); |
116 } else if (has_valid_url) { | 118 } else if (has_valid_url) { |
117 return dom_distiller_service->ViewUrl(view_request_delegate, requested_url) | 119 return dom_distiller_service->ViewUrl(view_request_delegate, |
118 .Pass(); | 120 dom_distiller_service |
| 121 ->CreateDefaultDistillerPage(), |
| 122 requested_url).Pass(); |
119 } | 123 } |
120 | 124 |
121 // It is invalid to not specify a query param for |kEntryIdKey| or |kUrlKey|. | 125 // It is invalid to not specify a query param for |kEntryIdKey| or |kUrlKey|. |
122 return scoped_ptr<ViewerHandle>(); | 126 return scoped_ptr<ViewerHandle>(); |
123 } | 127 } |
124 | 128 |
125 } // namespace viewer | 129 } // namespace viewer |
126 | 130 |
127 } // namespace dom_distiller | 131 } // namespace dom_distiller |
OLD | NEW |