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_MOST_VISITED_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/common/cancelable_request.h" | 12 #include "chrome/browser/common/cancelable_request.h" |
13 #include "chrome/browser/history/history_types.h" | 13 #include "chrome/browser/history/history_types.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "content/public/browser/web_ui_message_handler.h" | 16 #include "content/public/browser/web_ui_message_handler.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 class PageUsageData; | 19 class PageUsageData; |
20 class PrefRegistrySyncable; | |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 class ListValue; | 22 class ListValue; |
24 class Value; | 23 class Value; |
25 } | 24 } |
26 | 25 |
| 26 namespace user_prefs { |
| 27 class PrefRegistrySyncable; |
| 28 } |
| 29 |
27 // The handler for Javascript messages related to the "most visited" view. | 30 // The handler for Javascript messages related to the "most visited" view. |
28 // | 31 // |
29 // This class manages one preference: | 32 // This class manages one preference: |
30 // - The URL blacklist: URLs we do not want to show in the thumbnails list. It | 33 // - 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 | 34 // is a dictionary for quick access (it associates a dummy boolean to the URL |
32 // string). | 35 // string). |
33 class MostVisitedHandler : public content::WebUIMessageHandler, | 36 class MostVisitedHandler : public content::WebUIMessageHandler, |
34 public content::NotificationObserver { | 37 public content::NotificationObserver { |
35 public: | 38 public: |
36 | 39 |
(...skipping 23 matching lines...) Expand all Loading... |
60 | 63 |
61 // content::NotificationObserver implementation. | 64 // content::NotificationObserver implementation. |
62 virtual void Observe(int type, | 65 virtual void Observe(int type, |
63 const content::NotificationSource& source, | 66 const content::NotificationSource& source, |
64 const content::NotificationDetails& details) OVERRIDE; | 67 const content::NotificationDetails& details) OVERRIDE; |
65 | 68 |
66 const std::vector<GURL>& most_visited_urls() const { | 69 const std::vector<GURL>& most_visited_urls() const { |
67 return most_visited_urls_; | 70 return most_visited_urls_; |
68 } | 71 } |
69 | 72 |
70 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 73 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
71 | 74 |
72 private: | 75 private: |
73 struct MostVisitedPage; | 76 struct MostVisitedPage; |
74 | 77 |
75 // Send a request to the HistoryService to get the most visited pages. | 78 // Send a request to the HistoryService to get the most visited pages. |
76 void StartQueryForMostVisited(); | 79 void StartQueryForMostVisited(); |
77 | 80 |
78 // Sets pages_value_ from a format produced by TopSites. | 81 // Sets pages_value_ from a format produced by TopSites. |
79 void SetPagesValueFromTopSites(const history::MostVisitedURLList& data); | 82 void SetPagesValueFromTopSites(const history::MostVisitedURLList& data); |
80 | 83 |
(...skipping 29 matching lines...) Expand all Loading... |
110 // Whether the user has viewed the 'most visited' pane. | 113 // Whether the user has viewed the 'most visited' pane. |
111 bool most_visited_viewed_; | 114 bool most_visited_viewed_; |
112 | 115 |
113 // Whether the user has performed a "tracked" action to leave the page or not. | 116 // Whether the user has performed a "tracked" action to leave the page or not. |
114 bool user_action_logged_; | 117 bool user_action_logged_; |
115 | 118 |
116 DISALLOW_COPY_AND_ASSIGN(MostVisitedHandler); | 119 DISALLOW_COPY_AND_ASSIGN(MostVisitedHandler); |
117 }; | 120 }; |
118 | 121 |
119 #endif // CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ | 122 #endif // CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ |
OLD | NEW |