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& accept_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 |
50 // Converts the entry to a DictionaryValue to be owned by the caller. | 52 // Converts the entry to a DictionaryValue to be owned by the caller. |
51 scoped_ptr<DictionaryValue> ToValue( | 53 scoped_ptr<DictionaryValue> ToValue( |
52 BookmarkModel* bookmark_model, | 54 BookmarkModel* bookmark_model, |
53 ManagedUserService* managed_user_service, | 55 ManagedUserService* managed_user_service, |
(...skipping 20 matching lines...) Expand all Loading... |
74 std::set<int64> all_timestamps; | 76 std::set<int64> all_timestamps; |
75 | 77 |
76 // If true, this entry is a search result. | 78 // If true, this entry is a search result. |
77 bool is_search_result; | 79 bool is_search_result; |
78 | 80 |
79 // The entry's search snippet, if this entry is a search result. | 81 // The entry's search snippet, if this entry is a search result. |
80 string16 snippet; | 82 string16 snippet; |
81 | 83 |
82 // Whether this entry was blocked when it was attempted. | 84 // Whether this entry was blocked when it was attempted. |
83 bool blocked_visit; | 85 bool blocked_visit; |
| 86 |
| 87 // kAcceptLanguages pref value. |
| 88 std::string accept_languages; |
84 }; | 89 }; |
85 | 90 |
86 BrowsingHistoryHandler(); | 91 BrowsingHistoryHandler(); |
87 virtual ~BrowsingHistoryHandler(); | 92 virtual ~BrowsingHistoryHandler(); |
88 | 93 |
89 // WebUIMessageHandler implementation. | 94 // WebUIMessageHandler implementation. |
90 virtual void RegisterMessages() OVERRIDE; | 95 virtual void RegisterMessages() OVERRIDE; |
91 | 96 |
92 // Handler for the "queryHistory" message. | 97 // Handler for the "queryHistory" message. |
93 void HandleQueryHistory(const base::ListValue* args); | 98 void HandleQueryHistory(const base::ListValue* args); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 161 |
157 bool ExtractIntegerValueAtIndex( | 162 bool ExtractIntegerValueAtIndex( |
158 const base::ListValue* value, int index, int* out_int); | 163 const base::ListValue* value, int index, int* out_int); |
159 | 164 |
160 // Sets the query options for a week-wide query, |offset| weeks ago. | 165 // Sets the query options for a week-wide query, |offset| weeks ago. |
161 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options); | 166 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options); |
162 | 167 |
163 // Sets the query options for a monthly query, |offset| months ago. | 168 // Sets the query options for a monthly query, |offset| months ago. |
164 void SetQueryTimeInMonths(int offset, history::QueryOptions* options); | 169 void SetQueryTimeInMonths(int offset, history::QueryOptions* options); |
165 | 170 |
| 171 // kAcceptLanguages pref value. |
| 172 std::string GetAcceptLanguages() const; |
| 173 |
166 content::NotificationRegistrar registrar_; | 174 content::NotificationRegistrar registrar_; |
167 | 175 |
168 // Consumer for search requests to the history service. | 176 // Consumer for search requests to the history service. |
169 CancelableRequestConsumerT<int, 0> history_request_consumer_; | 177 CancelableRequestConsumerT<int, 0> history_request_consumer_; |
170 | 178 |
171 // The currently-executing request for synced history results. | 179 // The currently-executing request for synced history results. |
172 // Deleting the request will cancel it. | 180 // Deleting the request will cancel it. |
173 scoped_ptr<history::WebHistoryService::Request> web_history_request_; | 181 scoped_ptr<history::WebHistoryService::Request> web_history_request_; |
174 | 182 |
175 // The currently-executing delete request for synced history. | 183 // The currently-executing delete request for synced history. |
(...skipping 29 matching lines...) Expand all Loading... |
205 static const GURL GetHistoryURLWithSearchText(const string16& text); | 213 static const GURL GetHistoryURLWithSearchText(const string16& text); |
206 | 214 |
207 static base::RefCountedMemory* GetFaviconResourceBytes( | 215 static base::RefCountedMemory* GetFaviconResourceBytes( |
208 ui::ScaleFactor scale_factor); | 216 ui::ScaleFactor scale_factor); |
209 | 217 |
210 private: | 218 private: |
211 DISALLOW_COPY_AND_ASSIGN(HistoryUI); | 219 DISALLOW_COPY_AND_ASSIGN(HistoryUI); |
212 }; | 220 }; |
213 | 221 |
214 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 222 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
OLD | NEW |