| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 334 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
| 335 return bounds + client_area.OffsetFromOrigin(); | 335 return bounds + client_area.OffsetFromOrigin(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( | 338 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
| 339 const gfx::RectF& bounds, | 339 const gfx::RectF& bounds, |
| 340 int max_length, | 340 int max_length, |
| 341 const autofill::PasswordForm& form) { | 341 const autofill::PasswordForm& form) { |
| 342 // TODO(gcasto): Validate data in PasswordForm. | 342 // TODO(gcasto): Validate data in PasswordForm. |
| 343 | 343 |
| 344 // Not yet implemented on other platforms. | |
| 345 #if defined(USE_AURA) || defined(OS_MACOSX) | |
| 346 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 344 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 347 | 345 |
| 348 popup_controller_ = | 346 popup_controller_ = |
| 349 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 347 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 350 popup_controller_, | 348 popup_controller_, |
| 351 element_bounds_in_screen_space, | 349 element_bounds_in_screen_space, |
| 352 form, | 350 form, |
| 353 max_length, | 351 max_length, |
| 354 driver_.GetPasswordManager(), | 352 driver_.GetPasswordManager(), |
| 355 observer_, | 353 observer_, |
| 356 web_contents(), | 354 web_contents(), |
| 357 web_contents()->GetNativeView()); | 355 web_contents()->GetNativeView()); |
| 358 popup_controller_->Show(true /* display_password */); | 356 popup_controller_->Show(true /* display_password */); |
| 359 #endif // defined(USE_AURA) || defined(OS_MACOSX) | |
| 360 } | 357 } |
| 361 | 358 |
| 362 void ChromePasswordManagerClient::ShowPasswordEditingPopup( | 359 void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
| 363 const gfx::RectF& bounds, | 360 const gfx::RectF& bounds, |
| 364 const autofill::PasswordForm& form) { | 361 const autofill::PasswordForm& form) { |
| 365 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 362 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 366 // Not yet implemented on other platforms. | |
| 367 #if defined(USE_AURA) || defined(OS_MACOSX) | |
| 368 popup_controller_ = | 363 popup_controller_ = |
| 369 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 364 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 370 popup_controller_, | 365 popup_controller_, |
| 371 element_bounds_in_screen_space, | 366 element_bounds_in_screen_space, |
| 372 form, | 367 form, |
| 373 0, // Unspecified max length. | 368 0, // Unspecified max length. |
| 374 driver_.GetPasswordManager(), | 369 driver_.GetPasswordManager(), |
| 375 observer_, | 370 observer_, |
| 376 web_contents(), | 371 web_contents(), |
| 377 web_contents()->GetNativeView()); | 372 web_contents()->GetNativeView()); |
| 378 popup_controller_->Show(false /* display_password */); | 373 popup_controller_->Show(false /* display_password */); |
| 379 #endif // defined(USE_AURA) || defined(OS_MACOSX) | |
| 380 } | 374 } |
| 381 | 375 |
| 382 void ChromePasswordManagerClient::NotifyRendererOfLoggingAvailability() { | 376 void ChromePasswordManagerClient::NotifyRendererOfLoggingAvailability() { |
| 383 if (!web_contents()) | 377 if (!web_contents()) |
| 384 return; | 378 return; |
| 385 | 379 |
| 386 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_SetLoggingState( | 380 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_SetLoggingState( |
| 387 web_contents()->GetRenderViewHost()->GetRoutingID(), | 381 web_contents()->GetRenderViewHost()->GetRoutingID(), |
| 388 can_use_log_router_)); | 382 can_use_log_router_)); |
| 389 } | 383 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 481 |
| 488 if (group_name == "DisallowSyncCredentialsForReauth") { | 482 if (group_name == "DisallowSyncCredentialsForReauth") { |
| 489 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 483 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
| 490 } else if (group_name == "DisallowSyncCredentials") { | 484 } else if (group_name == "DisallowSyncCredentials") { |
| 491 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 485 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
| 492 } else { | 486 } else { |
| 493 // Allow by default. | 487 // Allow by default. |
| 494 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 488 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| 495 } | 489 } |
| 496 } | 490 } |
| OLD | NEW |