| 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 "chrome/browser/password_manager/password_generation_manager.h" | 5 #include "chrome/browser/password_manager/password_generation_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/password_manager/password_manager.h" | 7 #include "chrome/browser/password_manager/password_manager.h" |
| 8 #include "chrome/browser/password_manager/password_manager_delegate.h" | 8 #include "chrome/browser/password_manager/password_manager_delegate.h" |
| 9 #include "chrome/browser/password_manager/password_manager_driver.h" | 9 #include "chrome/browser/password_manager/password_manager_driver.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 #if defined(USE_AURA) | 118 #if defined(USE_AURA) |
| 119 // Convert element_bounds to be in screen space. | 119 // Convert element_bounds to be in screen space. |
| 120 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 120 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 121 | 121 |
| 122 password_generator_.reset(new autofill::PasswordGenerator(max_length)); | 122 password_generator_.reset(new autofill::PasswordGenerator(max_length)); |
| 123 | 123 |
| 124 popup_controller_ = | 124 popup_controller_ = |
| 125 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 125 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 126 popup_controller_, | 126 popup_controller_, |
| 127 element_bounds_in_screen_space, | 127 element_bounds_in_screen_space, |
| 128 form, | 128 &form, |
| 129 password_generator_.get(), | 129 password_generator_.get(), |
| 130 driver_->GetPasswordManager(), | 130 driver_->GetPasswordManager(), |
| 131 observer_, | 131 observer_, |
| 132 web_contents_, | 132 web_contents_, |
| 133 web_contents_->GetView()->GetNativeView()); | 133 web_contents_->GetView()->GetNativeView()); |
| 134 popup_controller_->Show(); | 134 popup_controller_->Show(true /* display_password */); |
| 135 #endif // #if defined(USE_AURA) | 135 #endif // #if defined(USE_AURA) |
| 136 } | 136 } |
| 137 | 137 |
| 138 void PasswordGenerationManager::OnShowPasswordEditingPopup( | 138 void PasswordGenerationManager::OnShowPasswordEditingPopup( |
| 139 const gfx::RectF& bounds) { | 139 const gfx::RectF& bounds) { |
| 140 // TODO(gcasto): Enable this. | 140 // Only implemented for Aura right now. |
| 141 #if defined(USE_AURA) |
| 142 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 143 |
| 144 popup_controller_ = |
| 145 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 146 popup_controller_, |
| 147 element_bounds_in_screen_space, |
| 148 NULL, |
| 149 NULL, |
| 150 NULL, |
| 151 observer_, |
| 152 web_contents_, |
| 153 web_contents_->GetView()->GetNativeView()); |
| 154 popup_controller_->Show(false /* display_password */); |
| 155 #endif // #if defined(USE_AURA) |
| 141 } | 156 } |
| 142 | 157 |
| 143 void PasswordGenerationManager::OnHidePasswordGenerationPopup() { | 158 void PasswordGenerationManager::OnHidePasswordGenerationPopup() { |
| 144 HidePopup(); | 159 HidePopup(); |
| 145 } | 160 } |
| 146 | 161 |
| 147 void PasswordGenerationManager::HidePopup() { | 162 void PasswordGenerationManager::HidePopup() { |
| 148 if (popup_controller_) | 163 if (popup_controller_) |
| 149 popup_controller_->HideAndDestroy(); | 164 popup_controller_->HideAndDestroy(); |
| 150 } | 165 } |
| OLD | NEW |