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_database.h" | 5 #include "chrome/browser/history/shortcuts_database.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/guid.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
13 #include "base/time.h" | 14 #include "base/time.h" |
14 #include "chrome/common/guid.h" | |
15 #include "sql/statement.h" | 15 #include "sql/statement.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Using define instead of const char, so I could use ## in the statements. | 19 // Using define instead of const char, so I could use ## in the statements. |
20 #define kShortcutsDBName "omni_box_shortcuts" | 20 #define kShortcutsDBName "omni_box_shortcuts" |
21 | 21 |
22 void BindShortcutToStatement( | 22 void BindShortcutToStatement( |
23 const history::ShortcutsBackend::Shortcut& shortcut, | 23 const history::ShortcutsBackend::Shortcut& shortcut, |
24 sql::Statement* s) { | 24 sql::Statement* s) { |
25 DCHECK(guid::IsValidGUID(shortcut.id)); | 25 DCHECK(base::IsValidGUID(shortcut.id)); |
26 s->BindString(0, shortcut.id); | 26 s->BindString(0, shortcut.id); |
27 s->BindString16(1, shortcut.text); | 27 s->BindString16(1, shortcut.text); |
28 s->BindString(2, shortcut.url.spec()); | 28 s->BindString(2, shortcut.url.spec()); |
29 s->BindString16(3, shortcut.contents); | 29 s->BindString16(3, shortcut.contents); |
30 s->BindString(4, | 30 s->BindString(4, |
31 AutocompleteMatch::ClassificationsToString(shortcut.contents_class)); | 31 AutocompleteMatch::ClassificationsToString(shortcut.contents_class)); |
32 s->BindString16(5, shortcut.description); | 32 s->BindString16(5, shortcut.description); |
33 s->BindString(6, | 33 s->BindString(6, |
34 AutocompleteMatch::ClassificationsToString(shortcut.description_class)); | 34 AutocompleteMatch::ClassificationsToString(shortcut.description_class)); |
35 s->BindInt64(7, shortcut.last_access_time.ToInternalValue()); | 35 s->BindInt64(7, shortcut.last_access_time.ToInternalValue()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 "last_access_time INTEGER, " | 172 "last_access_time INTEGER, " |
173 "number_of_hits INTEGER)", kShortcutsDBName).c_str())) { | 173 "number_of_hits INTEGER)", kShortcutsDBName).c_str())) { |
174 NOTREACHED(); | 174 NOTREACHED(); |
175 return false; | 175 return false; |
176 } | 176 } |
177 } | 177 } |
178 return true; | 178 return true; |
179 } | 179 } |
180 | 180 |
181 } // namespace history | 181 } // namespace history |
OLD | NEW |