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/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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/stats_counters.h" | 10 #include "base/metrics/stats_counters.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 if (!s.Step()) { | 197 if (!s.Step()) { |
198 LOG_IF(ERROR, s.Succeeded()) | 198 LOG_IF(ERROR, s.Succeeded()) |
199 << "No default search provider with backup id."; | 199 << "No default search provider with backup id."; |
200 return NULL; | 200 return NULL; |
201 } | 201 } |
202 | 202 |
203 TemplateURL* template_url = GetKeywordDataFromStatement(s); | 203 TemplateURL* template_url = GetKeywordDataFromStatement(s); |
204 // ID has no meaning for the backup and should be kInvalidTemplateURLID in | 204 // ID has no meaning for the backup and should be kInvalidTemplateURLID in |
205 // case the TemplateURL will be added to keywords if missing. | 205 // case the TemplateURL will be added to keywords if missing. |
206 template_url->set_id(kInvalidTemplateURLID); | 206 template_url->set_id(kInvalidTemplateURLID); |
207 | |
208 return template_url; | 207 return template_url; |
209 } | 208 } |
210 | 209 |
211 bool KeywordTable::DidDefaultSearchProviderChange() { | 210 bool KeywordTable::DidDefaultSearchProviderChange() { |
212 if (!IsBackupSignatureValid()) { | 211 if (!IsBackupSignatureValid()) { |
213 UMA_HISTOGRAM_ENUMERATION( | 212 UMA_HISTOGRAM_ENUMERATION( |
214 protector::kProtectorHistogramDefaultSearchProvider, | 213 protector::kProtectorHistogramDefaultSearchProvider, |
215 protector::kProtectorErrorBackupInvalid, | 214 protector::kProtectorErrorBackupInvalid, |
216 protector::kProtectorErrorCount); | 215 protector::kProtectorErrorCount); |
217 LOG(ERROR) << "Backup signature is invalid."; | 216 LOG(ERROR) << "Backup signature is invalid."; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 int64 default_search_id = GetDefaultSearchProviderID(); | 466 int64 default_search_id = GetDefaultSearchProviderID(); |
468 if (!meta_table_->SetValue(kDefaultSearchIDBackupKey, | 467 if (!meta_table_->SetValue(kDefaultSearchIDBackupKey, |
469 default_search_id)) { | 468 default_search_id)) { |
470 LOG(ERROR) << "Can't write default search id backup."; | 469 LOG(ERROR) << "Can't write default search id backup."; |
471 return false; | 470 return false; |
472 } | 471 } |
473 | 472 |
474 *id = default_search_id; | 473 *id = default_search_id; |
475 return true; | 474 return true; |
476 } | 475 } |
OLD | NEW |