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

Side by Side Diff: chrome/browser/profiles/profile_avatar_icon_util.cc

Issue 2779893005: Continue to clean c_str() calls. (Closed)
Patch Set: Revert changes in font_service_app.cc Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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/profiles/profile_avatar_icon_util.h" 5 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 if (!file_name.empty()) { 538 if (!file_name.empty()) {
539 pos = old_path.find(file_name); 539 pos = old_path.find(file_name);
540 end = pos - 1; 540 end = pos - 1;
541 } 541 }
542 } 542 }
543 543
544 if (pos != std::string::npos) { 544 if (pos != std::string::npos) {
545 std::string new_path = old_path.substr(0, pos) + new_size_component + 545 std::string new_path = old_path.substr(0, pos) + new_size_component +
546 old_path.substr(end); 546 old_path.substr(end);
547 GURL::Replacements replacement; 547 GURL::Replacements replacement;
548 replacement.SetPathStr(new_path.c_str()); 548 replacement.SetPathStr(new_path);
549 *new_url = old_url.ReplaceComponents(replacement); 549 *new_url = old_url.ReplaceComponents(replacement);
550 return new_url->is_valid(); 550 return new_url->is_valid();
551 } 551 }
552 552
553 // We can't set the image size, just use the default size. 553 // We can't set the image size, just use the default size.
554 *new_url = old_url; 554 *new_url = old_url;
555 return true; 555 return true;
556 } 556 }
557 557
558 std::unique_ptr<base::ListValue> GetDefaultProfileAvatarIconsAndLabels() { 558 std::unique_ptr<base::ListValue> GetDefaultProfileAvatarIconsAndLabels() {
559 std::unique_ptr<base::ListValue> avatars(new base::ListValue()); 559 std::unique_ptr<base::ListValue> avatars(new base::ListValue());
560 560
561 const size_t placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex(); 561 const size_t placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex();
562 for (size_t i = 0; i < profiles::GetDefaultAvatarIconCount() && 562 for (size_t i = 0; i < profiles::GetDefaultAvatarIconCount() &&
563 i != placeholder_avatar_index; 563 i != placeholder_avatar_index;
564 ++i) { 564 ++i) {
565 std::unique_ptr<base::DictionaryValue> avatar_info( 565 std::unique_ptr<base::DictionaryValue> avatar_info(
566 new base::DictionaryValue()); 566 new base::DictionaryValue());
567 avatar_info->SetString("url", profiles::GetDefaultAvatarIconUrl(i)); 567 avatar_info->SetString("url", profiles::GetDefaultAvatarIconUrl(i));
568 avatar_info->SetString( 568 avatar_info->SetString(
569 "label", l10n_util::GetStringUTF16( 569 "label", l10n_util::GetStringUTF16(
570 profiles::GetDefaultAvatarLabelResourceIDAtIndex(i))); 570 profiles::GetDefaultAvatarLabelResourceIDAtIndex(i)));
571 571
572 avatars->Append(std::move(avatar_info)); 572 avatars->Append(std::move(avatar_info));
573 } 573 }
574 return avatars; 574 return avatars;
575 } 575 }
576 576
577 } // namespace profiles 577 } // namespace profiles
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_metrics_service.cc ('k') | chrome/browser/supervised_user/experimental/safe_search_url_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698