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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "components/dom_distiller/core/dom_distiller_service.h" | 13 #include "components/dom_distiller/core/dom_distiller_service.h" |
14 #include "components/dom_distiller/core/proto/distilled_article.pb.h" | 14 #include "components/dom_distiller/core/proto/distilled_article.pb.h" |
15 #include "components/dom_distiller/core/proto/distilled_page.pb.h" | 15 #include "components/dom_distiller/core/proto/distilled_page.pb.h" |
16 #include "components/dom_distiller/core/reader_mode_preferences.h" | |
nyquist
2014/06/26 20:39:59
Remove this.
smaslo
2014/06/27 18:33:18
Now needed for enum declaration.
| |
16 #include "components/dom_distiller/core/task_tracker.h" | 17 #include "components/dom_distiller/core/task_tracker.h" |
17 #include "components/dom_distiller/core/url_constants.h" | 18 #include "components/dom_distiller/core/url_constants.h" |
18 #include "components/dom_distiller/core/url_utils.h" | 19 #include "components/dom_distiller/core/url_utils.h" |
19 #include "grit/component_resources.h" | 20 #include "grit/component_resources.h" |
20 #include "grit/components_strings.h" | 21 #include "grit/components_strings.h" |
21 #include "net/base/escape.h" | 22 #include "net/base/escape.h" |
22 #include "net/url_request/url_request.h" | 23 #include "net/url_request/url_request.h" |
23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 | 122 |
122 const std::string GetErrorPageHtml() { | 123 const std::string GetErrorPageHtml() { |
123 std::string title = l10n_util::GetStringUTF8( | 124 std::string title = l10n_util::GetStringUTF8( |
124 IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_TITLE); | 125 IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_TITLE); |
125 std::string content = l10n_util::GetStringUTF8( | 126 std::string content = l10n_util::GetStringUTF8( |
126 IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_CONTENT); | 127 IDS_DOM_DISTILLER_VIEWER_FAILED_TO_FIND_ARTICLE_CONTENT); |
127 return ReplaceHtmlTemplateValues(title, content, "hidden", ""); | 128 return ReplaceHtmlTemplateValues(title, content, "hidden", ""); |
128 } | 129 } |
129 | 130 |
130 const std::string GetCss() { | 131 const std::string GetCss() { |
131 return ResourceBundle::GetSharedInstance() | 132 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
nyquist
2014/06/26 20:39:59
Even though this is not wrong, I'd just revert thi
smaslo
2014/06/27 18:33:18
Done.
| |
132 .GetRawDataResource(IDR_DISTILLER_CSS) | 133 IDR_DISTILLER_CSS).as_string(); |
133 .as_string(); | |
134 } | 134 } |
135 | 135 |
136 const std::string GetJavaScript() { | 136 const std::string GetJavaScript() { |
137 return ResourceBundle::GetSharedInstance() | 137 return ResourceBundle::GetSharedInstance() |
138 .GetRawDataResource(IDR_DOM_DISTILLER_VIEWER_JS) | 138 .GetRawDataResource(IDR_DOM_DISTILLER_VIEWER_JS) |
139 .as_string(); | 139 .as_string(); |
140 } | 140 } |
141 | 141 |
142 scoped_ptr<ViewerHandle> CreateViewRequest( | 142 scoped_ptr<ViewerHandle> CreateViewRequest( |
143 DomDistillerServiceInterface* dom_distiller_service, | 143 DomDistillerServiceInterface* dom_distiller_service, |
(...skipping 27 matching lines...) Expand all Loading... | |
171 requested_url).Pass(); | 171 requested_url).Pass(); |
172 } | 172 } |
173 | 173 |
174 // It is invalid to not specify a query param for |kEntryIdKey| or |kUrlKey|. | 174 // It is invalid to not specify a query param for |kEntryIdKey| or |kUrlKey|. |
175 return scoped_ptr<ViewerHandle>(); | 175 return scoped_ptr<ViewerHandle>(); |
176 } | 176 } |
177 | 177 |
178 } // namespace viewer | 178 } // namespace viewer |
179 | 179 |
180 } // namespace dom_distiller | 180 } // namespace dom_distiller |
OLD | NEW |