| 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/webdata/web_intents_table.h" | 5 #include "chrome/browser/webdata/web_intents_table.h" |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // TODO(jhawkins): Figure out Sync story. | 69 // TODO(jhawkins): Figure out Sync story. |
| 70 bool WebIntentsTable::IsSyncable() { | 70 bool WebIntentsTable::IsSyncable() { |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool WebIntentsTable::MigrateToVersion(int version, |
| 75 const std::string& app_locale, |
| 76 bool* update_compatible_version) { |
| 77 if (version == 46) { |
| 78 *update_compatible_version = true; |
| 79 return MigrateToVersion46AddSchemeColumn(); |
| 80 } |
| 81 |
| 82 return true; |
| 83 } |
| 84 |
| 74 // Updates the table by way of renaming the old tables, rerunning | 85 // Updates the table by way of renaming the old tables, rerunning |
| 75 // the Init method, then selecting old values into the new tables. | 86 // the Init method, then selecting old values into the new tables. |
| 76 bool WebIntentsTable::MigrateToVersion46AddSchemeColumn() { | 87 bool WebIntentsTable::MigrateToVersion46AddSchemeColumn() { |
| 77 | 88 |
| 78 if (!db_->Execute("ALTER TABLE web_intents RENAME TO old_web_intents")) { | 89 if (!db_->Execute("ALTER TABLE web_intents RENAME TO old_web_intents")) { |
| 79 DLOG(WARNING) << "Could not backup web_intents table."; | 90 DLOG(WARNING) << "Could not backup web_intents table."; |
| 80 return false; | 91 return false; |
| 81 } | 92 } |
| 82 | 93 |
| 83 if (!db_->Execute("ALTER TABLE web_intents_defaults" | 94 if (!db_->Execute("ALTER TABLE web_intents_defaults" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return false; | 129 return false; |
| 119 } | 130 } |
| 120 | 131 |
| 121 if (!db_->Execute("DROP table old_web_intents_defaults")) { | 132 if (!db_->Execute("DROP table old_web_intents_defaults")) { |
| 122 DLOG(WARNING) << "Could not drop backup web_intents_defaults table."; | 133 DLOG(WARNING) << "Could not drop backup web_intents_defaults table."; |
| 123 return false; | 134 return false; |
| 124 } | 135 } |
| 125 | 136 |
| 126 return true; | 137 return true; |
| 127 } | 138 } |
| OLD | NEW |