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/history/shortcuts_backend.h" | 5 #include "chrome/browser/history/shortcuts_backend.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/guid.h" |
13 #include "base/i18n/case_conversion.h" | 14 #include "base/i18n/case_conversion.h" |
14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
15 #include "chrome/browser/autocomplete/autocomplete.h" | 16 #include "chrome/browser/autocomplete/autocomplete.h" |
16 #include "chrome/browser/autocomplete/autocomplete_match.h" | 17 #include "chrome/browser/autocomplete/autocomplete_match.h" |
17 #include "chrome/browser/history/history.h" | 18 #include "chrome/browser/history/history.h" |
18 #include "chrome/browser/history/history_notifications.h" | 19 #include "chrome/browser/history/history_notifications.h" |
19 #include "chrome/browser/history/shortcuts_database.h" | 20 #include "chrome/browser/history/shortcuts_database.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
22 #include "chrome/common/guid.h" | |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
26 | 26 |
27 using content::BrowserThread; | 27 using content::BrowserThread; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // Takes Match classification vector and removes all matched positions, | 31 // Takes Match classification vector and removes all matched positions, |
32 // compacting repetitions if necessary. | 32 // compacting repetitions if necessary. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 it != shortcuts_map_.end() && | 252 it != shortcuts_map_.end() && |
253 StartsWith(it->first, text_lowercase, true); ++it) { | 253 StartsWith(it->first, text_lowercase, true); ++it) { |
254 if (match.destination_url == it->second.url) { | 254 if (match.destination_url == it->second.url) { |
255 UpdateShortcut(Shortcut(it->second.id, log->text, match.destination_url, | 255 UpdateShortcut(Shortcut(it->second.id, log->text, match.destination_url, |
256 match.contents, match.contents_class, match.description, | 256 match.contents, match.contents_class, match.description, |
257 match.description_class, base::Time::Now(), | 257 match.description_class, base::Time::Now(), |
258 it->second.number_of_hits + 1)); | 258 it->second.number_of_hits + 1)); |
259 return; | 259 return; |
260 } | 260 } |
261 } | 261 } |
262 AddShortcut(Shortcut(guid::GenerateGUID(), log->text, match.destination_url, | 262 AddShortcut(Shortcut(base::GenerateGUID(), log->text, match.destination_url, |
263 match.contents, match.contents_class, match.description, | 263 match.contents, match.contents_class, match.description, |
264 match.description_class, base::Time::Now(), 1)); | 264 match.description_class, base::Time::Now(), 1)); |
265 } | 265 } |
266 | 266 |
267 } // namespace history | 267 } // namespace history |
OLD | NEW |