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/profiles/profile_shortcut_manager_win.h" | 5 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
6 | 6 |
7 #include <shlobj.h> // For SHChangeNotify(). | 7 #include <shlobj.h> // For SHChangeNotify(). |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 // characters. | 589 // characters. |
590 base::string16 SanitizeShortcutProfileNameString( | 590 base::string16 SanitizeShortcutProfileNameString( |
591 const base::string16& profile_name) { | 591 const base::string16& profile_name) { |
592 base::string16 sanitized = profile_name; | 592 base::string16 sanitized = profile_name; |
593 size_t pos = sanitized.find_first_of(kReservedCharacters); | 593 size_t pos = sanitized.find_first_of(kReservedCharacters); |
594 while (pos != base::string16::npos) { | 594 while (pos != base::string16::npos) { |
595 sanitized[pos] = L' '; | 595 sanitized[pos] = L' '; |
596 pos = sanitized.find_first_of(kReservedCharacters, pos + 1); | 596 pos = sanitized.find_first_of(kReservedCharacters, pos + 1); |
597 } | 597 } |
598 | 598 |
599 TrimWhitespace(sanitized, TRIM_LEADING, &sanitized); | 599 base::TrimWhitespace(sanitized, base::TRIM_LEADING, &sanitized); |
600 if (sanitized.size() > kMaxProfileShortcutFileNameLength) | 600 if (sanitized.size() > kMaxProfileShortcutFileNameLength) |
601 sanitized.erase(kMaxProfileShortcutFileNameLength); | 601 sanitized.erase(kMaxProfileShortcutFileNameLength); |
602 TrimWhitespace(sanitized, TRIM_TRAILING, &sanitized); | 602 base::TrimWhitespace(sanitized, base::TRIM_TRAILING, &sanitized); |
603 | 603 |
604 return sanitized; | 604 return sanitized; |
605 } | 605 } |
606 | 606 |
607 // Returns a copied SkBitmap for the given resource id that can be safely passed | 607 // Returns a copied SkBitmap for the given resource id that can be safely passed |
608 // to another thread. | 608 // to another thread. |
609 SkBitmap GetImageResourceSkBitmapCopy(int resource_id) { | 609 SkBitmap GetImageResourceSkBitmapCopy(int resource_id) { |
610 const gfx::Image image = | 610 const gfx::Image image = |
611 ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); | 611 ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); |
612 DCHECK(!image.IsEmpty()); | 612 DCHECK(!image.IsEmpty()); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 // Ensure the profile's icon file has been created. | 855 // Ensure the profile's icon file has been created. |
856 CreateOrUpdateProfileIcon(profile->GetPath()); | 856 CreateOrUpdateProfileIcon(profile->GetPath()); |
857 } | 857 } |
858 break; | 858 break; |
859 } | 859 } |
860 default: | 860 default: |
861 NOTREACHED(); | 861 NOTREACHED(); |
862 break; | 862 break; |
863 } | 863 } |
864 } | 864 } |
OLD | NEW |