Chromium Code Reviews| 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_constants.h" | |
| 24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/installer/util/browser_distribution.h" | 26 #include "chrome/installer/util/browser_distribution.h" |
| 26 #include "chrome/installer/util/product.h" | 27 #include "chrome/installer/util/product.h" |
| 27 #include "chrome/installer/util/shell_util.h" | 28 #include "chrome/installer/util/shell_util.h" |
| 28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 29 #include "grit/chrome_unscaled_resources.h" | 30 #include "grit/chrome_unscaled_resources.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" |
| 32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
| 33 #include "ui/gfx/icon_util.h" | 34 #include "ui/gfx/icon_util.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 namespace internal { | 503 namespace internal { |
| 503 | 504 |
| 504 const char kProfileIconFileName[] = "Google Profile.ico"; | 505 const char kProfileIconFileName[] = "Google Profile.ico"; |
| 505 | 506 |
| 506 string16 GetShortcutFilenameForProfile(const string16& profile_name, | 507 string16 GetShortcutFilenameForProfile(const string16& profile_name, |
| 507 BrowserDistribution* distribution) { | 508 BrowserDistribution* distribution) { |
| 508 string16 shortcut_name; | 509 string16 shortcut_name; |
| 509 if (!profile_name.empty()) { | 510 if (!profile_name.empty()) { |
| 510 shortcut_name.append(SanitizeShortcutProfileNameString(profile_name)); | 511 shortcut_name.append(SanitizeShortcutProfileNameString(profile_name)); |
| 511 shortcut_name.append(L" - "); | 512 shortcut_name.append(L" - "); |
| 513 shortcut_name.append(chrome::kBrowserAppName); | |
|
sail
2013/02/05 20:30:43
Weird, I've never seen this constant before.
In th
Alexei Svitkine (slow)
2013/02/05 20:56:00
Done.
| |
| 514 } else { | |
| 515 shortcut_name.append(distribution->GetAppShortCutName()); | |
| 512 } | 516 } |
| 513 shortcut_name.append(distribution->GetAppShortCutName()); | |
| 514 return shortcut_name + installer::kLnkExt; | 517 return shortcut_name + installer::kLnkExt; |
| 515 } | 518 } |
| 516 | 519 |
| 517 string16 CreateProfileShortcutFlags(const FilePath& profile_path) { | 520 string16 CreateProfileShortcutFlags(const FilePath& profile_path) { |
| 518 return base::StringPrintf(L"--%ls=\"%ls\"", | 521 return base::StringPrintf(L"--%ls=\"%ls\"", |
| 519 ASCIIToUTF16(switches::kProfileDirectory).c_str(), | 522 ASCIIToUTF16(switches::kProfileDirectory).c_str(), |
| 520 profile_path.BaseName().value().c_str()); | 523 profile_path.BaseName().value().c_str()); |
| 521 } | 524 } |
| 522 | 525 |
| 523 } // namespace internal | 526 } // namespace internal |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 BrowserThread::PostTask( | 666 BrowserThread::PostTask( |
| 664 BrowserThread::FILE, FROM_HERE, | 667 BrowserThread::FILE, FROM_HERE, |
| 665 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, | 668 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, |
| 666 old_shortcut_appended_name, new_shortcut_appended_name, | 669 old_shortcut_appended_name, new_shortcut_appended_name, |
| 667 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, | 670 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, |
| 668 action)); | 671 action)); |
| 669 | 672 |
| 670 cache->SetShortcutNameOfProfileAtIndex(profile_index, | 673 cache->SetShortcutNameOfProfileAtIndex(profile_index, |
| 671 new_shortcut_appended_name); | 674 new_shortcut_appended_name); |
| 672 } | 675 } |
| OLD | NEW |