OLD | NEW |
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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/common/cancelable_request.h" | 10 #include "chrome/browser/common/cancelable_request.h" |
11 #include "chrome/browser/history/history_types.h" | 11 #include "chrome/browser/history/history_types.h" |
12 #include "chrome/browser/ui/webui/ntp/suggestions_combiner.h" | 12 #include "chrome/browser/ui/webui/ntp/suggestions_combiner.h" |
13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
15 #include "content/public/browser/web_ui_message_handler.h" | 15 #include "content/public/browser/web_ui_message_handler.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 class PageUsageData; | 18 class PageUsageData; |
19 class PrefService; | 19 class PrefServiceSyncable; |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class ListValue; | 22 class ListValue; |
23 class Value; | 23 class Value; |
24 } | 24 } |
25 | 25 |
26 // The handler for Javascript messages related to the "suggestions" view. | 26 // The handler for Javascript messages related to the "suggestions" view. |
27 // | 27 // |
28 // This class manages one preference: | 28 // This class manages one preference: |
29 // - The URL blacklist: URLs we do not want to show in the thumbnails list. It | 29 // - The URL blacklist: URLs we do not want to show in the thumbnails list. It |
(...skipping 28 matching lines...) Expand all Loading... |
58 void HandleSuggestedSitesSelected(const base::ListValue* args); | 58 void HandleSuggestedSitesSelected(const base::ListValue* args); |
59 | 59 |
60 // content::NotificationObserver implementation. | 60 // content::NotificationObserver implementation. |
61 virtual void Observe(int type, | 61 virtual void Observe(int type, |
62 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
63 const content::NotificationDetails& details) OVERRIDE; | 63 const content::NotificationDetails& details) OVERRIDE; |
64 | 64 |
65 // SuggestionsCombiner::Delegate implementation. | 65 // SuggestionsCombiner::Delegate implementation. |
66 virtual void OnSuggestionsReady() OVERRIDE; | 66 virtual void OnSuggestionsReady() OVERRIDE; |
67 | 67 |
68 static void RegisterUserPrefs(PrefService* prefs); | 68 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
69 | 69 |
70 private: | 70 private: |
71 // Puts the passed URL in the blacklist (so it does not show as a thumbnail). | 71 // Puts the passed URL in the blacklist (so it does not show as a thumbnail). |
72 void BlacklistURL(const GURL& url); | 72 void BlacklistURL(const GURL& url); |
73 | 73 |
74 // Returns the key used in url_blacklist_ for the passed |url|. | 74 // Returns the key used in url_blacklist_ for the passed |url|. |
75 std::string GetDictionaryKeyForURL(const std::string& url); | 75 std::string GetDictionaryKeyForURL(const std::string& url); |
76 | 76 |
77 // Sends pages_value_ to the javascript side to and resets page_value_. | 77 // Sends pages_value_ to the javascript side to and resets page_value_. |
78 void SendPagesValue(); | 78 void SendPagesValue(); |
(...skipping 10 matching lines...) Expand all Loading... |
89 // Whether the user has viewed the 'suggested' pane. | 89 // Whether the user has viewed the 'suggested' pane. |
90 bool suggestions_viewed_; | 90 bool suggestions_viewed_; |
91 | 91 |
92 // Whether the user has performed a "tracked" action to leave the page or not. | 92 // Whether the user has performed a "tracked" action to leave the page or not. |
93 bool user_action_logged_; | 93 bool user_action_logged_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(SuggestionsHandler); | 95 DISALLOW_COPY_AND_ASSIGN(SuggestionsHandler); |
96 }; | 96 }; |
97 | 97 |
98 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_ | 98 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_PAGE_HANDLER_H_ |
OLD | NEW |