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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 285 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
286 return bounds + client_area.OffsetFromOrigin(); | 286 return bounds + client_area.OffsetFromOrigin(); |
287 } | 287 } |
288 | 288 |
289 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( | 289 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
290 const gfx::RectF& bounds, | 290 const gfx::RectF& bounds, |
291 int max_length, | 291 int max_length, |
292 const autofill::PasswordForm& form) { | 292 const autofill::PasswordForm& form) { |
293 // TODO(gcasto): Validate data in PasswordForm. | 293 // TODO(gcasto): Validate data in PasswordForm. |
294 | 294 |
295 // Only implemented for Aura right now. | 295 // Not yet implemented on other platforms. |
296 #if defined(USE_AURA) | 296 #if defined(USE_AURA) || defined(OS_MACOSX) |
297 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 297 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
298 | 298 |
299 popup_controller_ = | 299 popup_controller_ = |
300 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 300 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
301 popup_controller_, | 301 popup_controller_, |
302 element_bounds_in_screen_space, | 302 element_bounds_in_screen_space, |
303 form, | 303 form, |
304 max_length, | 304 max_length, |
305 driver_.GetPasswordManager(), | 305 driver_.GetPasswordManager(), |
306 observer_, | 306 observer_, |
307 web_contents(), | 307 web_contents(), |
308 web_contents()->GetNativeView()); | 308 web_contents()->GetNativeView()); |
309 popup_controller_->Show(true /* display_password */); | 309 popup_controller_->Show(true /* display_password */); |
310 #endif // #if defined(USE_AURA) | 310 #endif // defined(USE_AURA) || defined(OS_MACOSX) |
311 } | 311 } |
312 | 312 |
313 void ChromePasswordManagerClient::ShowPasswordEditingPopup( | 313 void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
314 const gfx::RectF& bounds, | 314 const gfx::RectF& bounds, |
315 const autofill::PasswordForm& form) { | 315 const autofill::PasswordForm& form) { |
316 // Only implemented for Aura right now. | |
317 #if defined(USE_AURA) | |
318 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 316 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
319 | 317 // Not yet implemented on other platforms. |
| 318 #if defined(USE_AURA) || defined(OS_MACOSX) |
320 popup_controller_ = | 319 popup_controller_ = |
321 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 320 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
322 popup_controller_, | 321 popup_controller_, |
323 element_bounds_in_screen_space, | 322 element_bounds_in_screen_space, |
324 form, | 323 form, |
325 0, // Unspecified max length. | 324 0, // Unspecified max length. |
326 driver_.GetPasswordManager(), | 325 driver_.GetPasswordManager(), |
327 observer_, | 326 observer_, |
328 web_contents(), | 327 web_contents(), |
329 web_contents()->GetNativeView()); | 328 web_contents()->GetNativeView()); |
330 popup_controller_->Show(false /* display_password */); | 329 popup_controller_->Show(false /* display_password */); |
331 #endif // #if defined(USE_AURA) | 330 #endif // defined(USE_AURA) || defined(OS_MACOSX) |
332 } | 331 } |
333 | 332 |
334 void ChromePasswordManagerClient::CommitFillPasswordForm( | 333 void ChromePasswordManagerClient::CommitFillPasswordForm( |
335 autofill::PasswordFormFillData* data) { | 334 autofill::PasswordFormFillData* data) { |
336 driver_.FillPasswordForm(*data); | 335 driver_.FillPasswordForm(*data); |
337 } | 336 } |
OLD | NEW |