Chromium Code Reviews| 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" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/string_split.h" | 12 #include "base/string_split.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/history/history_database.h" | 16 #include "chrome/browser/history/history_database.h" |
| 17 #include "chrome/browser/protector/histograms.h" | 17 #include "chrome/browser/protector/histograms.h" |
| 18 #include "chrome/browser/protector/protector_service.h" | 18 #include "chrome/browser/protector/protector.h" |
| 19 #include "chrome/browser/search_engines/template_url.h" | 19 #include "chrome/browser/search_engines/template_url.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "sql/statement.h" | 21 #include "sql/statement.h" |
| 22 #include "sql/transaction.h" | 22 #include "sql/transaction.h" |
| 23 | 23 |
| 24 using base::Time; | 24 using base::Time; |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 const char KeywordTable::kDefaultSearchProviderKey[] = | 27 const char KeywordTable::kDefaultSearchProviderKey[] = |
| 28 "Default Search Provider ID"; | 28 "Default Search Provider ID"; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 s->BindInt(starting_column + 13, 0); | 78 s->BindInt(starting_column + 13, 0); |
| 79 s->BindBool(starting_column + 14, url.created_by_policy()); | 79 s->BindBool(starting_column + 14, url.created_by_policy()); |
| 80 s->BindString(starting_column + 15, | 80 s->BindString(starting_column + 15, |
| 81 url.instant_url() ? url.instant_url()->url() : std::string()); | 81 url.instant_url() ? url.instant_url()->url() : std::string()); |
| 82 s->BindInt64(starting_column + 16, url.last_modified().ToTimeT()); | 82 s->BindInt64(starting_column + 16, url.last_modified().ToTimeT()); |
| 83 s->BindString(starting_column + 17, url.sync_guid()); | 83 s->BindString(starting_column + 17, url.sync_guid()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Signs search provider id and returns its signature. | 86 // Signs search provider id and returns its signature. |
| 87 std::string GetSearchProviderIDSignature(int64 id) { | 87 std::string GetSearchProviderIDSignature(int64 id) { |
| 88 return protector::SignSetting(base::Int64ToString(id)); | 88 return protector::SignSetting(base::Int64ToString(id)); |
|
Yaron
2012/03/28 21:23:22
I think I'm missing something as this is still usi
nilesh
2012/03/28 23:35:11
Yeah the methods moved out of ProtectorService are
| |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Checks if signature for search provider id is correct and returns the | 91 // Checks if signature for search provider id is correct and returns the |
| 92 // result. | 92 // result. |
| 93 bool IsSearchProviderIDValid(int64 id, const std::string& signature) { | 93 bool IsSearchProviderIDValid(int64 id, const std::string& signature) { |
| 94 return protector::IsSettingValid(base::Int64ToString(id), signature); | 94 return protector::IsSettingValid(base::Int64ToString(id), signature); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // anonymous namespace | 97 } // anonymous namespace |
| 98 | 98 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 int64 default_search_id = GetDefaultSearchProviderID(); | 466 int64 default_search_id = GetDefaultSearchProviderID(); |
| 467 if (!meta_table_->SetValue(kDefaultSearchIDBackupKey, | 467 if (!meta_table_->SetValue(kDefaultSearchIDBackupKey, |
| 468 default_search_id)) { | 468 default_search_id)) { |
| 469 LOG(ERROR) << "Can't write default search id backup."; | 469 LOG(ERROR) << "Can't write default search id backup."; |
| 470 return false; | 470 return false; |
| 471 } | 471 } |
| 472 | 472 |
| 473 *id = default_search_id; | 473 *id = default_search_id; |
| 474 return true; | 474 return true; |
| 475 } | 475 } |
| OLD | NEW |