Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2039)

Unified Diff: chrome/browser/profiles/profile_attributes_entry.cc

Issue 1242793005: Refactor most c/b/profiles calls to ProfileInfoCache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows unit test and ChromeOS build Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_attributes_entry.cc
diff --git a/chrome/browser/profiles/profile_attributes_entry.cc b/chrome/browser/profiles/profile_attributes_entry.cc
index 8c9757615c933feaeb5279174789b98d6d7d6b2e..f1ae0fb990c6875155c9703ffeb0b083c2b304b1 100644
--- a/chrome/browser/profiles/profile_attributes_entry.cc
+++ b/chrome/browser/profiles/profile_attributes_entry.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/i18n/case_conversion.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_info_cache.h"
@@ -138,6 +139,10 @@ void ProfileAttributesEntry::SetShortcutName(const base::string16& name) {
profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name);
}
+void ProfileAttributesEntry::SetActiveTime() {
+ profile_info_cache_->SetProfileActiveTimeAtIndex(profile_index());
+}
+
void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) {
profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted);
}
@@ -217,3 +222,17 @@ size_t ProfileAttributesEntry::profile_index() const {
DCHECK(index < profile_info_cache_->GetNumberOfProfiles());
return index;
}
+
+bool ProfileAttributesEntry::LessThan(const ProfileAttributesEntry& other)
+ const {
+ base::string16 lower_name = base::i18n::ToLower(GetName());
+ base::string16 other_lower_name = base::i18n::ToLower(other.GetName());
+
+ int name_compare = lower_name.compare(other_lower_name);
+
+ if (name_compare == 0) {
+ return profile_info_cache_->CacheKeyFromProfilePath(GetPath()).compare(
Mike Lerman 2015/08/06 16:06:19 Why not just run compare on GetPath() (or some der
+ profile_info_cache_->CacheKeyFromProfilePath(other.GetPath())) < 0;
+ }
+ return name_compare < 0;
+}

Powered by Google App Engine
This is Rietveld 408576698