Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: chrome/browser/search/most_visited_iframe_source.h

Issue 111423005: [Most Visited] Log suggestion provider to UMA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaning Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/strings/stringprintf.h"
10 #include "chrome/browser/search/iframe_source.h" 11 #include "chrome/browser/search/iframe_source.h"
11 12
13 class MostVisitedIframeSource;
beaudoin 2013/12/12 19:37:21 Do you really need to forward declare this for the
Mathieu 2013/12/12 21:39:13 Done.
14
15 #define MV_CLICK_HISTOGRAM(position, provider) \
beaudoin 2013/12/12 19:37:21 Do you have to do this in the .h? It pollutes the
Mathieu 2013/12/12 21:39:13 Done.
16 do { \
17 std::string histogram_name = provider ? \
18 base::StringPrintf( \
19 MostVisitedIframeSource::kMostVisitedHistogramWithProvider, \
20 provider) : MostVisitedIframeSource::kMostVisitedHistogramName; \
21 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( \
22 histogram_name, 1, MostVisitedIframeSource::kNumMostVisited, \
23 MostVisitedIframeSource::kNumMostVisited + 1, \
24 base::Histogram::kUmaTargetedHistogramFlag); \
beaudoin 2013/12/12 19:39:51 Missing the includes for all the histogram stuff.
Mathieu 2013/12/12 21:39:13 Done.
25 counter->Add(position); \
26 } while (0)
27
12 // Serves HTML for displaying suggestions using iframes, e.g. 28 // Serves HTML for displaying suggestions using iframes, e.g.
13 // chrome-search://suggestion/loader.html 29 // chrome-search://suggestion/loader.html
14 class MostVisitedIframeSource : public IframeSource { 30 class MostVisitedIframeSource : public IframeSource {
15 public: 31 public:
16 MostVisitedIframeSource(); 32 MostVisitedIframeSource();
17 virtual ~MostVisitedIframeSource(); 33 virtual ~MostVisitedIframeSource();
18 34
19 // Number of Most Visited elements on the NTP for logging purposes. 35 // Number of Most Visited elements on the NTP for logging purposes.
20 static const int kNumMostVisited; 36 static const int kNumMostVisited;
21 // Name of the histogram keeping track of Most Visited clicks. 37 // Name of the histogram keeping track of Most Visited clicks.
22 static const char kMostVisitedHistogramName[]; 38 static const char kMostVisitedHistogramName[];
39 // Format string keeping track of MV clicks specific to a provider.
beaudoin 2013/12/12 19:43:06 Format string to generate the name of the histogra
Mathieu 2013/12/12 21:39:13 Done.
40 static const char kMostVisitedHistogramWithProvider[];
23 41
24 // Overridden from IframeSource. Public for testing. 42 // Overridden from IframeSource. Public for testing.
25 virtual void StartDataRequest( 43 virtual void StartDataRequest(
26 const std::string& path_and_query, 44 const std::string& path_and_query,
27 int render_process_id, 45 int render_process_id,
28 int render_view_id, 46 int render_view_id,
29 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; 47 const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
30 48
31 protected: 49 protected:
32 // Overridden from IframeSource: 50 // Overridden from IframeSource:
33 virtual std::string GetSource() const OVERRIDE; 51 virtual std::string GetSource() const OVERRIDE;
34 52
35 virtual bool ServesPath(const std::string& path) const OVERRIDE; 53 virtual bool ServesPath(const std::string& path) const OVERRIDE;
36 54
37 DISALLOW_COPY_AND_ASSIGN(MostVisitedIframeSource); 55 DISALLOW_COPY_AND_ASSIGN(MostVisitedIframeSource);
38 }; 56 };
39 57
40 #endif // CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_ 58 #endif // CHROME_BROWSER_SEARCH_MOST_VISITED_IFRAME_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698