Chromium Code Reviews| 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 if (controller) | |
| 
 
dvadym
2015/08/25 13:55:24
You can skip checking if controller is valid as it
 
 | |
| 350 return controller->ShouldShowMultipleAccountUpdateUI(); | |
| 351 else | |
| 352 return false; | |
| 349 } | 353 } | 
| 350 | 354 | 
| 351 // static | 355 // static | 
| 352 int ManagePasswordsBubbleModel::UsernameFieldWidth() { | 356 int ManagePasswordsBubbleModel::UsernameFieldWidth() { | 
| 353 return GetFieldWidth(USERNAME_FIELD); | 357 return GetFieldWidth(USERNAME_FIELD); | 
| 354 } | 358 } | 
| 355 | 359 | 
| 356 // static | 360 // static | 
| 357 int ManagePasswordsBubbleModel::PasswordFieldWidth() { | 361 int ManagePasswordsBubbleModel::PasswordFieldWidth() { | 
| 358 return GetFieldWidth(PASSWORD_FIELD); | 362 return GetFieldWidth(PASSWORD_FIELD); | 
| (...skipping 29 matching lines...) Expand all Loading... | |
| 388 return NO_UPDATE_SUBMISSION; | 392 return NO_UPDATE_SUBMISSION; | 
| 389 } | 393 } | 
| 390 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) | 394 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) | 
| 391 return NO_UPDATE_SUBMISSION; | 395 return NO_UPDATE_SUBMISSION; | 
| 392 if (password_overridden_) | 396 if (password_overridden_) | 
| 393 return update_events[3][behavior]; | 397 return update_events[3][behavior]; | 
| 394 if (ShouldShowMultipleAccountUpdateUI()) | 398 if (ShouldShowMultipleAccountUpdateUI()) | 
| 395 return update_events[2][behavior]; | 399 return update_events[2][behavior]; | 
| 396 return update_events[1][behavior]; | 400 return update_events[1][behavior]; | 
| 397 } | 401 } | 
| OLD | NEW |