OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webdata/keyword_table.h" | 5 #include "chrome/browser/webdata/keyword_table.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 template_url->set_autogenerate_keyword(s.ColumnInt(13) == 1); | 182 template_url->set_autogenerate_keyword(s.ColumnInt(13) == 1); |
183 | 183 |
184 template_url->set_logo_id(s.ColumnInt(14)); | 184 template_url->set_logo_id(s.ColumnInt(14)); |
185 | 185 |
186 template_url->set_created_by_policy(s.ColumnBool(15)); | 186 template_url->set_created_by_policy(s.ColumnBool(15)); |
187 | 187 |
188 template_url->SetInstantURL(s.ColumnString(16), 0, 0); | 188 template_url->SetInstantURL(s.ColumnString(16), 0, 0); |
189 | 189 |
190 template_url->set_last_modified(Time::FromTimeT(s.ColumnInt64(17))); | 190 template_url->set_last_modified(Time::FromTimeT(s.ColumnInt64(17))); |
191 | 191 |
192 template_url->set_sync_guid(s.ColumnString(18)); | 192 // If the persisted sync_guid was empty, we ignore it and allow the TURL to |
| 193 // keep its generated GUID. |
| 194 if (!s.ColumnString(18).empty()) |
| 195 template_url->set_sync_guid(s.ColumnString(18)); |
193 | 196 |
194 urls->push_back(template_url); | 197 urls->push_back(template_url); |
195 } | 198 } |
196 return s.Succeeded(); | 199 return s.Succeeded(); |
197 } | 200 } |
198 | 201 |
199 bool KeywordTable::UpdateKeyword(const TemplateURL& url) { | 202 bool KeywordTable::UpdateKeyword(const TemplateURL& url) { |
200 DCHECK(url.id()); | 203 DCHECK(url.id()); |
201 // Be sure to change kUrlIdPosition if you add columns | 204 // Be sure to change kUrlIdPosition if you add columns |
202 sql::Statement s(db_->GetUniqueStatement( | 205 sql::Statement s(db_->GetUniqueStatement( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 306 |
304 bool KeywordTable::MigrateToVersion38AddLastModifiedColumn() { | 307 bool KeywordTable::MigrateToVersion38AddLastModifiedColumn() { |
305 return db_->Execute( | 308 return db_->Execute( |
306 "ALTER TABLE keywords ADD COLUMN last_modified INTEGER DEFAULT 0"); | 309 "ALTER TABLE keywords ADD COLUMN last_modified INTEGER DEFAULT 0"); |
307 } | 310 } |
308 | 311 |
309 bool KeywordTable::MigrateToVersion39AddSyncGUIDColumn() { | 312 bool KeywordTable::MigrateToVersion39AddSyncGUIDColumn() { |
310 return db_->Execute( | 313 return db_->Execute( |
311 "ALTER TABLE keywords ADD COLUMN sync_guid VARCHAR"); | 314 "ALTER TABLE keywords ADD COLUMN sync_guid VARCHAR"); |
312 } | 315 } |
OLD | NEW |