Chromium Code Reviews| 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/win/jumplist.h" | 5 #include "chrome/browser/win/jumplist.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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
| 19 #include "chrome/browser/favicon/favicon_service_factory.h" | 19 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 20 #include "chrome/browser/history/top_sites_factory.h" | 20 #include "chrome/browser/history/top_sites_factory.h" |
| 21 #include "chrome/browser/metrics/jumplist_metrics_win.h" | 21 #include "chrome/browser/metrics/jumplist_metrics_win.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 23 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 24 #include "chrome/browser/shell_integration_win.h" | 24 #include "chrome/browser/shell_integration_win.h" |
| 25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 26 #include "chrome/common/chrome_icon_resources_win.h" | |
| 26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| 30 #include "chrome/installer/util/browser_distribution.h" | 31 #include "chrome/installer/util/browser_distribution.h" |
| 31 #include "components/favicon/core/favicon_service.h" | 32 #include "components/favicon/core/favicon_service.h" |
| 32 #include "components/favicon_base/favicon_types.h" | 33 #include "components/favicon_base/favicon_types.h" |
| 33 #include "components/history/core/browser/history_service.h" | 34 #include "components/history/core/browser/history_service.h" |
| 34 #include "components/history/core/browser/page_usage_data.h" | 35 #include "components/history/core/browser/page_usage_data.h" |
| 35 #include "components/history/core/browser/top_sites.h" | 36 #include "components/history/core/browser/top_sites.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 scoped_refptr<ShellLinkItem> chrome = CreateShellLink(); | 131 scoped_refptr<ShellLinkItem> chrome = CreateShellLink(); |
| 131 base::string16 chrome_title = l10n_util::GetStringUTF16(IDS_NEW_WINDOW); | 132 base::string16 chrome_title = l10n_util::GetStringUTF16(IDS_NEW_WINDOW); |
| 132 base::ReplaceSubstringsAfterOffset( | 133 base::ReplaceSubstringsAfterOffset( |
| 133 &chrome_title, 0, L"&", base::StringPiece16()); | 134 &chrome_title, 0, L"&", base::StringPiece16()); |
| 134 chrome->set_title(chrome_title); | 135 chrome->set_title(chrome_title); |
| 135 chrome->set_icon(chrome_path.value(), icon_index); | 136 chrome->set_icon(chrome_path.value(), icon_index); |
| 136 items.push_back(chrome); | 137 items.push_back(chrome); |
| 137 } | 138 } |
| 138 | 139 |
| 139 // Create an IShellLink object which launches Chrome in incognito mode, and | 140 // Create an IShellLink object which launches Chrome in incognito mode, and |
| 140 // add it to the collection. We use our application icon as the icon for | 141 // add it to the collection. We use our application icon as the icon for |
|
elawrence
2017/01/30 16:05:28
Comment is now out of date, and the second sentenc
Ramin Halavati
2017/01/31 07:02:10
Done.
| |
| 141 // this item. | 142 // this item. |
| 142 if (incognito_availability != IncognitoModePrefs::DISABLED) { | 143 if (incognito_availability != IncognitoModePrefs::DISABLED) { |
| 143 scoped_refptr<ShellLinkItem> incognito = CreateShellLink(); | 144 scoped_refptr<ShellLinkItem> incognito = CreateShellLink(); |
| 144 incognito->GetCommandLine()->AppendSwitch(switches::kIncognito); | 145 incognito->GetCommandLine()->AppendSwitch(switches::kIncognito); |
| 145 base::string16 incognito_title = | 146 base::string16 incognito_title = |
| 146 l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW); | 147 l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW); |
| 147 base::ReplaceSubstringsAfterOffset( | 148 base::ReplaceSubstringsAfterOffset( |
| 148 &incognito_title, 0, L"&", base::StringPiece16()); | 149 &incognito_title, 0, L"&", base::StringPiece16()); |
| 149 incognito->set_title(incognito_title); | 150 incognito->set_title(incognito_title); |
| 150 incognito->set_icon(chrome_path.value(), icon_index); | 151 incognito->set_icon(chrome_path.value(), icon_resources::kIncognitoIndex); |
| 151 items.push_back(incognito); | 152 items.push_back(incognito); |
| 152 } | 153 } |
| 153 | 154 |
| 154 return jumplist_updater->AddTasks(items); | 155 return jumplist_updater->AddTasks(items); |
| 155 } | 156 } |
| 156 | 157 |
| 157 // Updates the application JumpList. | 158 // Updates the application JumpList. |
| 158 bool UpdateJumpList(const wchar_t* app_id, | 159 bool UpdateJumpList(const wchar_t* app_id, |
| 159 const ShellLinkItemList& most_visited_pages, | 160 const ShellLinkItemList& most_visited_pages, |
| 160 const ShellLinkItemList& recently_closed_pages, | 161 const ShellLinkItemList& recently_closed_pages, |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 609 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
| 609 } | 610 } |
| 610 | 611 |
| 611 void JumpList::TopSitesChanged(history::TopSites* top_sites, | 612 void JumpList::TopSitesChanged(history::TopSites* top_sites, |
| 612 ChangeReason change_reason) { | 613 ChangeReason change_reason) { |
| 613 top_sites->GetMostVisitedURLs( | 614 top_sites->GetMostVisitedURLs( |
| 614 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 615 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
| 615 weak_ptr_factory_.GetWeakPtr()), | 616 weak_ptr_factory_.GetWeakPtr()), |
| 616 false); | 617 false); |
| 617 } | 618 } |
| OLD | NEW |