| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/about_signin_internals.h" | 5 #include "chrome/browser/signin/about_signin_internals.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/hash.h" | 8 #include "base/hash.h" |
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 void AboutSigninInternals::NotifySigninValueChanged( | 54 void AboutSigninInternals::NotifySigninValueChanged( |
| 55 const TimedSigninStatusField& field, | 55 const TimedSigninStatusField& field, |
| 56 const std::string& value) { | 56 const std::string& value) { |
| 57 unsigned int field_index = field - TIMED_FIELDS_BEGIN; | 57 unsigned int field_index = field - TIMED_FIELDS_BEGIN; |
| 58 DCHECK(field_index >= 0 && | 58 DCHECK(field_index >= 0 && |
| 59 field_index < signin_status_.timed_signin_fields.size()); | 59 field_index < signin_status_.timed_signin_fields.size()); |
| 60 | 60 |
| 61 Time now = Time::NowFromSystemTime(); | 61 Time now = Time::NowFromSystemTime(); |
| 62 std::string time_as_str = UTF16ToUTF8(base::TimeFormatFriendlyDate(now)); | 62 std::string time_as_str = |
| 63 base::UTF16ToUTF8(base::TimeFormatFriendlyDate(now)); |
| 63 TimedSigninStatusValue timed_value(value, time_as_str); | 64 TimedSigninStatusValue timed_value(value, time_as_str); |
| 64 | 65 |
| 65 signin_status_.timed_signin_fields[field_index] = timed_value; | 66 signin_status_.timed_signin_fields[field_index] = timed_value; |
| 66 | 67 |
| 67 // Also persist these values in the prefs. | 68 // Also persist these values in the prefs. |
| 68 const std::string value_pref = SigninStatusFieldToString(field) + ".value"; | 69 const std::string value_pref = SigninStatusFieldToString(field) + ".value"; |
| 69 const std::string time_pref = SigninStatusFieldToString(field) + ".time"; | 70 const std::string time_pref = SigninStatusFieldToString(field) + ".time"; |
| 70 profile_->GetPrefs()->SetString(value_pref.c_str(), value); | 71 profile_->GetPrefs()->SetString(value_pref.c_str(), value); |
| 71 profile_->GetPrefs()->SetString(time_pref.c_str(), time_as_str); | 72 profile_->GetPrefs()->SetString(time_pref.c_str(), time_as_str); |
| 72 | 73 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 134 } |
| 134 | 135 |
| 135 Time AboutSigninInternals::GetTokenTime( | 136 Time AboutSigninInternals::GetTokenTime( |
| 136 const std::string& token_name) const { | 137 const std::string& token_name) const { |
| 137 TokenInfoMap::const_iterator iter = | 138 TokenInfoMap::const_iterator iter = |
| 138 signin_status_.token_info_map.find(token_name); | 139 signin_status_.token_info_map.find(token_name); |
| 139 if (iter == signin_status_.token_info_map.end()) | 140 if (iter == signin_status_.token_info_map.end()) |
| 140 return base::Time(); | 141 return base::Time(); |
| 141 return base::Time::FromInternalValue(iter->second.time_internal); | 142 return base::Time::FromInternalValue(iter->second.time_internal); |
| 142 } | 143 } |
| OLD | NEW |