| 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 "components/autofill/content/renderer/password_generation_agent.h" | 5 #include "components/autofill/content/renderer/password_generation_agent.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/autofill/content/common/autofill_messages.h" | 10 #include "components/autofill/content/common/autofill_messages.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // Password isn't generated and there are fewer than kMaximumOfferSize | 404 // Password isn't generated and there are fewer than kMaximumOfferSize |
| 405 // characters typed, so keep offering the password. Note this function | 405 // characters typed, so keep offering the password. Note this function |
| 406 // will just keep the previous popup if one is already showing. | 406 // will just keep the previous popup if one is already showing. |
| 407 ShowGenerationPopup(); | 407 ShowGenerationPopup(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 return true; | 410 return true; |
| 411 } | 411 } |
| 412 | 412 |
| 413 void PasswordGenerationAgent::ShowGenerationPopup() { | 413 void PasswordGenerationAgent::ShowGenerationPopup() { |
| 414 blink::WebRect bounding_box_in_window = |
| 415 generation_element_.boundsInViewport(); |
| 416 render_frame()->GetRenderView()->convertViewportToWindow( |
| 417 &bounding_box_in_window); |
| 418 |
| 414 Send(new AutofillHostMsg_ShowPasswordGenerationPopup( | 419 Send(new AutofillHostMsg_ShowPasswordGenerationPopup( |
| 415 routing_id(), gfx::RectF(generation_element_.boundsInViewport()), | 420 routing_id(), gfx::RectF(bounding_box_in_window), |
| 416 generation_element_.maxLength(), *generation_form_data_->form)); | 421 generation_element_.maxLength(), *generation_form_data_->form)); |
| 417 | 422 |
| 418 generation_popup_shown_ = true; | 423 generation_popup_shown_ = true; |
| 419 } | 424 } |
| 420 | 425 |
| 421 void PasswordGenerationAgent::ShowEditingPopup() { | 426 void PasswordGenerationAgent::ShowEditingPopup() { |
| 427 blink::WebRect bounding_box_in_window = |
| 428 generation_element_.boundsInViewport(); |
| 429 render_frame()->GetRenderView()->convertViewportToWindow( |
| 430 &bounding_box_in_window); |
| 422 Send(new AutofillHostMsg_ShowPasswordEditingPopup( | 431 Send(new AutofillHostMsg_ShowPasswordEditingPopup( |
| 423 routing_id(), gfx::RectF(generation_element_.boundsInViewport()), | 432 routing_id(), gfx::RectF(bounding_box_in_window), |
| 424 *generation_form_data_->form)); | 433 *generation_form_data_->form)); |
| 425 | |
| 426 editing_popup_shown_ = true; | 434 editing_popup_shown_ = true; |
| 427 } | 435 } |
| 428 | 436 |
| 429 void PasswordGenerationAgent::HidePopup() { | 437 void PasswordGenerationAgent::HidePopup() { |
| 430 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); | 438 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); |
| 431 } | 439 } |
| 432 | 440 |
| 433 } // namespace autofill | 441 } // namespace autofill |
| OLD | NEW |