| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return bounds + client_area.OffsetFromOrigin(); | 265 return bounds + client_area.OffsetFromOrigin(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( | 268 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
| 269 const gfx::RectF& bounds, | 269 const gfx::RectF& bounds, |
| 270 int max_length, | 270 int max_length, |
| 271 const autofill::PasswordForm& form) { | 271 const autofill::PasswordForm& form) { |
| 272 // TODO(gcasto): Validate data in PasswordForm. | 272 // TODO(gcasto): Validate data in PasswordForm. |
| 273 | 273 |
| 274 // Only implemented for Aura right now. | 274 // Only implemented for Aura right now. |
| 275 #if defined(USE_AURA) | |
| 276 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 275 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 277 | 276 |
| 278 popup_controller_ = | 277 popup_controller_ = |
| 279 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 278 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 280 popup_controller_, | 279 popup_controller_, |
| 281 element_bounds_in_screen_space, | 280 element_bounds_in_screen_space, |
| 282 form, | 281 form, |
| 283 max_length, | 282 max_length, |
| 284 driver_.GetPasswordManager(), | 283 driver_.GetPasswordManager(), |
| 285 observer_, | 284 observer_, |
| 286 web_contents(), | 285 web_contents(), |
| 287 web_contents()->GetNativeView()); | 286 web_contents()->GetNativeView()); |
| 288 popup_controller_->Show(true /* display_password */); | 287 popup_controller_->Show(true /* display_password */); |
| 289 #endif // #if defined(USE_AURA) | |
| 290 } | 288 } |
| 291 | 289 |
| 292 void ChromePasswordManagerClient::ShowPasswordEditingPopup( | 290 void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
| 293 const gfx::RectF& bounds, | 291 const gfx::RectF& bounds, |
| 294 const autofill::PasswordForm& form) { | 292 const autofill::PasswordForm& form) { |
| 295 // Only implemented for Aura right now. | 293 // Only implemented for Aura right now. |
| 296 #if defined(USE_AURA) | 294 #if defined(USE_AURA) |
| 297 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 295 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 298 | 296 |
| 299 popup_controller_ = | 297 popup_controller_ = |
| 300 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 298 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 301 popup_controller_, | 299 popup_controller_, |
| 302 element_bounds_in_screen_space, | 300 element_bounds_in_screen_space, |
| 303 form, | 301 form, |
| 304 0, // Unspecified max length. | 302 0, // Unspecified max length. |
| 305 driver_.GetPasswordManager(), | 303 driver_.GetPasswordManager(), |
| 306 observer_, | 304 observer_, |
| 307 web_contents(), | 305 web_contents(), |
| 308 web_contents()->GetNativeView()); | 306 web_contents()->GetNativeView()); |
| 309 popup_controller_->Show(false /* display_password */); | 307 popup_controller_->Show(false /* display_password */); |
| 310 #endif // #if defined(USE_AURA) | 308 #endif // #if defined(USE_AURA) |
| 311 } | 309 } |
| 312 | 310 |
| 313 void ChromePasswordManagerClient::CommitFillPasswordForm( | 311 void ChromePasswordManagerClient::CommitFillPasswordForm( |
| 314 autofill::PasswordFormFillData* data) { | 312 autofill::PasswordFormFillData* data) { |
| 315 driver_.FillPasswordForm(*data); | 313 driver_.FillPasswordForm(*data); |
| 316 } | 314 } |
| OLD | NEW |