OLD | NEW |
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 "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/api/infobars/infobar_service.h" | 9 #include "chrome/browser/api/infobars/infobar_service.h" |
10 #include "chrome/browser/autofill/password_generator.h" | 10 #include "chrome/browser/autofill/password_generator.h" |
11 #include "chrome/browser/password_manager/password_manager.h" | 11 #include "chrome/browser/password_manager/password_manager.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/autocheckout_bubble.h" | 15 #include "chrome/browser/ui/autofill/autocheckout_bubble.h" |
16 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 16 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
22 #include "content/public/common/password_form.h" | 22 #include "content/public/common/password_form.h" |
23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
24 | 24 |
25 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabAutofillManagerDelegate); | 25 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate); |
| 26 |
| 27 namespace autofill { |
26 | 28 |
27 TabAutofillManagerDelegate::TabAutofillManagerDelegate( | 29 TabAutofillManagerDelegate::TabAutofillManagerDelegate( |
28 content::WebContents* web_contents) | 30 content::WebContents* web_contents) |
29 : content::WebContentsObserver(web_contents), | 31 : content::WebContentsObserver(web_contents), |
30 web_contents_(web_contents), | 32 web_contents_(web_contents), |
31 autofill_dialog_controller_(NULL) { | 33 autofill_dialog_controller_(NULL) { |
32 DCHECK(web_contents); | 34 DCHECK(web_contents); |
33 } | 35 } |
34 | 36 |
35 content::BrowserContext* TabAutofillManagerDelegate::GetBrowserContext() const { | 37 content::BrowserContext* TabAutofillManagerDelegate::GetBrowserContext() const { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 const gfx::RectF& bounding_box, | 92 const gfx::RectF& bounding_box, |
91 const gfx::NativeView& native_view, | 93 const gfx::NativeView& native_view, |
92 const base::Closure& callback) { | 94 const base::Closure& callback) { |
93 autofill::ShowAutocheckoutBubble(bounding_box, native_view, callback); | 95 autofill::ShowAutocheckoutBubble(bounding_box, native_view, callback); |
94 } | 96 } |
95 | 97 |
96 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog( | 98 void TabAutofillManagerDelegate::ShowRequestAutocompleteDialog( |
97 const FormData& form, | 99 const FormData& form, |
98 const GURL& source_url, | 100 const GURL& source_url, |
99 const content::SSLStatus& ssl_status, | 101 const content::SSLStatus& ssl_status, |
| 102 const AutofillMetrics& metric_logger, |
| 103 DialogType dialog_type, |
100 const base::Callback<void(const FormStructure*)>& callback) { | 104 const base::Callback<void(const FormStructure*)>& callback) { |
101 HideRequestAutocompleteDialog(); | 105 HideRequestAutocompleteDialog(); |
102 | 106 |
103 autofill_dialog_controller_ = | 107 autofill_dialog_controller_ = |
104 new autofill::AutofillDialogControllerImpl(web_contents_, | 108 new autofill::AutofillDialogControllerImpl(web_contents_, |
105 form, | 109 form, |
106 source_url, | 110 source_url, |
107 ssl_status, | 111 ssl_status, |
| 112 metric_logger, |
| 113 dialog_type, |
108 callback); | 114 callback); |
109 autofill_dialog_controller_->Show(); | 115 autofill_dialog_controller_->Show(); |
110 } | 116 } |
111 | 117 |
112 void TabAutofillManagerDelegate::RequestAutocompleteDialogClosed() { | 118 void TabAutofillManagerDelegate::RequestAutocompleteDialogClosed() { |
113 autofill_dialog_controller_ = NULL; | 119 autofill_dialog_controller_ = NULL; |
114 } | 120 } |
115 | 121 |
116 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { | 122 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { |
117 autofill_dialog_controller_->UpdateProgressBar(value); | 123 autofill_dialog_controller_->UpdateProgressBar(value); |
118 } | 124 } |
119 | 125 |
120 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { | 126 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { |
121 if (autofill_dialog_controller_) | 127 if (autofill_dialog_controller_) |
122 autofill_dialog_controller_->Hide(); | 128 autofill_dialog_controller_->Hide(); |
123 RequestAutocompleteDialogClosed(); | 129 RequestAutocompleteDialogClosed(); |
124 } | 130 } |
125 | 131 |
126 void TabAutofillManagerDelegate::DidNavigateMainFrame( | 132 void TabAutofillManagerDelegate::DidNavigateMainFrame( |
127 const content::LoadCommittedDetails& details, | 133 const content::LoadCommittedDetails& details, |
128 const content::FrameNavigateParams& params) { | 134 const content::FrameNavigateParams& params) { |
129 // TODO(dbeam): selectively allow this dialog to remain open when going | 135 // TODO(dbeam): selectively allow this dialog to remain open when going |
130 // through the autocheckout flow (when the behavior is more fleshed out). | 136 // through the autocheckout flow (when the behavior is more fleshed out). |
131 HideRequestAutocompleteDialog(); | 137 HideRequestAutocompleteDialog(); |
132 } | 138 } |
| 139 |
| 140 } // namespace autofill |
OLD | NEW |