| 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/ui/passwords/manage_passwords_bubble_model.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/password_manager/password_store_factory.h" | 9 #include "chrome/browser/password_manager/password_store_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 Profile* ManagePasswordsBubbleModel::GetProfile() const { | 337 Profile* ManagePasswordsBubbleModel::GetProfile() const { |
| 338 return GetProfileFromWebContents(web_contents()); | 338 return GetProfileFromWebContents(web_contents()); |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool ManagePasswordsBubbleModel::IsNewUIActive() const { | 341 bool ManagePasswordsBubbleModel::IsNewUIActive() const { |
| 342 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 342 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 343 switches::kEnableCredentialManagerAPI); | 343 switches::kEnableCredentialManagerAPI); |
| 344 } | 344 } |
| 345 | 345 |
| 346 bool ManagePasswordsBubbleModel::ShouldShowMultipleAccountUpdateUI() const { | 346 bool ManagePasswordsBubbleModel::ShouldShowMultipleAccountUpdateUI() const { |
| 347 return state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE && | 347 ManagePasswordsUIController* controller = |
| 348 local_credentials_.size() > 1 && !password_overridden_; | 348 ManagePasswordsUIController::FromWebContents(web_contents()); |
| 349 return controller->ShouldShowMultipleAccountUpdateUI(); |
| 349 } | 350 } |
| 350 | 351 |
| 351 // static | 352 // static |
| 352 int ManagePasswordsBubbleModel::UsernameFieldWidth() { | 353 int ManagePasswordsBubbleModel::UsernameFieldWidth() { |
| 353 return GetFieldWidth(USERNAME_FIELD); | 354 return GetFieldWidth(USERNAME_FIELD); |
| 354 } | 355 } |
| 355 | 356 |
| 356 // static | 357 // static |
| 357 int ManagePasswordsBubbleModel::PasswordFieldWidth() { | 358 int ManagePasswordsBubbleModel::PasswordFieldWidth() { |
| 358 return GetFieldWidth(PASSWORD_FIELD); | 359 return GetFieldWidth(PASSWORD_FIELD); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 388 return NO_UPDATE_SUBMISSION; | 389 return NO_UPDATE_SUBMISSION; |
| 389 } | 390 } |
| 390 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) | 391 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) |
| 391 return NO_UPDATE_SUBMISSION; | 392 return NO_UPDATE_SUBMISSION; |
| 392 if (password_overridden_) | 393 if (password_overridden_) |
| 393 return update_events[3][behavior]; | 394 return update_events[3][behavior]; |
| 394 if (ShouldShowMultipleAccountUpdateUI()) | 395 if (ShouldShowMultipleAccountUpdateUI()) |
| 395 return update_events[2][behavior]; | 396 return update_events[2][behavior]; |
| 396 return update_events[1][behavior]; | 397 return update_events[1][behavior]; |
| 397 } | 398 } |
| OLD | NEW |