| 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/jumplist_win.h" | 5 #include "chrome/browser/jumplist_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (!PathService::Get(base::FILE_EXE, &chrome_path)) | 88 if (!PathService::Get(base::FILE_EXE, &chrome_path)) |
| 89 return false; | 89 return false; |
| 90 | 90 |
| 91 ShellLinkItemList items; | 91 ShellLinkItemList items; |
| 92 | 92 |
| 93 // Create an IShellLink object which launches Chrome, and add it to the | 93 // Create an IShellLink object which launches Chrome, and add it to the |
| 94 // collection. We use our application icon as the icon for this item. | 94 // collection. We use our application icon as the icon for this item. |
| 95 // We remove '&' characters from this string so we can share it with our | 95 // We remove '&' characters from this string so we can share it with our |
| 96 // system menu. | 96 // system menu. |
| 97 scoped_refptr<ShellLinkItem> chrome = CreateShellLink(); | 97 scoped_refptr<ShellLinkItem> chrome = CreateShellLink(); |
| 98 std::wstring chrome_title = | 98 base::string16 chrome_title = l10n_util::GetStringUTF16(IDS_NEW_WINDOW); |
| 99 base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_WINDOW)); | |
| 100 ReplaceSubstringsAfterOffset(&chrome_title, 0, L"&", L""); | 99 ReplaceSubstringsAfterOffset(&chrome_title, 0, L"&", L""); |
| 101 chrome->set_title(chrome_title); | 100 chrome->set_title(chrome_title); |
| 102 chrome->set_icon(chrome_path.value(), 0); | 101 chrome->set_icon(chrome_path.value(), 0); |
| 103 items.push_back(chrome); | 102 items.push_back(chrome); |
| 104 | 103 |
| 105 // Create an IShellLink object which launches Chrome in incognito mode, and | 104 // Create an IShellLink object which launches Chrome in incognito mode, and |
| 106 // add it to the collection. We use our application icon as the icon for | 105 // add it to the collection. We use our application icon as the icon for |
| 107 // this item. | 106 // this item. |
| 108 scoped_refptr<ShellLinkItem> incognito = CreateShellLink(); | 107 scoped_refptr<ShellLinkItem> incognito = CreateShellLink(); |
| 109 incognito->GetCommandLine()->AppendSwitch(switches::kIncognito); | 108 incognito->GetCommandLine()->AppendSwitch(switches::kIncognito); |
| 110 std::wstring incognito_title = | 109 base::string16 incognito_title = |
| 111 base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW)); | 110 l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW); |
| 112 ReplaceSubstringsAfterOffset(&incognito_title, 0, L"&", L""); | 111 ReplaceSubstringsAfterOffset(&incognito_title, 0, L"&", L""); |
| 113 incognito->set_title(incognito_title); | 112 incognito->set_title(incognito_title); |
| 114 incognito->set_icon(chrome_path.value(), 0); | 113 incognito->set_icon(chrome_path.value(), 0); |
| 115 items.push_back(incognito); | 114 items.push_back(incognito); |
| 116 | 115 |
| 117 return jumplist_updater->AddTasks(items); | 116 return jumplist_updater->AddTasks(items); |
| 118 } | 117 } |
| 119 | 118 |
| 120 // Updates the application JumpList. | 119 // Updates the application JumpList. |
| 121 bool UpdateJumpList(const wchar_t* app_id, | 120 bool UpdateJumpList(const wchar_t* app_id, |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 465 } |
| 467 | 466 |
| 468 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { | 467 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { |
| 469 for (ShellLinkItemList::const_iterator item = item_list.begin(); | 468 for (ShellLinkItemList::const_iterator item = item_list.begin(); |
| 470 item != item_list.end(); ++item) { | 469 item != item_list.end(); ++item) { |
| 471 base::FilePath icon_path; | 470 base::FilePath icon_path; |
| 472 if (CreateIconFile((*item)->icon_data(), icon_dir_, &icon_path)) | 471 if (CreateIconFile((*item)->icon_data(), icon_dir_, &icon_path)) |
| 473 (*item)->set_icon(icon_path.value(), 0); | 472 (*item)->set_icon(icon_path.value(), 0); |
| 474 } | 473 } |
| 475 } | 474 } |
| OLD | NEW |