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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/win/shortcut.h" | 18 #include "base/win/shortcut.h" |
19 #include "chrome/browser/app_icon_win.h" | 19 #include "chrome/browser/app_icon_win.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 21 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
22 #include "chrome/browser/profiles/profile_info_util.h" | 22 #include "chrome/browser/profiles/profile_info_util.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/installer/util/browser_distribution.h" | 25 #include "chrome/installer/util/browser_distribution.h" |
26 #include "chrome/installer/util/product.h" | 26 #include "chrome/installer/util/product.h" |
27 #include "chrome/installer/util/shell_util.h" | 27 #include "chrome/installer/util/shell_util.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "grit/chrome_unscaled_resources.h" | 29 #include "grit/chrome_unscaled_resources.h" |
| 30 #include "grit/chromium_strings.h" |
30 #include "skia/ext/image_operations.h" | 31 #include "skia/ext/image_operations.h" |
31 #include "skia/ext/platform_canvas.h" | 32 #include "skia/ext/platform_canvas.h" |
| 33 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/gfx/icon_util.h" | 35 #include "ui/gfx/icon_util.h" |
34 #include "ui/gfx/image/image.h" | 36 #include "ui/gfx/image/image.h" |
35 #include "ui/gfx/rect.h" | 37 #include "ui/gfx/rect.h" |
36 #include "ui/gfx/skia_util.h" | 38 #include "ui/gfx/skia_util.h" |
37 | 39 |
38 using content::BrowserThread; | 40 using content::BrowserThread; |
39 | 41 |
40 namespace { | 42 namespace { |
41 | 43 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 namespace internal { | 504 namespace internal { |
503 | 505 |
504 const char kProfileIconFileName[] = "Google Profile.ico"; | 506 const char kProfileIconFileName[] = "Google Profile.ico"; |
505 | 507 |
506 string16 GetShortcutFilenameForProfile(const string16& profile_name, | 508 string16 GetShortcutFilenameForProfile(const string16& profile_name, |
507 BrowserDistribution* distribution) { | 509 BrowserDistribution* distribution) { |
508 string16 shortcut_name; | 510 string16 shortcut_name; |
509 if (!profile_name.empty()) { | 511 if (!profile_name.empty()) { |
510 shortcut_name.append(SanitizeShortcutProfileNameString(profile_name)); | 512 shortcut_name.append(SanitizeShortcutProfileNameString(profile_name)); |
511 shortcut_name.append(L" - "); | 513 shortcut_name.append(L" - "); |
| 514 shortcut_name.append(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
| 515 } else { |
| 516 shortcut_name.append(distribution->GetAppShortCutName()); |
512 } | 517 } |
513 shortcut_name.append(distribution->GetAppShortCutName()); | |
514 return shortcut_name + installer::kLnkExt; | 518 return shortcut_name + installer::kLnkExt; |
515 } | 519 } |
516 | 520 |
517 string16 CreateProfileShortcutFlags(const FilePath& profile_path) { | 521 string16 CreateProfileShortcutFlags(const FilePath& profile_path) { |
518 return base::StringPrintf(L"--%ls=\"%ls\"", | 522 return base::StringPrintf(L"--%ls=\"%ls\"", |
519 ASCIIToUTF16(switches::kProfileDirectory).c_str(), | 523 ASCIIToUTF16(switches::kProfileDirectory).c_str(), |
520 profile_path.BaseName().value().c_str()); | 524 profile_path.BaseName().value().c_str()); |
521 } | 525 } |
522 | 526 |
523 } // namespace internal | 527 } // namespace internal |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 BrowserThread::PostTask( | 667 BrowserThread::PostTask( |
664 BrowserThread::FILE, FROM_HERE, | 668 BrowserThread::FILE, FROM_HERE, |
665 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, | 669 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, |
666 old_shortcut_appended_name, new_shortcut_appended_name, | 670 old_shortcut_appended_name, new_shortcut_appended_name, |
667 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, | 671 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, |
668 action)); | 672 action)); |
669 | 673 |
670 cache->SetShortcutNameOfProfileAtIndex(profile_index, | 674 cache->SetShortcutNameOfProfileAtIndex(profile_index, |
671 new_shortcut_appended_name); | 675 new_shortcut_appended_name); |
672 } | 676 } |
OLD | NEW |