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

Side by Side Diff: chrome/browser/ui/webui/ntp/suggestions_page_handler.h

Issue 9958116: Adds the NewTabPage.SuggestedSitesAction stat. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 26
27 // The handler for Javascript messages related to the "suggestions" view. 27 // The handler for Javascript messages related to the "suggestions" view.
28 // 28 //
29 // This class manages one preference: 29 // This class manages one preference:
30 // - The URL blacklist: URLs we do not want to show in the thumbnails list. It 30 // - The URL blacklist: URLs we do not want to show in the thumbnails list. It
31 // is a dictionary for quick access (it associates a dummy boolean to the URL 31 // is a dictionary for quick access (it associates a dummy boolean to the URL
32 // string). 32 // string).
33 class SuggestionsHandler : public content::WebUIMessageHandler, 33 class SuggestionsHandler : public content::WebUIMessageHandler,
34 public content::NotificationObserver { 34 public content::NotificationObserver {
35 public: 35 public:
36
37 SuggestionsHandler(); 36 SuggestionsHandler();
38 virtual ~SuggestionsHandler(); 37 virtual ~SuggestionsHandler();
39 38
40 // WebUIMessageHandler override and implementation. 39 // WebUIMessageHandler override and implementation.
41 virtual void RegisterMessages() OVERRIDE; 40 virtual void RegisterMessages() OVERRIDE;
42 41
43 // Callback for the "getSuggestions" message. 42 // Callback for the "getSuggestions" message.
44 void HandleGetSuggestions(const base::ListValue* args); 43 void HandleGetSuggestions(const base::ListValue* args);
45 44
46 // Callback for the "blacklistURLFromSuggestions" message. 45 // Callback for the "blacklistURLFromSuggestions" message.
47 void HandleBlacklistURL(const base::ListValue* args); 46 void HandleBlacklistURL(const base::ListValue* args);
48 47
49 // Callback for the "removeURLsFromSuggestionsBlacklist" message. 48 // Callback for the "removeURLsFromSuggestionsBlacklist" message.
50 void HandleRemoveURLsFromBlacklist(const base::ListValue* args); 49 void HandleRemoveURLsFromBlacklist(const base::ListValue* args);
51 50
52 // Callback for the "clearSuggestionsURLsBlacklist" message. 51 // Callback for the "clearSuggestionsURLsBlacklist" message.
53 void HandleClearBlacklist(const base::ListValue* args); 52 void HandleClearBlacklist(const base::ListValue* args);
54 53
54 // Callback for the "suggestedSitesAction" message.
55 void HandleSuggestedSitesAction(const base::ListValue* args);
56
57 // Callback for the "suggestedSitesSelected" message.
58 void HandleSuggestedSitesSelected(const base::ListValue* args);
59
55 // content::NotificationObserver implementation. 60 // content::NotificationObserver implementation.
56 virtual void Observe(int type, 61 virtual void Observe(int type,
57 const content::NotificationSource& source, 62 const content::NotificationSource& source,
58 const content::NotificationDetails& details) OVERRIDE; 63 const content::NotificationDetails& details) OVERRIDE;
59 64
60 static void RegisterUserPrefs(PrefService* prefs); 65 static void RegisterUserPrefs(PrefService* prefs);
61 66
62 private: 67 private:
63 // Send a request to the HistoryService to get the suggestions pages. 68 // Send a request to the HistoryService to get the suggestions pages.
64 void StartQueryForSuggestions(); 69 void StartQueryForSuggestions();
(...skipping 23 matching lines...) Expand all
88 // Consumer for history service general request(s). 93 // Consumer for history service general request(s).
89 CancelableRequestConsumer history_consumer_; 94 CancelableRequestConsumer history_consumer_;
90 95
91 // We pre-fetch the first set of result pages. This variable is false until 96 // We pre-fetch the first set of result pages. This variable is false until
92 // we get the first getSuggestions() call. 97 // we get the first getSuggestions() call.
93 bool got_first_suggestions_request_; 98 bool got_first_suggestions_request_;
94 99
95 // Keep the results of the db query here. 100 // Keep the results of the db query here.
96 scoped_ptr<base::ListValue> pages_value_; 101 scoped_ptr<base::ListValue> pages_value_;
97 102
103 // Whether the user has viewed the 'suggested' pane.
104 bool suggestions_viewed_;
105
106 // Whether the user has performed a "tracked" action to leave the page or not.
107 bool valid_user_action_;
Evan Stade 2012/04/12 03:30:53 i don't like this variable name much, how about "u
macourteau 2012/04/12 13:59:43 Done.
108
98 DISALLOW_COPY_AND_ASSIGN(SuggestionsHandler); 109 DISALLOW_COPY_AND_ASSIGN(SuggestionsHandler);
99 }; 110 };
100 111
101 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_ 112 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698