| 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" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 SendResource(IDR_MOST_VISITED_TITLE_HTML, callback); | 53 SendResource(IDR_MOST_VISITED_TITLE_HTML, callback); |
| 54 } else if (path == kTitleCSSPath) { | 54 } else if (path == kTitleCSSPath) { |
| 55 SendResource(IDR_MOST_VISITED_TITLE_CSS, callback); | 55 SendResource(IDR_MOST_VISITED_TITLE_CSS, callback); |
| 56 } else if (path == kTitleJSPath) { | 56 } else if (path == kTitleJSPath) { |
| 57 SendResource(IDR_MOST_VISITED_TITLE_JS, callback); | 57 SendResource(IDR_MOST_VISITED_TITLE_JS, callback); |
| 58 } else if (path == kThumbnailHTMLPath) { | 58 } else if (path == kThumbnailHTMLPath) { |
| 59 SendResource(IDR_MOST_VISITED_THUMBNAIL_HTML, callback); | 59 SendResource(IDR_MOST_VISITED_THUMBNAIL_HTML, callback); |
| 60 } else if (path == kThumbnailCSSPath) { | 60 } else if (path == kThumbnailCSSPath) { |
| 61 SendResource(IDR_MOST_VISITED_THUMBNAIL_CSS, callback); | 61 SendResource(IDR_MOST_VISITED_THUMBNAIL_CSS, callback); |
| 62 } else if (path == kThumbnailJSPath) { | 62 } else if (path == kThumbnailJSPath) { |
| 63 SendResource(IDR_MOST_VISITED_THUMBNAIL_JS, callback); | 63 SendJSWithOrigin(IDR_MOST_VISITED_THUMBNAIL_JS, render_process_id, |
| 64 render_frame_id, callback); |
| 64 } else if (path == kUtilJSPath) { | 65 } else if (path == kUtilJSPath) { |
| 65 SendResource(IDR_MOST_VISITED_UTIL_JS, callback); | 66 SendResource(IDR_MOST_VISITED_UTIL_JS, callback); |
| 66 } else if (path == kCommonCSSPath) { | 67 } else if (path == kCommonCSSPath) { |
| 67 SendResource(IDR_MOST_VISITED_IFRAME_CSS, callback); | 68 SendResource(IDR_MOST_VISITED_IFRAME_CSS, callback); |
| 68 } else if (path == kLogHTMLPath) { | 69 } else if (path == kLogHTMLPath) { |
| 69 // Log the clicked MostVisited element by position. | 70 // Log the clicked MostVisited element by position. |
| 70 std::string str_position; | 71 std::string str_position; |
| 71 int position; | 72 int position; |
| 72 if (net::GetValueForKeyInQuery(url, "pos", &str_position) && | 73 if (net::GetValueForKeyInQuery(url, "pos", &str_position) && |
| 73 base::StringToInt(str_position, &position)) { | 74 base::StringToInt(str_position, &position)) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 base::Histogram::kUmaTargetedHistogramFlag); | 110 base::Histogram::kUmaTargetedHistogramFlag); |
| 110 counter->Add(position); | 111 counter->Add(position); |
| 111 } | 112 } |
| 112 | 113 |
| 113 // static | 114 // static |
| 114 std::string MostVisitedIframeSource::GetHistogramNameForProvider( | 115 std::string MostVisitedIframeSource::GetHistogramNameForProvider( |
| 115 const std::string& provider) { | 116 const std::string& provider) { |
| 116 return base::StringPrintf(kMostVisitedHistogramWithProvider, | 117 return base::StringPrintf(kMostVisitedHistogramWithProvider, |
| 117 provider.c_str()); | 118 provider.c_str()); |
| 118 } | 119 } |
| OLD | NEW |