OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signin/easy_unlock_screenlock_state_handler.h" | 5 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 // Returns the number of times an icon was shown since the last call to this | 133 // Returns the number of times an icon was shown since the last call to this |
134 // method. | 134 // method. |
135 size_t GetAndResetShowIconCount() { | 135 size_t GetAndResetShowIconCount() { |
136 size_t result = show_icon_count_; | 136 size_t result = show_icon_count_; |
137 show_icon_count_ = 0u; | 137 show_icon_count_ = 0u; |
138 return result; | 138 return result; |
139 } | 139 } |
140 | 140 |
141 // Whether the custom icon is set. | 141 // Whether the custom icon is set. |
142 bool HasCustomIcon() const { | 142 bool HasCustomIcon() const { return !!last_custom_icon_; } |
143 return last_custom_icon_; | |
144 } | |
145 | 143 |
146 // If custom icon is set, returns the icon's id. | 144 // If custom icon is set, returns the icon's id. |
147 // If there is no icon, or if it doesn't have an id set, returns an empty | 145 // If there is no icon, or if it doesn't have an id set, returns an empty |
148 // string. | 146 // string. |
149 std::string GetCustomIconId() const { | 147 std::string GetCustomIconId() const { |
150 std::string result; | 148 std::string result; |
151 if (last_custom_icon_) | 149 if (last_custom_icon_) |
152 last_custom_icon_->GetString("id", &result); | 150 last_custom_icon_->GetString("id", &result); |
153 return result; | 151 return result; |
154 } | 152 } |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 state_handler_->RecordClickOnLockIcon(); | 740 state_handler_->RecordClickOnLockIcon(); |
743 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); | 741 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); |
744 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", | 742 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", |
745 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); | 743 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); |
746 histogram_tester.ExpectBucketCount( | 744 histogram_tester.ExpectBucketCount( |
747 "EasyUnlock.TrialRun.Events", | 745 "EasyUnlock.TrialRun.Events", |
748 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); | 746 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); |
749 } | 747 } |
750 | 748 |
751 } // namespace | 749 } // namespace |
OLD | NEW |