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 #include "chrome/browser/ui/webui/history_ui.h" | 5 #include "chrome/browser/ui/webui/history_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 // Sets the correct year when substracting months from a date. | 211 // Sets the correct year when substracting months from a date. |
212 void normalizeMonths(base::Time::Exploded* exploded) { | 212 void normalizeMonths(base::Time::Exploded* exploded) { |
213 // Decrease a year at a time until we have a proper date. | 213 // Decrease a year at a time until we have a proper date. |
214 while (exploded->month < 1) { | 214 while (exploded->month < 1) { |
215 exploded->month += 12; | 215 exploded->month += 12; |
216 exploded->year--; | 216 exploded->year--; |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 // Returns the URL of a query result value. | |
221 bool GetResultTimeAndUrl(Value* result, base::Time* time, string16* url) { | |
222 DictionaryValue* result_dict; | |
223 double timestamp; | |
224 | |
225 if (result->GetAsDictionary(&result_dict) && | |
226 result_dict->GetDouble("time", ×tamp) && | |
227 result_dict->GetString("url", url)) { | |
228 *time = base::Time::FromJsTime(timestamp); | |
229 return true; | |
230 } | |
231 return false; | |
232 } | |
233 | |
234 // Returns true if |entry| represents a local visit that had no corresponding | 220 // Returns true if |entry| represents a local visit that had no corresponding |
235 // visit on the server. | 221 // visit on the server. |
236 bool IsLocalOnlyResult(const BrowsingHistoryHandler::HistoryEntry& entry) { | 222 bool IsLocalOnlyResult(const BrowsingHistoryHandler::HistoryEntry& entry) { |
237 return entry.entry_type == BrowsingHistoryHandler::HistoryEntry::LOCAL_ENTRY; | 223 return entry.entry_type == BrowsingHistoryHandler::HistoryEntry::LOCAL_ENTRY; |
238 } | 224 } |
239 | 225 |
240 // Gets the name and type of a device for the given sync client ID. | 226 // Gets the name and type of a device for the given sync client ID. |
241 // |name| and |type| are out parameters. | 227 // |name| and |type| are out parameters. |
242 void GetDeviceNameAndType(const ProfileSyncService* sync_service, | 228 void GetDeviceNameAndType(const ProfileSyncService* sync_service, |
243 const std::string& client_id, | 229 const std::string& client_id, |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + | 997 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + |
1012 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); | 998 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); |
1013 } | 999 } |
1014 | 1000 |
1015 // static | 1001 // static |
1016 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 1002 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
1017 ui::ScaleFactor scale_factor) { | 1003 ui::ScaleFactor scale_factor) { |
1018 return ResourceBundle::GetSharedInstance(). | 1004 return ResourceBundle::GetSharedInstance(). |
1019 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 1005 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
1020 } | 1006 } |
OLD | NEW |