OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 ShellLinkItemList items; | 102 ShellLinkItemList items; |
103 | 103 |
104 // Create an IShellLink object which launches Chrome, and add it to the | 104 // Create an IShellLink object which launches Chrome, and add it to the |
105 // collection. We use our application icon as the icon for this item. | 105 // collection. We use our application icon as the icon for this item. |
106 // We remove '&' characters from this string so we can share it with our | 106 // We remove '&' characters from this string so we can share it with our |
107 // system menu. | 107 // system menu. |
108 if (incognito_availability != IncognitoModePrefs::FORCED) { | 108 if (incognito_availability != IncognitoModePrefs::FORCED) { |
109 scoped_refptr<ShellLinkItem> chrome = CreateShellLink(); | 109 scoped_refptr<ShellLinkItem> chrome = CreateShellLink(); |
110 base::string16 chrome_title = l10n_util::GetStringUTF16(IDS_NEW_WINDOW); | 110 base::string16 chrome_title = l10n_util::GetStringUTF16(IDS_NEW_WINDOW); |
111 ReplaceSubstringsAfterOffset(&chrome_title, 0, L"&", L""); | 111 base::ReplaceSubstringsAfterOffset( |
| 112 &chrome_title, 0, L"&", base::StringPiece16()); |
112 chrome->set_title(chrome_title); | 113 chrome->set_title(chrome_title); |
113 chrome->set_icon(chrome_path.value(), 0); | 114 chrome->set_icon(chrome_path.value(), 0); |
114 items.push_back(chrome); | 115 items.push_back(chrome); |
115 } | 116 } |
116 | 117 |
117 // Create an IShellLink object which launches Chrome in incognito mode, and | 118 // Create an IShellLink object which launches Chrome in incognito mode, and |
118 // add it to the collection. We use our application icon as the icon for | 119 // add it to the collection. We use our application icon as the icon for |
119 // this item. | 120 // this item. |
120 if (incognito_availability != IncognitoModePrefs::DISABLED) { | 121 if (incognito_availability != IncognitoModePrefs::DISABLED) { |
121 scoped_refptr<ShellLinkItem> incognito = CreateShellLink(); | 122 scoped_refptr<ShellLinkItem> incognito = CreateShellLink(); |
122 incognito->GetCommandLine()->AppendSwitch(switches::kIncognito); | 123 incognito->GetCommandLine()->AppendSwitch(switches::kIncognito); |
123 base::string16 incognito_title = | 124 base::string16 incognito_title = |
124 l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW); | 125 l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW); |
125 ReplaceSubstringsAfterOffset(&incognito_title, 0, L"&", L""); | 126 base::ReplaceSubstringsAfterOffset( |
| 127 &incognito_title, 0, L"&", base::StringPiece16()); |
126 incognito->set_title(incognito_title); | 128 incognito->set_title(incognito_title); |
127 incognito->set_icon(chrome_path.value(), 0); | 129 incognito->set_icon(chrome_path.value(), 0); |
128 items.push_back(incognito); | 130 items.push_back(incognito); |
129 } | 131 } |
130 | 132 |
131 return jumplist_updater->AddTasks(items); | 133 return jumplist_updater->AddTasks(items); |
132 } | 134 } |
133 | 135 |
134 // Updates the application JumpList. | 136 // Updates the application JumpList. |
135 bool UpdateJumpList(const wchar_t* app_id, | 137 bool UpdateJumpList(const wchar_t* app_id, |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 528 |
527 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 529 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
528 } | 530 } |
529 | 531 |
530 void JumpList::TopSitesChanged(history::TopSites* top_sites) { | 532 void JumpList::TopSitesChanged(history::TopSites* top_sites) { |
531 top_sites->GetMostVisitedURLs( | 533 top_sites->GetMostVisitedURLs( |
532 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 534 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
533 weak_ptr_factory_.GetWeakPtr()), | 535 weak_ptr_factory_.GetWeakPtr()), |
534 false); | 536 false); |
535 } | 537 } |
OLD | NEW |