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

Side by Side Diff: components/autofill/content/browser/risk/fingerprint.cc

Issue 19894003: Move webplugininfo.h to content/public. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 // Generating a fingerprint consists of two major steps: 5 // Generating a fingerprint consists of two major steps:
6 // (1) Gather all the necessary data. 6 // (1) Gather all the necessary data.
7 // (2) Write it into a protocol buffer. 7 // (2) Write it into a protocol buffer.
8 // 8 //
9 // Step (2) is as simple as it sounds -- it's really just a matter of copying 9 // Step (2) is as simple as it sounds -- it's really just a matter of copying
10 // data. Step (1) requires waiting on several asynchronous callbacks, which are 10 // data. Step (1) requires waiting on several asynchronous callbacks, which are
(...skipping 17 matching lines...) Expand all
28 #include "content/public/browser/geolocation_provider.h" 28 #include "content/public/browser/geolocation_provider.h"
29 #include "content/public/browser/gpu_data_manager.h" 29 #include "content/public/browser/gpu_data_manager.h"
30 #include "content/public/browser/gpu_data_manager_observer.h" 30 #include "content/public/browser/gpu_data_manager_observer.h"
31 #include "content/public/browser/plugin_service.h" 31 #include "content/public/browser/plugin_service.h"
32 #include "content/public/browser/render_widget_host.h" 32 #include "content/public/browser/render_widget_host.h"
33 #include "content/public/browser/render_widget_host_view.h" 33 #include "content/public/browser/render_widget_host_view.h"
34 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
35 #include "content/public/browser/web_contents_view.h" 35 #include "content/public/browser/web_contents_view.h"
36 #include "content/public/common/content_client.h" 36 #include "content/public/common/content_client.h"
37 #include "content/public/common/geoposition.h" 37 #include "content/public/common/geoposition.h"
38 #include "content/public/common/webplugininfo.h"
38 #include "gpu/config/gpu_info.h" 39 #include "gpu/config/gpu_info.h"
39 #include "third_party/WebKit/public/platform/WebRect.h" 40 #include "third_party/WebKit/public/platform/WebRect.h"
40 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 41 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
41 #include "ui/gfx/rect.h" 42 #include "ui/gfx/rect.h"
42 #include "ui/gfx/screen.h" 43 #include "ui/gfx/screen.h"
43 #include "webkit/plugins/webplugininfo.h"
44 44
45 using WebKit::WebScreenInfo; 45 using WebKit::WebScreenInfo;
46 46
47 namespace autofill { 47 namespace autofill {
48 namespace risk { 48 namespace risk {
49 49
50 namespace { 50 namespace {
51 51
52 const int32 kFingerprinterVersion = 1; 52 const int32 kFingerprinterVersion = 1;
53 53
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 std::string font_name; 96 std::string font_name;
97 success = font_description->GetString(1, &font_name); 97 success = font_description->GetString(1, &font_name);
98 DCHECK(success); 98 DCHECK(success);
99 99
100 machine->add_font(font_name); 100 machine->add_font(font_name);
101 } 101 }
102 } 102 }
103 103
104 // Adds the list of |plugins| to the |machine|. 104 // Adds the list of |plugins| to the |machine|.
105 void AddPluginsToFingerprint(const std::vector<webkit::WebPluginInfo>& plugins, 105 void AddPluginsToFingerprint(const std::vector<content::WebPluginInfo>& plugins,
106 Fingerprint::MachineCharacteristics* machine) { 106 Fingerprint::MachineCharacteristics* machine) {
107 for (std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin(); 107 for (std::vector<content::WebPluginInfo>::const_iterator it = plugins.begin();
108 it != plugins.end(); ++it) { 108 it != plugins.end(); ++it) {
109 Fingerprint::MachineCharacteristics::Plugin* plugin = 109 Fingerprint::MachineCharacteristics::Plugin* plugin =
110 machine->add_plugin(); 110 machine->add_plugin();
111 plugin->set_name(UTF16ToUTF8(it->name)); 111 plugin->set_name(UTF16ToUTF8(it->name));
112 plugin->set_description(UTF16ToUTF8(it->desc)); 112 plugin->set_description(UTF16ToUTF8(it->desc));
113 for (std::vector<webkit::WebPluginMimeType>::const_iterator mime_type = 113 for (std::vector<content::WebPluginMimeType>::const_iterator mime_type =
114 it->mime_types.begin(); 114 it->mime_types.begin();
115 mime_type != it->mime_types.end(); ++mime_type) { 115 mime_type != it->mime_types.end(); ++mime_type) {
116 plugin->add_mime_type(mime_type->mime_type); 116 plugin->add_mime_type(mime_type->mime_type);
117 } 117 }
118 plugin->set_version(UTF16ToUTF8(it->version)); 118 plugin->set_version(UTF16ToUTF8(it->version));
119 } 119 }
120 } 120 }
121 121
122 // Adds the list of HTTP accept languages to the |machine|. 122 // Adds the list of HTTP accept languages to the |machine|.
123 void AddAcceptLanguagesToFingerprint( 123 void AddAcceptLanguagesToFingerprint(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback); 206 const base::Callback<void(scoped_ptr<Fingerprint>)>& callback);
207 207
208 private: 208 private:
209 virtual ~FingerprintDataLoader() {} 209 virtual ~FingerprintDataLoader() {}
210 210
211 // content::GpuDataManagerObserver: 211 // content::GpuDataManagerObserver:
212 virtual void OnGpuInfoUpdate() OVERRIDE; 212 virtual void OnGpuInfoUpdate() OVERRIDE;
213 213
214 // Callbacks for asynchronously loaded data. 214 // Callbacks for asynchronously loaded data.
215 void OnGotFonts(scoped_ptr<base::ListValue> fonts); 215 void OnGotFonts(scoped_ptr<base::ListValue> fonts);
216 void OnGotPlugins(const std::vector<webkit::WebPluginInfo>& plugins); 216 void OnGotPlugins(const std::vector<content::WebPluginInfo>& plugins);
217 void OnGotGeoposition(const content::Geoposition& geoposition); 217 void OnGotGeoposition(const content::Geoposition& geoposition);
218 218
219 // Methods that run on the IO thread to communicate with the 219 // Methods that run on the IO thread to communicate with the
220 // GeolocationProvider. 220 // GeolocationProvider.
221 void LoadGeoposition(); 221 void LoadGeoposition();
222 void OnGotGeopositionOnIOThread(const content::Geoposition& geoposition); 222 void OnGotGeopositionOnIOThread(const content::Geoposition& geoposition);
223 223
224 // If all of the asynchronous data has been loaded, calls |callback_| with 224 // If all of the asynchronous data has been loaded, calls |callback_| with
225 // the fingerprint data. 225 // the fingerprint data.
226 void MaybeFillFingerprint(); 226 void MaybeFillFingerprint();
(...skipping 20 matching lines...) Expand all
247 const gfx::Rect content_bounds_; 247 const gfx::Rect content_bounds_;
248 const WebScreenInfo screen_info_; 248 const WebScreenInfo screen_info_;
249 const std::string version_; 249 const std::string version_;
250 const std::string charset_; 250 const std::string charset_;
251 const std::string accept_languages_; 251 const std::string accept_languages_;
252 const base::Time install_time_; 252 const base::Time install_time_;
253 DialogType dialog_type_; 253 DialogType dialog_type_;
254 254
255 // Data that will be loaded asynchronously. 255 // Data that will be loaded asynchronously.
256 scoped_ptr<base::ListValue> fonts_; 256 scoped_ptr<base::ListValue> fonts_;
257 std::vector<webkit::WebPluginInfo> plugins_; 257 std::vector<content::WebPluginInfo> plugins_;
258 bool waiting_on_plugins_; 258 bool waiting_on_plugins_;
259 content::Geoposition geoposition_; 259 content::Geoposition geoposition_;
260 260
261 // The current application locale. 261 // The current application locale.
262 std::string app_locale_; 262 std::string app_locale_;
263 263
264 // The callback that will be called once all the data is available. 264 // The callback that will be called once all the data is available.
265 base::Callback<void(scoped_ptr<Fingerprint>)> callback_; 265 base::Callback<void(scoped_ptr<Fingerprint>)> callback_;
266 266
267 DISALLOW_COPY_AND_ASSIGN(FingerprintDataLoader); 267 DISALLOW_COPY_AND_ASSIGN(FingerprintDataLoader);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 MaybeFillFingerprint(); 327 MaybeFillFingerprint();
328 } 328 }
329 329
330 void FingerprintDataLoader::OnGotFonts(scoped_ptr<base::ListValue> fonts) { 330 void FingerprintDataLoader::OnGotFonts(scoped_ptr<base::ListValue> fonts) {
331 DCHECK(!fonts_); 331 DCHECK(!fonts_);
332 fonts_.reset(fonts.release()); 332 fonts_.reset(fonts.release());
333 MaybeFillFingerprint(); 333 MaybeFillFingerprint();
334 } 334 }
335 335
336 void FingerprintDataLoader::OnGotPlugins( 336 void FingerprintDataLoader::OnGotPlugins(
337 const std::vector<webkit::WebPluginInfo>& plugins) { 337 const std::vector<content::WebPluginInfo>& plugins) {
338 DCHECK(waiting_on_plugins_); 338 DCHECK(waiting_on_plugins_);
339 waiting_on_plugins_ = false; 339 waiting_on_plugins_ = false;
340 plugins_ = plugins; 340 plugins_ = plugins;
341 MaybeFillFingerprint(); 341 MaybeFillFingerprint();
342 } 342 }
343 343
344 void FingerprintDataLoader::OnGotGeoposition( 344 void FingerprintDataLoader::OnGotGeoposition(
345 const content::Geoposition& geoposition) { 345 const content::Geoposition& geoposition) {
346 DCHECK(!geoposition_.Validate()); 346 DCHECK(!geoposition_.Validate());
347 347
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info); 496 host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info);
497 497
498 internal::GetFingerprintInternal( 498 internal::GetFingerprintInternal(
499 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version, 499 obfuscated_gaia_id, window_bounds, content_bounds, screen_info, version,
500 charset, accept_languages, install_time, dialog_type, app_locale, 500 charset, accept_languages, install_time, dialog_type, app_locale,
501 callback); 501 callback);
502 } 502 }
503 503
504 } // namespace risk 504 } // namespace risk
505 } // namespace autofill 505 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698