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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 12212057: [Autofill] Add ability to load Risk fingerprint data in AutofillDialogControllerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index 239f49eddd5ac90831be36c1a0d3e73d02ab4adb..9f73114aafa9eb0972ee730d278815a478d4c3e0 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/bind.h"
#include "base/logging.h"
#include "base/string_split.h"
#include "base/string_util.h"
@@ -15,23 +16,33 @@
#include "chrome/browser/autofill/autofill_type.h"
#include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
+#include "chrome/browser/autofill/risk/fingerprint.h"
+#include "chrome/browser/autofill/risk/proto/fingerprint.pb.h"
#include "chrome/browser/autofill/validation.h"
#include "chrome/browser/autofill/wallet/full_wallet.h"
#include "chrome/browser/autofill/wallet/wallet_items.h"
#include "chrome/browser/autofill/wallet/wallet_service_url.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/form_data.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
+#include "content/public/browser/render_widget_host.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_view.h"
#include "content/public/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "net/base/cert_status_flags.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebScreenInfo.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -139,7 +150,8 @@ AutofillDialogControllerImpl::AutofillDialogControllerImpl(
ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)),
popup_controller_(NULL),
- section_showing_popup_(SECTION_BILLING) {
+ section_showing_popup_(SECTION_BILLING),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
// TODO(estade): |this| should observe PersonalDataManager.
// TODO(estade): remove duplicates from |form|?
@@ -947,4 +959,38 @@ void AutofillDialogControllerImpl::HidePopup() {
}
}
+void AutofillDialogControllerImpl::LoadRiskFingerprintData() {
+ // TODO(dbeam): Add a DCHECK that the ToS have been accepted prior to
+ // calling into this method. Also, ensure that the UI contains a clear
+ // indication to the user as to what data will be collected. Until then, this
+ // code should not be called.
+
+ // TODO(dbeam): Set the right GAIA id.
Dan Beam 2013/02/07 01:36:46 this can be obtained via |base::StringToInt64(wall
Dan Beam 2013/02/07 01:37:33 er, I mean... wallet_items_->obfuscated_gaia_id()
Ilya Sherman 2013/02/07 01:58:29 Done.
Ilya Sherman 2013/02/07 01:58:29 Done.
+ int64 gaia_id = 0;
+
+ gfx::Rect window_bounds =
+ chrome::FindBrowserWithWebContents(web_contents())->window()->GetBounds();
Evan Stade 2013/02/07 01:34:53 it seems like all this bounds calculation stuff co
Ilya Sherman 2013/02/07 01:58:29 That would require the risk code to have dependenc
Evan Stade 2013/02/07 02:09:16 probably worth noting that FindBrowserWithWebConte
Evan Stade 2013/02/07 02:09:16 you could solve that by adding a function to WebCo
Ilya Sherman 2013/02/14 09:00:40 Aren't we guaranteed to be inside a browser window
Ilya Sherman 2013/02/14 09:00:40 Per John's comment, I did not do this. However, I
Evan Stade 2013/02/19 21:18:18 I can't remember if platform apps have a Browser o
Ilya Sherman 2013/02/20 00:05:19 You're right, they don't. Added code to handle pl
+
+ gfx::Rect content_bounds;
+ web_contents()->GetView()->GetContainerBounds(&content_bounds);
+
+ WebKit::WebScreenInfo screen_info;
+ content::RenderWidgetHostView* host_view =
+ web_contents()->GetRenderWidgetHostView();
+ if (host_view)
+ host_view->GetRenderWidgetHost()->GetWebScreenInfo(&screen_info);
+
+ risk::GetFingerprint(
+ gaia_id, window_bounds, content_bounds, screen_info,
+ *profile_->GetPrefs(),
+ base::Bind(&AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData(
+ scoped_ptr<risk::Fingerprint> fingerprint) {
+ NOTIMPLEMENTED();
+}
+
+
Evan Stade 2013/02/07 01:34:53 ^H
Ilya Sherman 2013/02/07 01:58:29 Done.
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698