OLD | NEW |
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 #include "chrome/browser/password_manager/password_generation_manager.h" | 5 #include "chrome/browser/password_manager/password_generation_manager.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/password_manager/password_manager.h" | 8 #include "chrome/browser/password_manager/password_manager.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/profile_sync_service.h" | 10 #include "chrome/browser/sync/profile_sync_service.h" |
11 #include "chrome/browser/sync/profile_sync_service_factory.h" | 11 #include "chrome/browser/sync/profile_sync_service_factory.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
16 #include "components/autofill/core/browser/autofill_field.h" | 16 #include "components/autofill/core/browser/autofill_field.h" |
17 #include "components/autofill/core/browser/field_types.h" | 17 #include "components/autofill/core/browser/field_types.h" |
18 #include "components/autofill/core/browser/form_structure.h" | 18 #include "components/autofill/core/browser/form_structure.h" |
19 #include "components/autofill/core/browser/password_generator.h" | 19 #include "components/autofill/core/browser/password_generator.h" |
20 #include "components/autofill/core/common/autofill_messages.h" | 20 #include "components/autofill/core/common/autofill_messages.h" |
21 #include "components/autofill/core/common/form_data.h" | 21 #include "components/autofill/core/common/form_data.h" |
| 22 #include "components/autofill/core/common/password_form.h" |
22 #include "components/user_prefs/pref_registry_syncable.h" | 23 #include "components/user_prefs/pref_registry_syncable.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
26 #include "content/public/common/password_form.h" | |
27 #include "ipc/ipc_message_macros.h" | 27 #include "ipc/ipc_message_macros.h" |
28 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
29 | 29 |
30 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PasswordGenerationManager); | 30 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PasswordGenerationManager); |
31 | 31 |
32 PasswordGenerationManager::PasswordGenerationManager( | 32 PasswordGenerationManager::PasswordGenerationManager( |
33 content::WebContents* contents) | 33 content::WebContents* contents) |
34 : content::WebContentsObserver(contents), | 34 : content::WebContentsObserver(contents), |
35 enabled_(false), | 35 enabled_(false), |
36 weak_factory_(this) { | 36 weak_factory_(this) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void PasswordGenerationManager::SendAccountCreationFormsToRenderer( | 177 void PasswordGenerationManager::SendAccountCreationFormsToRenderer( |
178 content::RenderViewHost* host, | 178 content::RenderViewHost* host, |
179 const std::vector<autofill::FormData>& forms) { | 179 const std::vector<autofill::FormData>& forms) { |
180 host->Send(new AutofillMsg_AccountCreationFormsDetected( | 180 host->Send(new AutofillMsg_AccountCreationFormsDetected( |
181 host->GetRoutingID(), forms)); | 181 host->GetRoutingID(), forms)); |
182 } | 182 } |
183 | 183 |
184 void PasswordGenerationManager::OnShowPasswordGenerationPopup( | 184 void PasswordGenerationManager::OnShowPasswordGenerationPopup( |
185 const gfx::Rect& bounds, | 185 const gfx::Rect& bounds, |
186 int max_length, | 186 int max_length, |
187 const content::PasswordForm& form) { | 187 const autofill::PasswordForm& form) { |
188 #if defined(OS_ANDROID) | 188 #if defined(OS_ANDROID) |
189 NOTIMPLEMENTED(); | 189 NOTIMPLEMENTED(); |
190 #else | 190 #else |
191 password_generator_.reset(new autofill::PasswordGenerator(max_length)); | 191 password_generator_.reset(new autofill::PasswordGenerator(max_length)); |
192 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 192 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
193 browser->window()->ShowPasswordGenerationBubble(bounds, | 193 browser->window()->ShowPasswordGenerationBubble(bounds, |
194 form, | 194 form, |
195 password_generator_.get()); | 195 password_generator_.get()); |
196 #endif // #if defined(OS_ANDROID) | 196 #endif // #if defined(OS_ANDROID) |
197 } | 197 } |
OLD | NEW |