| 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_HISTORY_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/common/cancelable_request.h" | 15 #include "chrome/browser/common/cancelable_request.h" |
| 16 #include "chrome/browser/history/history_service.h" | 16 #include "chrome/browser/history/history_service.h" |
| 17 #include "chrome/browser/history/web_history_service.h" | 17 #include "chrome/browser/history/web_history_service.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/web_ui_controller.h" | 19 #include "content/public/browser/web_ui_controller.h" |
| 20 #include "content/public/browser/web_ui_message_handler.h" | 20 #include "content/public/browser/web_ui_message_handler.h" |
| 21 | 21 |
| 22 class BookmarkModel; | 22 class BookmarkModel; |
| 23 class ManagedUserService; | |
| 24 class ProfileSyncService; | 23 class ProfileSyncService; |
| 24 class SupervisedUserService; |
| 25 | 25 |
| 26 // The handler for Javascript messages related to the "history" view. | 26 // The handler for Javascript messages related to the "history" view. |
| 27 class BrowsingHistoryHandler : public content::WebUIMessageHandler, | 27 class BrowsingHistoryHandler : public content::WebUIMessageHandler, |
| 28 public content::NotificationObserver { | 28 public content::NotificationObserver { |
| 29 public: | 29 public: |
| 30 // Represents a history entry to be shown to the user, representing either | 30 // Represents a history entry to be shown to the user, representing either |
| 31 // a local or remote visit. A single entry can represent multiple visits, | 31 // a local or remote visit. A single entry can represent multiple visits, |
| 32 // since only the most recent visit on a particular day is shown. | 32 // since only the most recent visit on a particular day is shown. |
| 33 struct HistoryEntry { | 33 struct HistoryEntry { |
| 34 // Values indicating whether an entry represents only local visits, only | 34 // Values indicating whether an entry represents only local visits, only |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 bool blocked_visit, const std::string& accept_languages); | 46 bool blocked_visit, const std::string& accept_languages); |
| 47 HistoryEntry(); | 47 HistoryEntry(); |
| 48 virtual ~HistoryEntry(); | 48 virtual ~HistoryEntry(); |
| 49 | 49 |
| 50 // Formats this entry's URL and title and adds them to |result|. | 50 // Formats this entry's URL and title and adds them to |result|. |
| 51 void SetUrlAndTitle(base::DictionaryValue* result) const; | 51 void SetUrlAndTitle(base::DictionaryValue* result) const; |
| 52 | 52 |
| 53 // Converts the entry to a DictionaryValue to be owned by the caller. | 53 // Converts the entry to a DictionaryValue to be owned by the caller. |
| 54 scoped_ptr<base::DictionaryValue> ToValue( | 54 scoped_ptr<base::DictionaryValue> ToValue( |
| 55 BookmarkModel* bookmark_model, | 55 BookmarkModel* bookmark_model, |
| 56 ManagedUserService* managed_user_service, | 56 SupervisedUserService* supervised_user_service, |
| 57 const ProfileSyncService* sync_service) const; | 57 const ProfileSyncService* sync_service) const; |
| 58 | 58 |
| 59 // Comparison function for sorting HistoryEntries from newest to oldest. | 59 // Comparison function for sorting HistoryEntries from newest to oldest. |
| 60 static bool SortByTimeDescending( | 60 static bool SortByTimeDescending( |
| 61 const HistoryEntry& entry1, const HistoryEntry& entry2); | 61 const HistoryEntry& entry1, const HistoryEntry& entry2); |
| 62 | 62 |
| 63 // The type of visits this entry represents: local, remote, or both. | 63 // The type of visits this entry represents: local, remote, or both. |
| 64 EntryType entry_type; | 64 EntryType entry_type; |
| 65 | 65 |
| 66 GURL url; | 66 GURL url; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 explicit HistoryUI(content::WebUI* web_ui); | 212 explicit HistoryUI(content::WebUI* web_ui); |
| 213 | 213 |
| 214 static base::RefCountedMemory* GetFaviconResourceBytes( | 214 static base::RefCountedMemory* GetFaviconResourceBytes( |
| 215 ui::ScaleFactor scale_factor); | 215 ui::ScaleFactor scale_factor); |
| 216 | 216 |
| 217 private: | 217 private: |
| 218 DISALLOW_COPY_AND_ASSIGN(HistoryUI); | 218 DISALLOW_COPY_AND_ASSIGN(HistoryUI); |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 221 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
| OLD | NEW |