OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/search/most_visited_iframe_source.h" | 5 #include "chrome/browser/search/most_visited_iframe_source.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "content/public/browser/user_metrics.h" | 11 #include "content/public/browser/user_metrics.h" |
12 #include "grit/browser_resources.h" | 12 #include "grit/browser_resources.h" |
13 #include "net/base/url_util.h" | 13 #include "net/base/url_util.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 const char kTitleHTMLPath[] = "/title.html"; | 18 const char kTitleHTMLPath[] = "/title.html"; |
19 const char kTitleCSSPath[] = "/title.css"; | 19 const char kTitleCSSPath[] = "/title.css"; |
20 const char kTitleJSPath[] = "/title.js"; | 20 const char kTitleJSPath[] = "/title.js"; |
21 const char kThumbnailHTMLPath[] = "/thumbnail.html"; | 21 const char kThumbnailHTMLPath[] = "/thumbnail.html"; |
22 const char kThumbnailCSSPath[] = "/thumbnail.css"; | 22 const char kThumbnailCSSPath[] = "/thumbnail.css"; |
23 const char kThumbnailJSPath[] = "/thumbnail.js"; | 23 const char kThumbnailJSPath[] = "/thumbnail.js"; |
24 const char kUtilJSPath[] = "/util.js"; | 24 const char kUtilJSPath[] = "/util.js"; |
25 const char kCommonCSSPath[] = "/common.css"; | 25 const char kCommonCSSPath[] = "/common.css"; |
26 | 26 |
| 27 const char kRobotoWoffPath[] = "/roboto.woff"; |
| 28 const char kRobotoWoff2Path[] = "/roboto.woff2"; |
| 29 |
27 } // namespace | 30 } // namespace |
28 | 31 |
29 MostVisitedIframeSource::MostVisitedIframeSource() { | 32 MostVisitedIframeSource::MostVisitedIframeSource() { |
30 } | 33 } |
31 | 34 |
32 MostVisitedIframeSource::~MostVisitedIframeSource() { | 35 MostVisitedIframeSource::~MostVisitedIframeSource() { |
33 } | 36 } |
34 | 37 |
35 const int MostVisitedIframeSource::kNumMostVisited = 8; | 38 const int MostVisitedIframeSource::kNumMostVisited = 8; |
36 const char MostVisitedIframeSource::kMostVisitedHistogramName[] = | 39 const char MostVisitedIframeSource::kMostVisitedHistogramName[] = |
(...skipping 21 matching lines...) Expand all Loading... |
58 } else if (path == kThumbnailCSSPath) { | 61 } else if (path == kThumbnailCSSPath) { |
59 SendResource(IDR_MOST_VISITED_THUMBNAIL_CSS, callback); | 62 SendResource(IDR_MOST_VISITED_THUMBNAIL_CSS, callback); |
60 } else if (path == kThumbnailJSPath) { | 63 } else if (path == kThumbnailJSPath) { |
61 SendJSWithOrigin(IDR_MOST_VISITED_THUMBNAIL_JS, render_process_id, | 64 SendJSWithOrigin(IDR_MOST_VISITED_THUMBNAIL_JS, render_process_id, |
62 render_frame_id, callback); | 65 render_frame_id, callback); |
63 } else if (path == kUtilJSPath) { | 66 } else if (path == kUtilJSPath) { |
64 SendJSWithOrigin(IDR_MOST_VISITED_UTIL_JS, render_process_id, | 67 SendJSWithOrigin(IDR_MOST_VISITED_UTIL_JS, render_process_id, |
65 render_frame_id, callback); | 68 render_frame_id, callback); |
66 } else if (path == kCommonCSSPath) { | 69 } else if (path == kCommonCSSPath) { |
67 SendResource(IDR_MOST_VISITED_IFRAME_CSS, callback); | 70 SendResource(IDR_MOST_VISITED_IFRAME_CSS, callback); |
| 71 } else if (path == kRobotoWoffPath) { |
| 72 SendResource(IDR_ROBOTO_WOFF, callback); |
| 73 } else if (path == kRobotoWoff2Path) { |
| 74 SendResource(IDR_ROBOTO_WOFF2, callback); |
68 } else { | 75 } else { |
69 callback.Run(NULL); | 76 callback.Run(NULL); |
70 } | 77 } |
71 } | 78 } |
72 | 79 |
73 bool MostVisitedIframeSource::ServesPath(const std::string& path) const { | 80 bool MostVisitedIframeSource::ServesPath(const std::string& path) const { |
74 return path == kTitleHTMLPath || path == kTitleCSSPath || | 81 return path == kTitleHTMLPath || path == kTitleCSSPath || |
75 path == kTitleJSPath || path == kThumbnailHTMLPath || | 82 path == kTitleJSPath || path == kThumbnailHTMLPath || |
76 path == kThumbnailCSSPath || path == kThumbnailJSPath || | 83 path == kThumbnailCSSPath || path == kThumbnailJSPath || |
77 path == kUtilJSPath || path == kCommonCSSPath; | 84 path == kUtilJSPath || path == kCommonCSSPath || |
| 85 path == kRobotoWoffPath || path == kRobotoWoff2Path; |
78 } | 86 } |
OLD | NEW |