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 "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" | 5 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "components/autofill/core/browser/webdata/autofill_table.h" | 15 #include "components/autofill/core/browser/webdata/autofill_table.h" |
15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 16 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
16 #include "components/sync/model/sync_error.h" | 17 #include "components/sync/model/sync_error.h" |
17 #include "components/sync/model/sync_error_factory.h" | 18 #include "components/sync/model/sync_error_factory.h" |
18 #include "components/sync/protocol/autofill_specifics.pb.h" | 19 #include "components/sync/protocol/autofill_specifics.pb.h" |
19 #include "components/sync/protocol/sync.pb.h" | 20 #include "components/sync/protocol/sync.pb.h" |
20 #include "components/webdata/common/web_database.h" | 21 #include "components/webdata/common/web_database.h" |
21 #include "net/base/escape.h" | 22 #include "net/base/escape.h" |
22 | 23 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 74 |
74 AutocompleteSyncableService::~AutocompleteSyncableService() { | 75 AutocompleteSyncableService::~AutocompleteSyncableService() { |
75 DCHECK(CalledOnValidThread()); | 76 DCHECK(CalledOnValidThread()); |
76 } | 77 } |
77 | 78 |
78 // static | 79 // static |
79 void AutocompleteSyncableService::CreateForWebDataServiceAndBackend( | 80 void AutocompleteSyncableService::CreateForWebDataServiceAndBackend( |
80 AutofillWebDataService* web_data_service, | 81 AutofillWebDataService* web_data_service, |
81 AutofillWebDataBackend* web_data_backend) { | 82 AutofillWebDataBackend* web_data_backend) { |
82 web_data_service->GetDBUserData()->SetUserData( | 83 web_data_service->GetDBUserData()->SetUserData( |
83 UserDataKey(), new AutocompleteSyncableService(web_data_backend)); | 84 UserDataKey(), |
| 85 base::WrapUnique(new AutocompleteSyncableService(web_data_backend))); |
84 } | 86 } |
85 | 87 |
86 // static | 88 // static |
87 AutocompleteSyncableService* AutocompleteSyncableService::FromWebDataService( | 89 AutocompleteSyncableService* AutocompleteSyncableService::FromWebDataService( |
88 AutofillWebDataService* web_data_service) { | 90 AutofillWebDataService* web_data_service) { |
89 return static_cast<AutocompleteSyncableService*>( | 91 return static_cast<AutocompleteSyncableService*>( |
90 web_data_service->GetDBUserData()->GetUserData(UserDataKey())); | 92 web_data_service->GetDBUserData()->GetUserData(UserDataKey())); |
91 } | 93 } |
92 | 94 |
93 AutocompleteSyncableService::AutocompleteSyncableService() | 95 AutocompleteSyncableService::AutocompleteSyncableService() |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 421 } |
420 | 422 |
421 // static | 423 // static |
422 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, | 424 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, |
423 const std::string& value) { | 425 const std::string& value) { |
424 std::string prefix(kAutofillEntryNamespaceTag); | 426 std::string prefix(kAutofillEntryNamespaceTag); |
425 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value); | 427 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value); |
426 } | 428 } |
427 | 429 |
428 } // namespace autofill | 430 } // namespace autofill |
OLD | NEW |