autofill_driver.h revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DRIVER_H_ 6#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DRIVER_H_ 7 8#include <vector> 9 10#include "components/autofill/core/common/form_data.h" 11 12namespace content { 13class WebContents; 14} 15 16namespace autofill { 17 18class FormStructure; 19 20// Interface that allows Autofill core code to interact with its driver (i.e., 21// obtain information from it and give information to it). A concrete 22// implementation must be provided by the driver. 23class AutofillDriver { 24 public: 25 virtual ~AutofillDriver() {} 26 27 // TODO(blundell): Remove this method once shared code no longer needs to 28 // know about WebContents. 29 virtual content::WebContents* GetWebContents() = 0; 30 31 // Returns true iff the renderer is available for communication. 32 virtual bool RendererIsAvailable() = 0; 33 34 // Forwards |data| to the renderer. |query_id| is the id of the renderer's 35 // original request for the data. This method is a no-op if the renderer is 36 // not currently available. 37 virtual void SendFormDataToRenderer(int query_id, const FormData& data) = 0; 38 39 // Sends the field type predictions specified in |forms| to the renderer. This 40 // method is a no-op if the renderer is not available or the appropriate 41 // command-line flag is not set. 42 virtual void SendAutofillTypePredictionsToRenderer( 43 const std::vector<FormStructure*>& forms) = 0; 44}; 45 46} // namespace autofill 47 48#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DRIVER_H_ 49