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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 25 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
26 #include "components/password_manager/core/browser/password_manager_constants.h" | 26 #include "components/password_manager/core/browser/password_manager_constants.h" |
27 #include "components/password_manager/core/browser/password_store.h" | 27 #include "components/password_manager/core/browser/password_store.h" |
28 #include "components/password_manager/core/common/password_manager_pref_names.h" | 28 #include "components/password_manager/core/common/password_manager_pref_names.h" |
29 #include "components/password_manager/core/common/password_manager_ui.h" | 29 #include "components/password_manager/core/common/password_manager_ui.h" |
30 #include "components/prefs/pref_service.h" | 30 #include "components/prefs/pref_service.h" |
31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
33 | 33 |
34 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
35 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion.h" | |
vasilii
2017/02/17 14:19:37
not needed.
mrefaat
2017/02/17 14:44:47
Done.
| |
36 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controll er.h" | |
35 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h" | 37 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h" |
36 #endif | 38 #endif |
37 | 39 |
38 namespace metrics_util = password_manager::metrics_util; | 40 namespace metrics_util = password_manager::metrics_util; |
39 | 41 |
40 namespace { | 42 namespace { |
41 | 43 |
42 Profile* GetProfileFromWebContents(content::WebContents* web_contents) { | 44 Profile* GetProfileFromWebContents(content::WebContents* web_contents) { |
43 if (!web_contents) | 45 if (!web_contents) |
44 return nullptr; | 46 return nullptr; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 } | 453 } |
452 #if defined(OS_WIN) | 454 #if defined(OS_WIN) |
453 // Desktop to mobile promotion only enabled on windows. | 455 // Desktop to mobile promotion only enabled on windows. |
454 if (desktop_ios_promotion::IsEligibleForIOSPromotion( | 456 if (desktop_ios_promotion::IsEligibleForIOSPromotion( |
455 prefs, sync_service, | 457 prefs, sync_service, |
456 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)) { | 458 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)) { |
457 interaction_keeper_->ReportInteractions(this); | 459 interaction_keeper_->ReportInteractions(this); |
458 title_brand_link_range_ = gfx::Range(); | 460 title_brand_link_range_ = gfx::Range(); |
459 title_ = l10n_util::GetStringUTF16( | 461 title_ = l10n_util::GetStringUTF16( |
460 IDS_PASSWORD_MANAGER_DESKTOP_TO_IOS_PROMO_TITLE); | 462 IDS_PASSWORD_MANAGER_DESKTOP_TO_IOS_PROMO_TITLE); |
463 ios_promotion_controller_.reset(new DesktopIOSPromotionController( | |
464 GetProfile(), | |
465 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | |
461 state_ = password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; | 466 state_ = password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; |
462 // TODO(crbug.com/676655): Update impression count. | |
463 // TODO(crbug.com/676655): Add required logging. | |
464 return true; | 467 return true; |
465 } | 468 } |
466 #endif | 469 #endif |
467 return false; | 470 return false; |
468 } | 471 } |
469 | 472 |
470 void ManagePasswordsBubbleModel::SetClockForTesting( | 473 void ManagePasswordsBubbleModel::SetClockForTesting( |
471 std::unique_ptr<base::Clock> clock) { | 474 std::unique_ptr<base::Clock> clock) { |
472 interaction_keeper_->SetClockForTesting(std::move(clock)); | 475 interaction_keeper_->SetClockForTesting(std::move(clock)); |
473 } | 476 } |
474 | 477 |
478 DesktopIOSPromotionController* | |
479 ManagePasswordsBubbleModel::GetDesktopIOSPromotionController() { | |
480 return ios_promotion_controller_.get(); | |
481 } | |
482 | |
475 void ManagePasswordsBubbleModel::UpdatePendingStateTitle() { | 483 void ManagePasswordsBubbleModel::UpdatePendingStateTitle() { |
476 title_brand_link_range_ = gfx::Range(); | 484 title_brand_link_range_ = gfx::Range(); |
477 PasswordTitleType type = | 485 PasswordTitleType type = |
478 state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE | 486 state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE |
479 ? PasswordTitleType::UPDATE_PASSWORD | 487 ? PasswordTitleType::UPDATE_PASSWORD |
480 : (pending_password_.federation_origin.unique() | 488 : (pending_password_.federation_origin.unique() |
481 ? PasswordTitleType::SAVE_PASSWORD | 489 ? PasswordTitleType::SAVE_PASSWORD |
482 : PasswordTitleType::SAVE_ACCOUNT); | 490 : PasswordTitleType::SAVE_ACCOUNT); |
483 GetSavePasswordDialogTitleTextAndLinkRange( | 491 GetSavePasswordDialogTitleTextAndLinkRange( |
484 GetWebContents()->GetVisibleURL(), origin_, IsSmartLockUser(GetProfile()), | 492 GetWebContents()->GetVisibleURL(), origin_, IsSmartLockUser(GetProfile()), |
(...skipping 28 matching lines...) Expand all Loading... | |
513 return metrics_util::NO_UPDATE_SUBMISSION; | 521 return metrics_util::NO_UPDATE_SUBMISSION; |
514 } | 522 } |
515 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) | 523 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) |
516 return metrics_util::NO_UPDATE_SUBMISSION; | 524 return metrics_util::NO_UPDATE_SUBMISSION; |
517 if (password_overridden_) | 525 if (password_overridden_) |
518 return update_events[3][behavior]; | 526 return update_events[3][behavior]; |
519 if (ShouldShowMultipleAccountUpdateUI()) | 527 if (ShouldShowMultipleAccountUpdateUI()) |
520 return update_events[2][behavior]; | 528 return update_events[2][behavior]; |
521 return update_events[1][behavior]; | 529 return update_events[1][behavior]; |
522 } | 530 } |
OLD | NEW |