| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // is a dictionary for quick access (it associates a dummy boolean to the URL | 33 // is a dictionary for quick access (it associates a dummy boolean to the URL |
| 34 // string). | 34 // string). |
| 35 class MostVisitedHandler : public content::WebUIMessageHandler, | 35 class MostVisitedHandler : public content::WebUIMessageHandler, |
| 36 public content::NotificationObserver { | 36 public content::NotificationObserver { |
| 37 public: | 37 public: |
| 38 | 38 |
| 39 MostVisitedHandler(); | 39 MostVisitedHandler(); |
| 40 virtual ~MostVisitedHandler(); | 40 virtual ~MostVisitedHandler(); |
| 41 | 41 |
| 42 // WebUIMessageHandler override and implementation. | 42 // WebUIMessageHandler override and implementation. |
| 43 virtual void RegisterMessages() OVERRIDE; | 43 virtual void RegisterMessages() override; |
| 44 | 44 |
| 45 // Callback for the "getMostVisited" message. | 45 // Callback for the "getMostVisited" message. |
| 46 void HandleGetMostVisited(const base::ListValue* args); | 46 void HandleGetMostVisited(const base::ListValue* args); |
| 47 | 47 |
| 48 // Callback for the "blacklistURLFromMostVisited" message. | 48 // Callback for the "blacklistURLFromMostVisited" message. |
| 49 void HandleBlacklistUrl(const base::ListValue* args); | 49 void HandleBlacklistUrl(const base::ListValue* args); |
| 50 | 50 |
| 51 // Callback for the "removeURLsFromMostVisitedBlacklist" message. | 51 // Callback for the "removeURLsFromMostVisitedBlacklist" message. |
| 52 void HandleRemoveUrlsFromBlacklist(const base::ListValue* args); | 52 void HandleRemoveUrlsFromBlacklist(const base::ListValue* args); |
| 53 | 53 |
| 54 // Callback for the "clearMostVisitedURLsBlacklist" message. | 54 // Callback for the "clearMostVisitedURLsBlacklist" message. |
| 55 void HandleClearBlacklist(const base::ListValue* args); | 55 void HandleClearBlacklist(const base::ListValue* args); |
| 56 | 56 |
| 57 // Callback for the "mostVisitedAction" message. | 57 // Callback for the "mostVisitedAction" message. |
| 58 void HandleMostVisitedAction(const base::ListValue* args); | 58 void HandleMostVisitedAction(const base::ListValue* args); |
| 59 | 59 |
| 60 // Callback for the "mostVisitedSelected" message. | 60 // Callback for the "mostVisitedSelected" message. |
| 61 void HandleMostVisitedSelected(const base::ListValue* args); | 61 void HandleMostVisitedSelected(const base::ListValue* args); |
| 62 | 62 |
| 63 // content::NotificationObserver implementation. | 63 // content::NotificationObserver implementation. |
| 64 virtual void Observe(int type, | 64 virtual void Observe(int type, |
| 65 const content::NotificationSource& source, | 65 const content::NotificationSource& source, |
| 66 const content::NotificationDetails& details) OVERRIDE; | 66 const content::NotificationDetails& details) override; |
| 67 | 67 |
| 68 const std::vector<GURL>& most_visited_urls() const { | 68 const std::vector<GURL>& most_visited_urls() const { |
| 69 return most_visited_urls_; | 69 return most_visited_urls_; |
| 70 } | 70 } |
| 71 | 71 |
| 72 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 72 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 struct MostVisitedPage; | 75 struct MostVisitedPage; |
| 76 | 76 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Whether the user has performed a "tracked" action to leave the page or not. | 112 // Whether the user has performed a "tracked" action to leave the page or not. |
| 113 bool user_action_logged_; | 113 bool user_action_logged_; |
| 114 | 114 |
| 115 // For callbacks which may be run after destruction. | 115 // For callbacks which may be run after destruction. |
| 116 base::WeakPtrFactory<MostVisitedHandler> weak_ptr_factory_; | 116 base::WeakPtrFactory<MostVisitedHandler> weak_ptr_factory_; |
| 117 | 117 |
| 118 DISALLOW_COPY_AND_ASSIGN(MostVisitedHandler); | 118 DISALLOW_COPY_AND_ASSIGN(MostVisitedHandler); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 #endif // CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ | 121 #endif // CHROME_BROWSER_UI_WEBUI_NTP_MOST_VISITED_HANDLER_H_ |
| OLD | NEW |