Chromium Code Reviews| 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> | |
| 9 | |
| 8 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 9 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 10 #include "base/values.h" | 12 #include "base/values.h" |
| 11 #include "chrome/browser/common/cancelable_request.h" | 13 #include "chrome/browser/common/cancelable_request.h" |
| 12 #include "chrome/browser/history/history_service.h" | 14 #include "chrome/browser/history/history_service.h" |
| 13 #include "chrome/browser/history/web_history_service.h" | 15 #include "chrome/browser/history/web_history_service.h" |
| 14 #include "chrome/common/cancelable_task_tracker.h" | 16 #include "chrome/common/cancelable_task_tracker.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 16 #include "content/public/browser/web_ui_controller.h" | 18 #include "content/public/browser/web_ui_controller.h" |
| 17 #include "content/public/browser/web_ui_message_handler.h" | 19 #include "content/public/browser/web_ui_message_handler.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 33 enum EntryType { | 35 enum EntryType { |
| 34 EMPTY_ENTRY = 0, | 36 EMPTY_ENTRY = 0, |
| 35 LOCAL_ENTRY, | 37 LOCAL_ENTRY, |
| 36 REMOTE_ENTRY, | 38 REMOTE_ENTRY, |
| 37 COMBINED_ENTRY | 39 COMBINED_ENTRY |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 HistoryEntry(EntryType type, const GURL& url, const string16& title, | 42 HistoryEntry(EntryType type, const GURL& url, const string16& title, |
| 41 base::Time time, const std::string& client_id, | 43 base::Time time, const std::string& client_id, |
| 42 bool is_search_result, const string16& snippet, | 44 bool is_search_result, const string16& snippet, |
| 43 bool blocked_visit); | 45 bool blocked_visit, const std::string& languages); |
| 44 HistoryEntry(); | 46 HistoryEntry(); |
| 45 virtual ~HistoryEntry(); | 47 virtual ~HistoryEntry(); |
| 46 | 48 |
| 47 // Formats this entry's URL and title and adds them to |result|. | 49 // Formats this entry's URL and title and adds them to |result|. |
| 48 void SetUrlAndTitle(DictionaryValue* result) const; | 50 void SetUrlAndTitle(DictionaryValue* result) const; |
| 49 | 51 |
| 52 // Formats this entry's displayable domain and adds it to |result|. | |
| 53 void SetDisplayableDomain(DictionaryValue* result) const; | |
| 54 | |
| 50 // Converts the entry to a DictionaryValue to be owned by the caller. | 55 // Converts the entry to a DictionaryValue to be owned by the caller. |
| 51 scoped_ptr<DictionaryValue> ToValue( | 56 scoped_ptr<DictionaryValue> ToValue( |
| 52 BookmarkModel* bookmark_model, | 57 BookmarkModel* bookmark_model, |
| 53 ManagedUserService* managed_user_service, | 58 ManagedUserService* managed_user_service, |
| 54 const ProfileSyncService* sync_service) const; | 59 const ProfileSyncService* sync_service) const; |
| 55 | 60 |
| 56 // Comparison function for sorting HistoryEntries from newest to oldest. | 61 // Comparison function for sorting HistoryEntries from newest to oldest. |
| 57 static bool SortByTimeDescending( | 62 static bool SortByTimeDescending( |
| 58 const HistoryEntry& entry1, const HistoryEntry& entry2); | 63 const HistoryEntry& entry1, const HistoryEntry& entry2); |
| 59 | 64 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 74 std::set<int64> all_timestamps; | 79 std::set<int64> all_timestamps; |
| 75 | 80 |
| 76 // If true, this entry is a search result. | 81 // If true, this entry is a search result. |
| 77 bool is_search_result; | 82 bool is_search_result; |
| 78 | 83 |
| 79 // The entry's search snippet, if this entry is a search result. | 84 // The entry's search snippet, if this entry is a search result. |
| 80 string16 snippet; | 85 string16 snippet; |
| 81 | 86 |
| 82 // Whether this entry was blocked when it was attempted. | 87 // Whether this entry was blocked when it was attempted. |
| 83 bool blocked_visit; | 88 bool blocked_visit; |
| 89 | |
| 90 // kAcceptLanguages pref value. | |
| 91 std::string languages; | |
|
Patrick Dubroy
2013/08/20 14:26:37
Nit: Might as well call this "accept_languages".
| |
| 84 }; | 92 }; |
| 85 | 93 |
| 86 BrowsingHistoryHandler(); | 94 BrowsingHistoryHandler(); |
| 87 virtual ~BrowsingHistoryHandler(); | 95 virtual ~BrowsingHistoryHandler(); |
| 88 | 96 |
| 89 // WebUIMessageHandler implementation. | 97 // WebUIMessageHandler implementation. |
| 90 virtual void RegisterMessages() OVERRIDE; | 98 virtual void RegisterMessages() OVERRIDE; |
| 91 | 99 |
| 92 // Handler for the "queryHistory" message. | 100 // Handler for the "queryHistory" message. |
| 93 void HandleQueryHistory(const base::ListValue* args); | 101 void HandleQueryHistory(const base::ListValue* args); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 | 164 |
| 157 bool ExtractIntegerValueAtIndex( | 165 bool ExtractIntegerValueAtIndex( |
| 158 const base::ListValue* value, int index, int* out_int); | 166 const base::ListValue* value, int index, int* out_int); |
| 159 | 167 |
| 160 // Sets the query options for a week-wide query, |offset| weeks ago. | 168 // Sets the query options for a week-wide query, |offset| weeks ago. |
| 161 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options); | 169 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options); |
| 162 | 170 |
| 163 // Sets the query options for a monthly query, |offset| months ago. | 171 // Sets the query options for a monthly query, |offset| months ago. |
| 164 void SetQueryTimeInMonths(int offset, history::QueryOptions* options); | 172 void SetQueryTimeInMonths(int offset, history::QueryOptions* options); |
| 165 | 173 |
| 174 // kAcceptLanguages pref value. | |
| 175 std::string GetLanguages() const; | |
|
Patrick Dubroy
2013/08/20 14:26:37
...and this, "GetAcceptLanguages()"
| |
| 176 | |
| 166 content::NotificationRegistrar registrar_; | 177 content::NotificationRegistrar registrar_; |
| 167 | 178 |
| 168 // Consumer for search requests to the history service. | 179 // Consumer for search requests to the history service. |
| 169 CancelableRequestConsumerT<int, 0> history_request_consumer_; | 180 CancelableRequestConsumerT<int, 0> history_request_consumer_; |
| 170 | 181 |
| 171 // The currently-executing request for synced history results. | 182 // The currently-executing request for synced history results. |
| 172 // Deleting the request will cancel it. | 183 // Deleting the request will cancel it. |
| 173 scoped_ptr<history::WebHistoryService::Request> web_history_request_; | 184 scoped_ptr<history::WebHistoryService::Request> web_history_request_; |
| 174 | 185 |
| 175 // The currently-executing delete request for synced history. | 186 // The currently-executing delete request for synced history. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 205 static const GURL GetHistoryURLWithSearchText(const string16& text); | 216 static const GURL GetHistoryURLWithSearchText(const string16& text); |
| 206 | 217 |
| 207 static base::RefCountedMemory* GetFaviconResourceBytes( | 218 static base::RefCountedMemory* GetFaviconResourceBytes( |
| 208 ui::ScaleFactor scale_factor); | 219 ui::ScaleFactor scale_factor); |
| 209 | 220 |
| 210 private: | 221 private: |
| 211 DISALLOW_COPY_AND_ASSIGN(HistoryUI); | 222 DISALLOW_COPY_AND_ASSIGN(HistoryUI); |
| 212 }; | 223 }; |
| 213 | 224 |
| 214 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 225 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
| OLD | NEW |