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 "components/history/core/android/android_history_types.h" | 5 #include "components/history/core/android/android_history_types.h" |
6 | 6 |
7 namespace history { | 7 namespace history { |
8 | 8 |
9 namespace { | 9 namespace { |
10 // The column name defined in android.provider.Browser.BookmarkColumns | 10 // The column name defined in android.provider.Browser.BookmarkColumns |
(...skipping 13 matching lines...) Expand all Loading... |
24 const char* const kAndroidSearchColumn[] = { | 24 const char* const kAndroidSearchColumn[] = { |
25 "_id", | 25 "_id", |
26 "search", | 26 "search", |
27 "date", | 27 "date", |
28 }; | 28 }; |
29 | 29 |
30 class BookmarkIDMapping : public std::map<std::string, | 30 class BookmarkIDMapping : public std::map<std::string, |
31 HistoryAndBookmarkRow::ColumnID> { | 31 HistoryAndBookmarkRow::ColumnID> { |
32 public: | 32 public: |
33 BookmarkIDMapping() { | 33 BookmarkIDMapping() { |
34 COMPILE_ASSERT(arraysize(kAndroidBookmarkColumn) <= | 34 static_assert(arraysize(kAndroidBookmarkColumn) <= |
35 HistoryAndBookmarkRow::COLUMN_END, | 35 HistoryAndBookmarkRow::COLUMN_END, |
36 Array_size_must_not_exceed_enum); | 36 "kAndroidBookmarkColumn should not have more than " |
| 37 "COLUMN_END elements"); |
37 for (size_t i = 0; i < arraysize(kAndroidBookmarkColumn); ++i) { | 38 for (size_t i = 0; i < arraysize(kAndroidBookmarkColumn); ++i) { |
38 (*this)[kAndroidBookmarkColumn[i]] = | 39 (*this)[kAndroidBookmarkColumn[i]] = |
39 static_cast<HistoryAndBookmarkRow::ColumnID>(i); | 40 static_cast<HistoryAndBookmarkRow::ColumnID>(i); |
40 } | 41 } |
41 } | 42 } |
42 }; | 43 }; |
43 | 44 |
44 // The mapping from Android column name to ColumnID; It is initialized | 45 // The mapping from Android column name to ColumnID; It is initialized |
45 // once it used. | 46 // once it used. |
46 BookmarkIDMapping* g_bookmark_id_mapping = NULL; | 47 BookmarkIDMapping* g_bookmark_id_mapping = NULL; |
47 | 48 |
48 class SearchIDMapping : public std::map<std::string, | 49 class SearchIDMapping : public std::map<std::string, |
49 SearchRow::ColumnID> { | 50 SearchRow::ColumnID> { |
50 public: | 51 public: |
51 SearchIDMapping() { | 52 SearchIDMapping() { |
52 COMPILE_ASSERT(arraysize(kAndroidSearchColumn) <= SearchRow::COLUMN_END, | 53 static_assert(arraysize(kAndroidSearchColumn) <= SearchRow::COLUMN_END, |
53 Array_size_must_not_exceed_enum); | 54 "kAndroidSearchColumn should not have more than " |
| 55 "COLUMN_END elements"); |
54 for (size_t i = 0; i < arraysize(kAndroidSearchColumn); ++i) { | 56 for (size_t i = 0; i < arraysize(kAndroidSearchColumn); ++i) { |
55 (*this)[kAndroidSearchColumn[i]] = | 57 (*this)[kAndroidSearchColumn[i]] = |
56 static_cast<SearchRow::ColumnID>(i); | 58 static_cast<SearchRow::ColumnID>(i); |
57 } | 59 } |
58 } | 60 } |
59 }; | 61 }; |
60 | 62 |
61 // The mapping from Android column name to ColumnID; It is initialized | 63 // The mapping from Android column name to ColumnID; It is initialized |
62 // once it used. | 64 // once it used. |
63 SearchIDMapping* g_search_id_mapping = NULL; | 65 SearchIDMapping* g_search_id_mapping = NULL; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 136 |
135 AndroidStatement::AndroidStatement(sql::Statement* statement, int favicon_index) | 137 AndroidStatement::AndroidStatement(sql::Statement* statement, int favicon_index) |
136 : statement_(statement), | 138 : statement_(statement), |
137 favicon_index_(favicon_index) { | 139 favicon_index_(favicon_index) { |
138 } | 140 } |
139 | 141 |
140 AndroidStatement::~AndroidStatement() { | 142 AndroidStatement::~AndroidStatement() { |
141 } | 143 } |
142 | 144 |
143 } // namespace history. | 145 } // namespace history. |
OLD | NEW |