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

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

Issue 5703002: Add some basic success/failure UMA logging for autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/scoped_vector.h" 12 #include "base/scoped_vector.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/autofill/autofill_metrics.h"
14 #include "chrome/browser/autofill/autofill_profile.h" 15 #include "chrome/browser/autofill/autofill_profile.h"
15 #include "chrome/browser/autofill/field_types.h" 16 #include "chrome/browser/autofill/field_types.h"
16 #include "chrome/browser/autofill/form_structure.h" 17 #include "chrome/browser/autofill/form_structure.h"
17 #include "chrome/common/net/url_fetcher.h" 18 #include "chrome/common/net/url_fetcher.h"
18 19
19 class Profile; 20 class Profile;
20 21
21 // Handles getting and updating AutoFill heuristics. 22 // Handles getting and updating AutoFill heuristics.
22 class AutoFillDownloadManager : public URLFetcher::Delegate { 23 class AutoFillDownloadManager : public URLFetcher::Delegate {
23 public: 24 public:
(...skipping 29 matching lines...) Expand all
53 // |profile| can be NULL in unit-tests only. 54 // |profile| can be NULL in unit-tests only.
54 explicit AutoFillDownloadManager(Profile* profile); 55 explicit AutoFillDownloadManager(Profile* profile);
55 virtual ~AutoFillDownloadManager(); 56 virtual ~AutoFillDownloadManager();
56 57
57 // |observer| - observer to notify on successful completion or error. 58 // |observer| - observer to notify on successful completion or error.
58 void SetObserver(AutoFillDownloadManager::Observer *observer); 59 void SetObserver(AutoFillDownloadManager::Observer *observer);
59 60
60 // Starts a query request to AutoFill servers. The observer is called with the 61 // Starts a query request to AutoFill servers. The observer is called with the
61 // list of the fields of all requested forms. 62 // list of the fields of all requested forms.
62 // |forms| - array of forms aggregated in this request. 63 // |forms| - array of forms aggregated in this request.
63 bool StartQueryRequest(const ScopedVector<FormStructure>& forms); 64 bool StartQueryRequest(
65 const ScopedVector<FormStructure>& forms,
66 autofill_metrics::LogServerQueryMetricFn log_server_query_metric);
64 67
65 // Start upload request if necessary. The probability of request going 68 // Start upload request if necessary. The probability of request going
66 // over the wire are GetPositiveUploadRate() if it was matched by 69 // over the wire are GetPositiveUploadRate() if it was matched by
67 // AutoFill, GetNegativeUploadRate() otherwise. Observer will be called 70 // AutoFill, GetNegativeUploadRate() otherwise. Observer will be called
68 // even if there was no actual trip over the wire. 71 // even if there was no actual trip over the wire.
69 // |form| - form sent in this request. 72 // |form| - form sent in this request.
70 // |form_was_matched| - true if form was matched by the AutoFill. 73 // |form_was_matched| - true if form was matched by the AutoFill.
71 bool StartUploadRequest(const FormStructure& form, bool form_was_matched); 74 bool StartUploadRequest(const FormStructure& form, bool form_was_matched);
72 75
73 // Cancels pending request. 76 // Cancels pending request.
(...skipping 20 matching lines...) Expand all
94 friend class AutoFillDownloadTestHelper; // unit-test. 97 friend class AutoFillDownloadTestHelper; // unit-test.
95 98
96 struct FormRequestData; 99 struct FormRequestData;
97 100
98 // Initiates request to AutoFill servers to download/upload heuristics. 101 // Initiates request to AutoFill servers to download/upload heuristics.
99 // |form_xml| - form structure XML to upload/download. 102 // |form_xml| - form structure XML to upload/download.
100 // |request_data| - form signature hash(es) and indicator if it was a query. 103 // |request_data| - form signature hash(es) and indicator if it was a query.
101 // |request_data.query| - if true the data is queried and observer notified 104 // |request_data.query| - if true the data is queried and observer notified
102 // with new data, if available. If false heuristic data is uploaded to our 105 // with new data, if available. If false heuristic data is uploaded to our
103 // servers. 106 // servers.
104 bool StartRequest(const std::string& form_xml, 107 bool StartRequest(
dhollowa 2010/12/10 21:37:38 The previous formatting is better.
Ilya Sherman 2010/12/11 03:35:03 Oops, had already fixed that locally. Done.
105 const FormRequestData& request_data); 108 const std::string& form_xml,
109 const FormRequestData& request_data);
106 110
107 // URLFetcher::Delegate implementation: 111 // URLFetcher::Delegate implementation:
108 virtual void OnURLFetchComplete(const URLFetcher* source, 112 virtual void OnURLFetchComplete(const URLFetcher* source,
109 const GURL& url, 113 const GURL& url,
110 const URLRequestStatus& status, 114 const URLRequestStatus& status,
111 int response_code, 115 int response_code,
112 const ResponseCookies& cookies, 116 const ResponseCookies& cookies,
113 const std::string& data); 117 const std::string& data);
114 118
115 // Profile for preference storage. 119 // Profile for preference storage.
(...skipping 16 matching lines...) Expand all
132 double positive_upload_rate_; 136 double positive_upload_rate_;
133 double negative_upload_rate_; 137 double negative_upload_rate_;
134 138
135 // Needed for unit-test. 139 // Needed for unit-test.
136 int fetcher_id_for_unittest_; 140 int fetcher_id_for_unittest_;
137 bool is_testing_; 141 bool is_testing_;
138 }; 142 };
139 143
140 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_ 144 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_
141 145
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_download.cc » ('j') | chrome/browser/autofill/autofill_metrics.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698