| 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 PrefService; | 20 class PrefServiceSyncable; |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class ListValue; | 23 class ListValue; |
| 24 class Value; | 24 class Value; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // The handler for Javascript messages related to the "most visited" view. | 27 // The handler for Javascript messages related to the "most visited" 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 // content::NotificationObserver implementation. | 61 // content::NotificationObserver implementation. |
| 62 virtual void Observe(int type, | 62 virtual void Observe(int type, |
| 63 const content::NotificationSource& source, | 63 const content::NotificationSource& source, |
| 64 const content::NotificationDetails& details) OVERRIDE; | 64 const content::NotificationDetails& details) OVERRIDE; |
| 65 | 65 |
| 66 const std::vector<GURL>& most_visited_urls() const { | 66 const std::vector<GURL>& most_visited_urls() const { |
| 67 return most_visited_urls_; | 67 return most_visited_urls_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 static void RegisterUserPrefs(PrefService* prefs); | 70 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 struct MostVisitedPage; | 73 struct MostVisitedPage; |
| 74 | 74 |
| 75 // Send a request to the HistoryService to get the most visited pages. | 75 // Send a request to the HistoryService to get the most visited pages. |
| 76 void StartQueryForMostVisited(); | 76 void StartQueryForMostVisited(); |
| 77 | 77 |
| 78 // Sets pages_value_ from a format produced by TopSites. | 78 // Sets pages_value_ from a format produced by TopSites. |
| 79 void SetPagesValueFromTopSites(const history::MostVisitedURLList& data); | 79 void SetPagesValueFromTopSites(const history::MostVisitedURLList& data); |
| 80 | 80 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 110 // Whether the user has viewed the 'most visited' pane. | 110 // Whether the user has viewed the 'most visited' pane. |
| 111 bool most_visited_viewed_; | 111 bool most_visited_viewed_; |
| 112 | 112 |
| 113 // Whether the user has performed a "tracked" action to leave the page or not. | 113 // Whether the user has performed a "tracked" action to leave the page or not. |
| 114 bool user_action_logged_; | 114 bool user_action_logged_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(MostVisitedHandler); | 116 DISALLOW_COPY_AND_ASSIGN(MostVisitedHandler); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 #endif // CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ | 119 #endif // CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ |
| OLD | NEW |