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 COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_HISTORY_TYPES_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_HISTORY_TYPES_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_HISTORY_TYPES_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_HISTORY_TYPES_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 | 11 |
| 12 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
11 #include "components/history/core/browser/history_types.h" | 14 #include "components/history/core/browser/history_types.h" |
12 #include "components/history/core/browser/keyword_id.h" | 15 #include "components/history/core/browser/keyword_id.h" |
13 | 16 |
14 namespace sql { | 17 namespace sql { |
15 class Statement; | 18 class Statement; |
16 } | 19 } |
17 | 20 |
18 namespace history { | 21 namespace history { |
19 | 22 |
20 typedef int64 AndroidURLID; | 23 typedef int64_t AndroidURLID; |
21 typedef int64 SearchTermID; | 24 typedef int64_t SearchTermID; |
22 | 25 |
23 // Wraps all columns needed to support android.provider.Browser.BookmarkColumns. | 26 // Wraps all columns needed to support android.provider.Browser.BookmarkColumns. |
24 // It is used in insert() and update() to specify the columns need to insert or | 27 // It is used in insert() and update() to specify the columns need to insert or |
25 // update. | 28 // update. |
26 // The column is not valid until it set. Using is_valid() to find out whether | 29 // The column is not valid until it set. Using is_valid() to find out whether |
27 // the specific column could be used. | 30 // the specific column could be used. |
28 // | 31 // |
29 // The defult copy constructor is used. | 32 // The defult copy constructor is used. |
30 class HistoryAndBookmarkRow { | 33 class HistoryAndBookmarkRow { |
31 public: | 34 public: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 bool favicon_valid() const { return favicon_.get() && favicon_->size(); } | 116 bool favicon_valid() const { return favicon_.get() && favicon_->size(); } |
114 | 117 |
115 // The id of android url. | 118 // The id of android url. |
116 void set_id(AndroidURLID id) { | 119 void set_id(AndroidURLID id) { |
117 set_value_explicitly(ID); | 120 set_value_explicitly(ID); |
118 id_ = id; | 121 id_ = id; |
119 } | 122 } |
120 AndroidURLID id() const { return id_; } | 123 AndroidURLID id() const { return id_; } |
121 | 124 |
122 // The id of the parent folder containing the bookmark, if any. | 125 // The id of the parent folder containing the bookmark, if any. |
123 void set_parent_id(int64 parent_id) { | 126 void set_parent_id(int64_t parent_id) { |
124 set_value_explicitly(PARENT_ID); | 127 set_value_explicitly(PARENT_ID); |
125 parent_id_ = parent_id; | 128 parent_id_ = parent_id; |
126 } | 129 } |
127 const int64 parent_id() const { return parent_id_; } | 130 const int64_t parent_id() const { return parent_id_; } |
128 | 131 |
129 // The internal URLID | 132 // The internal URLID |
130 void set_url_id(URLID url_id) { | 133 void set_url_id(URLID url_id) { |
131 set_value_explicitly(URL_ID); | 134 set_value_explicitly(URL_ID); |
132 url_id_ = url_id; | 135 url_id_ = url_id; |
133 } | 136 } |
134 URLID url_id() const { return url_id_; } | 137 URLID url_id() const { return url_id_; } |
135 | 138 |
136 // Returns true if the given |id| has been set explicitly. | 139 // Returns true if the given |id| has been set explicitly. |
137 bool is_value_set_explicitly(ColumnID id) const { | 140 bool is_value_set_explicitly(ColumnID id) const { |
138 return values_set_.find(id) != values_set_.end(); | 141 return values_set_.find(id) != values_set_.end(); |
139 } | 142 } |
140 | 143 |
141 private: | 144 private: |
142 void set_value_explicitly(ColumnID id) { values_set_.insert(id); } | 145 void set_value_explicitly(ColumnID id) { values_set_.insert(id); } |
143 | 146 |
144 AndroidURLID id_; | 147 AndroidURLID id_; |
145 GURL url_; | 148 GURL url_; |
146 std::string raw_url_; | 149 std::string raw_url_; |
147 base::string16 title_; | 150 base::string16 title_; |
148 base::Time created_; | 151 base::Time created_; |
149 base::Time last_visit_time_; | 152 base::Time last_visit_time_; |
150 scoped_refptr<base::RefCountedMemory> favicon_; | 153 scoped_refptr<base::RefCountedMemory> favicon_; |
151 int visit_count_; | 154 int visit_count_; |
152 bool is_bookmark_; | 155 bool is_bookmark_; |
153 int64 parent_id_; | 156 int64_t parent_id_; |
154 URLID url_id_; | 157 URLID url_id_; |
155 | 158 |
156 // Used to find whether a column has been set a value explicitly. | 159 // Used to find whether a column has been set a value explicitly. |
157 std::set<ColumnID> values_set_; | 160 std::set<ColumnID> values_set_; |
158 | 161 |
159 // We support the implicit copy constuctor and operator=. | 162 // We support the implicit copy constuctor and operator=. |
160 }; | 163 }; |
161 | 164 |
162 // Wraps all columns needed to support android.provider.Browser.SearchColumns. | 165 // Wraps all columns needed to support android.provider.Browser.SearchColumns. |
163 // It is used in insert() and update() to specify the columns need to insert or | 166 // It is used in insert() and update() to specify the columns need to insert or |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 private: | 278 private: |
276 scoped_ptr<sql::Statement> statement_; | 279 scoped_ptr<sql::Statement> statement_; |
277 int favicon_index_; | 280 int favicon_index_; |
278 | 281 |
279 DISALLOW_COPY_AND_ASSIGN(AndroidStatement); | 282 DISALLOW_COPY_AND_ASSIGN(AndroidStatement); |
280 }; | 283 }; |
281 | 284 |
282 } // namespace history | 285 } // namespace history |
283 | 286 |
284 #endif // COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_HISTORY_TYPES_H_ | 287 #endif // COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_HISTORY_TYPES_H_ |
OLD | NEW |