summaryrefslogtreecommitdiff
path: root/chromium/components/autofill/core/browser/webdata/web_data_model_type_controller.cc
blob: aa2eb36397dfa413f339852c81cb224eda2e285f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/core/browser/webdata/web_data_model_type_controller.h"

#include "base/bind.h"
#include "base/bind_helpers.h"

using syncer::ModelType;
using syncer::ModelTypeController;
using syncer::SyncClient;

namespace autofill {

WebDataModelTypeController::WebDataModelTypeController(
    ModelType type,
    SyncClient* sync_client,
    const scoped_refptr<base::SingleThreadTaskRunner>& model_thread,
    const scoped_refptr<AutofillWebDataService>& web_data_service,
    const BridgeFromWebData& bridge_from_web_data)
    : ModelTypeController(type, sync_client, model_thread),
      web_data_service_(web_data_service),
      bridge_from_web_data_(bridge_from_web_data) {}

WebDataModelTypeController::~WebDataModelTypeController() {}

ModelTypeController::BridgeProvider
WebDataModelTypeController::GetBridgeProvider() {
  // As opposed to the default implementation, get the bridge on demand, the web
  // data service requires us to be on the model thread.
  return base::Bind(bridge_from_web_data_,
                    base::RetainedRef(web_data_service_));
}

}  // namespace autofill