| 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 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 265 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
| 266 return bounds + client_area.OffsetFromOrigin(); | 266 return bounds + client_area.OffsetFromOrigin(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( | 269 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
| 270 const gfx::RectF& bounds, | 270 const gfx::RectF& bounds, |
| 271 int max_length, | 271 int max_length, |
| 272 const autofill::PasswordForm& form) { | 272 const autofill::PasswordForm& form) { |
| 273 // TODO(gcasto): Validate data in PasswordForm. | 273 // TODO(gcasto): Validate data in PasswordForm. |
| 274 | 274 |
| 275 // Only implemented for Aura right now. | |
| 276 #if defined(USE_AURA) | |
| 277 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 275 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 278 | 276 |
| 279 popup_controller_ = | 277 popup_controller_ = |
| 280 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 278 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 281 popup_controller_, | 279 popup_controller_, |
| 282 element_bounds_in_screen_space, | 280 element_bounds_in_screen_space, |
| 283 form, | 281 form, |
| 284 max_length, | 282 max_length, |
| 285 driver_.GetPasswordManager(), | 283 driver_.GetPasswordManager(), |
| 286 observer_, | 284 observer_, |
| 287 web_contents(), | 285 web_contents(), |
| 288 web_contents()->GetNativeView()); | 286 web_contents()->GetNativeView()); |
| 289 popup_controller_->Show(true /* display_password */); | 287 popup_controller_->Show(true /* display_password */); |
| 290 #endif // #if defined(USE_AURA) | |
| 291 } | 288 } |
| 292 | 289 |
| 293 void ChromePasswordManagerClient::ShowPasswordEditingPopup( | 290 void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
| 294 const gfx::RectF& bounds, | 291 const gfx::RectF& bounds, |
| 295 const autofill::PasswordForm& form) { | 292 const autofill::PasswordForm& form) { |
| 296 // Only implemented for Aura right now. | |
| 297 #if defined(USE_AURA) | |
| 298 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 293 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 299 | 294 |
| 300 popup_controller_ = | 295 popup_controller_ = |
| 301 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 296 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 302 popup_controller_, | 297 popup_controller_, |
| 303 element_bounds_in_screen_space, | 298 element_bounds_in_screen_space, |
| 304 form, | 299 form, |
| 305 0, // Unspecified max length. | 300 0, // Unspecified max length. |
| 306 driver_.GetPasswordManager(), | 301 driver_.GetPasswordManager(), |
| 307 observer_, | 302 observer_, |
| 308 web_contents(), | 303 web_contents(), |
| 309 web_contents()->GetNativeView()); | 304 web_contents()->GetNativeView()); |
| 310 popup_controller_->Show(false /* display_password */); | 305 popup_controller_->Show(false /* display_password */); |
| 311 #endif // #if defined(USE_AURA) | |
| 312 } | 306 } |
| 313 | 307 |
| 314 void ChromePasswordManagerClient::CommitFillPasswordForm( | 308 void ChromePasswordManagerClient::CommitFillPasswordForm( |
| 315 autofill::PasswordFormFillData* data) { | 309 autofill::PasswordFormFillData* data) { |
| 316 driver_.FillPasswordForm(*data); | 310 driver_.FillPasswordForm(*data); |
| 317 } | 311 } |
| OLD | NEW |