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