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 #ifndef CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ |
6 #define CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ | 6 #define CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/gtest_prod_util.h" | |
10 #include "chrome/browser/search/iframe_source.h" | 11 #include "chrome/browser/search/iframe_source.h" |
11 | 12 |
12 // Serves HTML for displaying suggestions using iframes, e.g. | 13 // Serves HTML for displaying suggestions using iframes, e.g. |
13 // chrome-search://suggestion/loader.html | 14 // chrome-search://suggestion/loader.html |
14 class MostVisitedIframeSource : public IframeSource { | 15 class MostVisitedIframeSource : public IframeSource { |
15 public: | 16 public: |
16 MostVisitedIframeSource(); | 17 MostVisitedIframeSource(); |
17 virtual ~MostVisitedIframeSource(); | 18 virtual ~MostVisitedIframeSource(); |
18 | 19 |
19 // Number of Most Visited elements on the NTP for logging purposes. | 20 // Number of Most Visited elements on the NTP for logging purposes. |
20 static const int kNumMostVisited; | 21 static const int kNumMostVisited; |
21 // Name of the histogram keeping track of Most Visited clicks. | 22 // Name of the histogram keeping track of Most Visited clicks. |
22 static const char kMostVisitedHistogramName[]; | 23 static const char kMostVisitedHistogramName[]; |
23 | 24 |
24 // Overridden from IframeSource. Public for testing. | 25 // Overridden from IframeSource. Public for testing. |
25 virtual void StartDataRequest( | 26 virtual void StartDataRequest( |
26 const std::string& path_and_query, | 27 const std::string& path_and_query, |
27 int render_process_id, | 28 int render_process_id, |
28 int render_view_id, | 29 int render_view_id, |
29 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 30 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
30 | 31 |
31 protected: | 32 protected: |
32 // Overridden from IframeSource: | 33 // Overridden from IframeSource: |
33 virtual std::string GetSource() const OVERRIDE; | 34 virtual std::string GetSource() const OVERRIDE; |
34 | 35 |
35 virtual bool ServesPath(const std::string& path) const OVERRIDE; | 36 virtual bool ServesPath(const std::string& path) const OVERRIDE; |
36 | 37 |
38 private: | |
39 FRIEND_TEST_ALL_PREFIXES(MostVisitedIframeSourceTest, | |
40 LogEndpointIsValidWithProvider); | |
41 // Logs the click on a Most Visited tile for a specific |provider|. Note that | |
Alexei Svitkine (slow)
2013/12/13 20:12:49
Nit: Add an empty line before that.
Mathieu
2013/12/13 20:17:56
Done.
| |
42 // the UMA_HISTOGRAM_ENUMERATION macro cannot be used since it caches the | |
43 // histogram object at the call site, which will not work in this case. | |
44 void LogMostVisitedProviderClick(int position, const std::string& provider); | |
45 | |
46 // Returns the name of the histogram that should be logged for a click to a | |
47 // specified Most Visited |provider|. | |
48 static std::string GetHistogramNameForProvider(const std::string& provider); | |
49 | |
37 DISALLOW_COPY_AND_ASSIGN(MostVisitedIframeSource); | 50 DISALLOW_COPY_AND_ASSIGN(MostVisitedIframeSource); |
38 }; | 51 }; |
39 | 52 |
40 #endif // CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ | 53 #endif // CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ |
OLD | NEW |