Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chrome/browser/autofill/autofill_download.h

Issue 1119004: Integration with Toolbar autofill servers.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_download.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/scoped_ptr.h"
12 #include "base/scoped_vector.h"
13 #include "base/string16.h"
14 #include "chrome/browser/autofill/autofill_profile.h"
15 #include "chrome/browser/autofill/field_types.h"
16 #include "chrome/browser/autofill/form_structure.h"
17 #include "chrome/browser/net/url_fetcher.h"
18
19 // Handles getting and updating AutoFill heuristics.
20 class AutoFillDownloadManager : public URLFetcher::Delegate {
21 public:
22 // An interface used to notify clients of AutoFillDownloadManager.
23 class Observer {
24 public:
25 // Called when heuristic successfully received from server.
26 // |form_signature| - the signature of the requesting form.
27 // |heuristic_xml| - server response.
28 virtual void OnLoadedAutoFillHeuristics(
29 const std::string& form_signature,
30 const std::string& heuristic_xml) = 0;
31 // Called when heuristic either successfully considered for upload and
32 // not send or uploaded.
33 // |form_signature| - the signature of the requesting form.
34 virtual void OnUploadedAutoFillHeuristics(
35 const std::string& form_signature) = 0;
36 // Called when there was an error during the request.
37 // |form_signature| - the signature of the requesting form.
38 // |http_error| - http error code.
39 virtual void OnHeuristicsRequestError(const std::string& form_signature,
40 int http_error) = 0;
41 protected:
42 virtual ~Observer() {}
43 };
44
45 AutoFillDownloadManager();
46 virtual ~AutoFillDownloadManager();
47
48 // |observer| - observer to notify on successful completion or error.
49 void SetObserver(AutoFillDownloadManager::Observer *observer);
50
51 // Initiates request to AutoFill servers to download/upload heuristics
52 // |form_xml| - form structure XML to upload/download.
53 // |form_signature| - form signature hash.
54 // |query_data| - if true the data is queried and observer notified with new
55 // data, if available. If false heuristic data is uploaded to our servers.
56 // |form_was_matched| - if |query_data| is false indicates if the form was
57 // matched. Ignored otherwise.
58 bool StartRequest(const std::string& form_xml,
59 const std::string& form_signature,
60 bool query_data,
61 bool form_was_matched);
62
63 bool CancelRequest(const std::string& form_signature, bool query_data);
64
65 protected:
66 // URLFetcher::Delegate implementation:
67 virtual void OnURLFetchComplete(const URLFetcher* source,
68 const GURL& url,
69 const URLRequestStatus& status,
70 int response_code,
71 const ResponseCookies& cookies,
72 const std::string& data);
73
74 private:
75 struct FormRequestData {
76 std::string form_signature;
77 bool query;
78 };
79
80 // For each requested form for both query and upload we create a separate
81 // request and save its info. As url fetcher is identified by its address
82 // we use a map between fetchers and info.
83 std::map<URLFetcher *, FormRequestData> url_fetchers_;
84 AutoFillDownloadManager::Observer *observer_;
85 };
86
87 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_
88
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_download.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698