| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/password_manager/password_store_factory.h" | 14 #include "chrome/browser/password_manager/password_store_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 16 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 17 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 17 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
| 18 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" | 18 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" |
| 19 #include "chrome/common/url_constants.h" | |
| 20 #include "chrome/grit/chromium_strings.h" | 19 #include "chrome/grit/chromium_strings.h" |
| 21 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/browser_sync/browser/profile_sync_service.h" | 21 #include "components/browser_sync/browser/profile_sync_service.h" |
| 23 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 22 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
| 23 #include "components/password_manager/core/browser/password_manager_constants.h" |
| 24 #include "components/password_manager/core/browser/password_store.h" | 24 #include "components/password_manager/core/browser/password_store.h" |
| 25 #include "components/password_manager/core/common/credential_manager_types.h" | 25 #include "components/password_manager/core/common/credential_manager_types.h" |
| 26 #include "components/password_manager/core/common/password_manager_ui.h" | 26 #include "components/password_manager/core/common/password_manager_ui.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 | 29 |
| 30 namespace metrics_util = password_manager::metrics_util; | 30 namespace metrics_util = password_manager::metrics_util; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 UpdateManageStateTitle(); | 115 UpdateManageStateTitle(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 if (state_ == password_manager::ui::CONFIRMATION_STATE) { | 118 if (state_ == password_manager::ui::CONFIRMATION_STATE) { |
| 119 base::string16 save_confirmation_link = | 119 base::string16 save_confirmation_link = |
| 120 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK); | 120 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK); |
| 121 int confirmation_text_id = IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT; | 121 int confirmation_text_id = IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT; |
| 122 if (GetSmartLockBrandingState(GetProfile()) == | 122 if (GetSmartLockBrandingState(GetProfile()) == |
| 123 password_bubble_experiment::SmartLockBranding::FULL) { | 123 password_bubble_experiment::SmartLockBranding::FULL) { |
| 124 std::string management_hostname = | 124 std::string management_hostname = |
| 125 GURL(chrome::kPasswordManagerAccountDashboardURL).host(); | 125 GURL(password_manager::kPasswordManagerAccountDashboardURL).host(); |
| 126 save_confirmation_link = base::UTF8ToUTF16(management_hostname); | 126 save_confirmation_link = base::UTF8ToUTF16(management_hostname); |
| 127 confirmation_text_id = | 127 confirmation_text_id = |
| 128 IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_SMART_LOCK_TEXT; | 128 IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_SMART_LOCK_TEXT; |
| 129 } | 129 } |
| 130 | 130 |
| 131 size_t offset; | 131 size_t offset; |
| 132 save_confirmation_text_ = | 132 save_confirmation_text_ = |
| 133 l10n_util::GetStringFUTF16( | 133 l10n_util::GetStringFUTF16( |
| 134 confirmation_text_id, save_confirmation_link, &offset); | 134 confirmation_text_id, save_confirmation_link, &offset); |
| 135 save_confirmation_link_range_ = | 135 save_confirmation_link_range_ = |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 PasswordsModelDelegateFromWebContents(web_contents()) | 308 PasswordsModelDelegateFromWebContents(web_contents()) |
| 309 ->NavigateToPasswordManagerSettingsPage(); | 309 ->NavigateToPasswordManagerSettingsPage(); |
| 310 } | 310 } |
| 311 } | 311 } |
| 312 | 312 |
| 313 void ManagePasswordsBubbleModel::OnBrandLinkClicked() { | 313 void ManagePasswordsBubbleModel::OnBrandLinkClicked() { |
| 314 dismissal_reason_ = metrics_util::CLICKED_BRAND_NAME; | 314 dismissal_reason_ = metrics_util::CLICKED_BRAND_NAME; |
| 315 switch (GetSmartLockBrandingState(GetProfile())) { | 315 switch (GetSmartLockBrandingState(GetProfile())) { |
| 316 case password_bubble_experiment::SmartLockBranding::FULL: | 316 case password_bubble_experiment::SmartLockBranding::FULL: |
| 317 PasswordsModelDelegateFromWebContents(web_contents()) | 317 PasswordsModelDelegateFromWebContents(web_contents()) |
| 318 ->NavigateToSmartLockPage(); | 318 ->NavigateToExternalPasswordManager(); |
| 319 break; | 319 break; |
| 320 case password_bubble_experiment::SmartLockBranding::SAVE_BUBBLE_ONLY: | 320 case password_bubble_experiment::SmartLockBranding::SAVE_BUBBLE_ONLY: |
| 321 PasswordsModelDelegateFromWebContents(web_contents()) | 321 PasswordsModelDelegateFromWebContents(web_contents()) |
| 322 ->NavigateToSmartLockHelpPage(); | 322 ->NavigateToSmartLockHelpPage(); |
| 323 break; | 323 break; |
| 324 case password_bubble_experiment::SmartLockBranding::NONE: | 324 case password_bubble_experiment::SmartLockBranding::NONE: |
| 325 NOTREACHED(); | 325 NOTREACHED(); |
| 326 break; | 326 break; |
| 327 } | 327 } |
| 328 } | 328 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 return metrics_util::NO_UPDATE_SUBMISSION; | 427 return metrics_util::NO_UPDATE_SUBMISSION; |
| 428 } | 428 } |
| 429 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) | 429 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) |
| 430 return metrics_util::NO_UPDATE_SUBMISSION; | 430 return metrics_util::NO_UPDATE_SUBMISSION; |
| 431 if (password_overridden_) | 431 if (password_overridden_) |
| 432 return update_events[3][behavior]; | 432 return update_events[3][behavior]; |
| 433 if (ShouldShowMultipleAccountUpdateUI()) | 433 if (ShouldShowMultipleAccountUpdateUI()) |
| 434 return update_events[2][behavior]; | 434 return update_events[2][behavior]; |
| 435 return update_events[1][behavior]; | 435 return update_events[1][behavior]; |
| 436 } | 436 } |
| OLD | NEW |