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

Side by Side Diff: chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc

Issue 12091086: [Autofill] Add UMA timing metrics for requestAutocomplete dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the test. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" 5 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/api/infobars/infobar_service.h" 8 #include "chrome/browser/api/infobars/infobar_service.h"
9 #include "chrome/browser/autofill/password_generator.h" 9 #include "chrome/browser/autofill/password_generator.h"
10 #include "chrome/browser/password_manager/password_manager.h" 10 #include "chrome/browser/password_manager/password_manager.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sync/profile_sync_service.h" 13 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/browser/sync/profile_sync_service_factory.h" 14 #include "chrome/browser/sync/profile_sync_service_factory.h"
15 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" 15 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/chrome_pages.h" 19 #include "chrome/browser/ui/chrome_pages.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "content/public/common/password_form.h" 21 #include "content/public/common/password_form.h"
22 #include "ui/gfx/rect.h" 22 #include "ui/gfx/rect.h"
23 23
24 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabAutofillManagerDelegate); 24 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate);
25
26 namespace autofill {
25 27
26 TabAutofillManagerDelegate::TabAutofillManagerDelegate( 28 TabAutofillManagerDelegate::TabAutofillManagerDelegate(
27 content::WebContents* web_contents) 29 content::WebContents* web_contents)
28 : content::WebContentsObserver(web_contents), 30 : content::WebContentsObserver(web_contents),
29 web_contents_(web_contents), 31 web_contents_(web_contents),
30 autofill_dialog_controller_(NULL) { 32 autofill_dialog_controller_(NULL) {
31 DCHECK(web_contents); 33 DCHECK(web_contents);
32 } 34 }
33 35
34 content::BrowserContext* TabAutofillManagerDelegate::GetBrowserContext() const { 36 content::BrowserContext* TabAutofillManagerDelegate::GetBrowserContext() const {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #else 84 #else
83 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 85 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
84 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); 86 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator);
85 #endif // #if defined(OS_ANDROID) 87 #endif // #if defined(OS_ANDROID)
86 } 88 }
87 89
88 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog( 90 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog(
89 const FormData& form, 91 const FormData& form,
90 const GURL& source_url, 92 const GURL& source_url,
91 const content::SSLStatus& ssl_status, 93 const content::SSLStatus& ssl_status,
94 const AutofillMetrics& metric_logger,
95 DialogRequester requester,
92 const base::Callback<void(const FormStructure*)>& callback) { 96 const base::Callback<void(const FormStructure*)>& callback) {
93 HideRequestAutocompleteDialog(); 97 HideRequestAutocompleteDialog();
94 98
95 autofill_dialog_controller_ = 99 autofill_dialog_controller_ =
96 new autofill::AutofillDialogControllerImpl(web_contents_, 100 new autofill::AutofillDialogControllerImpl(web_contents_,
97 form, 101 form,
98 source_url, 102 source_url,
99 ssl_status, 103 ssl_status,
104 metric_logger,
105 requester,
100 callback); 106 callback);
101 autofill_dialog_controller_->Show(); 107 autofill_dialog_controller_->Show();
102 } 108 }
103 109
104 void TabAutofillManagerDelegate::RequestAutocompleteDialogClosed() { 110 void TabAutofillManagerDelegate::RequestAutocompleteDialogClosed() {
105 autofill_dialog_controller_ = NULL; 111 autofill_dialog_controller_ = NULL;
106 } 112 }
107 113
108 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { 114 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() {
109 if (autofill_dialog_controller_) 115 if (autofill_dialog_controller_)
110 autofill_dialog_controller_->Hide(); 116 autofill_dialog_controller_->Hide();
111 RequestAutocompleteDialogClosed(); 117 RequestAutocompleteDialogClosed();
112 } 118 }
113 119
114 void TabAutofillManagerDelegate::DidNavigateMainFrame( 120 void TabAutofillManagerDelegate::DidNavigateMainFrame(
115 const content::LoadCommittedDetails& details, 121 const content::LoadCommittedDetails& details,
116 const content::FrameNavigateParams& params) { 122 const content::FrameNavigateParams& params) {
117 // TODO(dbeam): selectively allow this dialog to remain open when going 123 // TODO(dbeam): selectively allow this dialog to remain open when going
118 // through the autocheckout flow (when the behavior is more fleshed out). 124 // through the autocheckout flow (when the behavior is more fleshed out).
119 HideRequestAutocompleteDialog(); 125 HideRequestAutocompleteDialog();
120 } 126 }
127
128 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698