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_controll er.h" | |
35 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h" | 36 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h" |
36 #endif | 37 #endif |
37 | 38 |
38 namespace metrics_util = password_manager::metrics_util; | 39 namespace metrics_util = password_manager::metrics_util; |
39 | 40 |
40 namespace { | 41 namespace { |
41 | 42 |
42 Profile* GetProfileFromWebContents(content::WebContents* web_contents) { | 43 Profile* GetProfileFromWebContents(content::WebContents* web_contents) { |
43 if (!web_contents) | 44 if (!web_contents) |
44 return nullptr; | 45 return nullptr; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 } | 452 } |
452 #if defined(OS_WIN) | 453 #if defined(OS_WIN) |
453 // Desktop to mobile promotion only enabled on windows. | 454 // Desktop to mobile promotion only enabled on windows. |
454 if (desktop_ios_promotion::IsEligibleForIOSPromotion( | 455 if (desktop_ios_promotion::IsEligibleForIOSPromotion( |
455 prefs, sync_service, | 456 prefs, sync_service, |
456 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)) { | 457 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)) { |
457 interaction_keeper_->ReportInteractions(this); | 458 interaction_keeper_->ReportInteractions(this); |
458 title_brand_link_range_ = gfx::Range(); | 459 title_brand_link_range_ = gfx::Range(); |
459 title_ = l10n_util::GetStringUTF16( | 460 title_ = l10n_util::GetStringUTF16( |
460 IDS_PASSWORD_MANAGER_DESKTOP_TO_IOS_PROMO_TITLE); | 461 IDS_PASSWORD_MANAGER_DESKTOP_TO_IOS_PROMO_TITLE); |
462 ios_promotion_controller_.reset(new DesktopIOSPromotionController( | |
sky
2017/02/17 19:06:30
Use MakeUnique (see threads on chromium-dev for de
mrefaat
2017/02/17 21:53:15
Done.
| |
463 GetProfile(), | |
464 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | |
461 state_ = password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; | 465 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; | 466 return true; |
465 } | 467 } |
466 #endif | 468 #endif |
467 return false; | 469 return false; |
468 } | 470 } |
469 | 471 |
470 void ManagePasswordsBubbleModel::SetClockForTesting( | 472 void ManagePasswordsBubbleModel::SetClockForTesting( |
471 std::unique_ptr<base::Clock> clock) { | 473 std::unique_ptr<base::Clock> clock) { |
472 interaction_keeper_->SetClockForTesting(std::move(clock)); | 474 interaction_keeper_->SetClockForTesting(std::move(clock)); |
473 } | 475 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
513 return metrics_util::NO_UPDATE_SUBMISSION; | 515 return metrics_util::NO_UPDATE_SUBMISSION; |
514 } | 516 } |
515 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) | 517 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) |
516 return metrics_util::NO_UPDATE_SUBMISSION; | 518 return metrics_util::NO_UPDATE_SUBMISSION; |
517 if (password_overridden_) | 519 if (password_overridden_) |
518 return update_events[3][behavior]; | 520 return update_events[3][behavior]; |
519 if (ShouldShowMultipleAccountUpdateUI()) | 521 if (ShouldShowMultipleAccountUpdateUI()) |
520 return update_events[2][behavior]; | 522 return update_events[2][behavior]; |
521 return update_events[1][behavior]; | 523 return update_events[1][behavior]; |
522 } | 524 } |
OLD | NEW |