Chromium Code Reviews| Index: chrome/browser/win/jumplist.cc |
| diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc |
| index 6dad5579697389d68a137d050de08c7ae6b97199..60d06ba7478d6b522f6bfc4c079a62eef4943d86 100644 |
| --- a/chrome/browser/win/jumplist.cc |
| +++ b/chrome/browser/win/jumplist.cc |
| @@ -188,7 +188,7 @@ bool UpdateTaskCategory( |
| // left as-is, while any non-timeout error results in the old jumplist being |
| // left as-is, but without icon files. |
| bool UpdateJumpList(const wchar_t* app_id, |
| - const base::FilePath& icon_dir, |
| + const Profile* profile, |
| const ShellLinkItemList& most_visited_pages, |
| const ShellLinkItemList& recently_closed_pages, |
| bool most_visited_pages_have_updates, |
| @@ -243,8 +243,8 @@ bool UpdateJumpList(const wchar_t* app_id, |
| if (most_visited_pages_have_updates) { |
| // Delete the content in JumpListIconsMostVisited folder and log the results |
| // to UMA. |
| - base::FilePath icon_dir_most_visited = icon_dir.DirName().Append( |
| - icon_dir.BaseName().value() + FILE_PATH_LITERAL("MostVisited")); |
| + base::FilePath icon_dir_most_visited = profile->GetPath().Append( |
|
grt (UTC plus 2)
2017/05/01 09:22:56
a Profile* may only be used on the UI thread. you
chengx
2017/05/03 05:47:01
Done. I've updated to pass the profile path.
|
| + chrome::kJumpListIconDirname + FILE_PATH_LITERAL("MostVisited")); |
| DeleteDirectoryContentAndLogResults(icon_dir_most_visited, |
| kFileDeleteLimit); |
| @@ -265,8 +265,8 @@ bool UpdateJumpList(const wchar_t* app_id, |
| if (recently_closed_pages_have_updates) { |
| // Delete the content in JumpListIconsRecentClosed folder and log the |
| // results to UMA. |
| - base::FilePath icon_dir_recent_closed = icon_dir.DirName().Append( |
| - icon_dir.BaseName().value() + FILE_PATH_LITERAL("RecentClosed")); |
| + base::FilePath icon_dir_recent_closed = profile->GetPath().Append( |
| + chrome::kJumpListIconDirname + FILE_PATH_LITERAL("RecentClosed")); |
| DeleteDirectoryContentAndLogResults(icon_dir_recent_closed, |
| kFileDeleteLimit); |
| @@ -309,7 +309,7 @@ bool UpdateJumpList(const wchar_t* app_id, |
| // Updates the jumplist, once all the data has been fetched. |
| void RunUpdateJumpList(IncognitoModePrefs::Availability incognito_availability, |
| const std::wstring& app_id, |
| - const base::FilePath& icon_dir, |
| + const Profile* profile, |
| base::RefCountedData<JumpListData>* ref_counted_data) { |
| JumpListData* data = &ref_counted_data->data; |
| ShellLinkItemList local_most_visited_pages; |
| @@ -344,7 +344,7 @@ void RunUpdateJumpList(IncognitoModePrefs::Availability incognito_availability, |
| // they were so that the corresponding JumpList categories will be tried to |
| // update again in the next run. |
| if (!UpdateJumpList( |
| - app_id.c_str(), icon_dir, local_most_visited_pages, |
| + app_id.c_str(), profile, local_most_visited_pages, |
| local_recently_closed_pages, most_visited_pages_have_updates, |
| recently_closed_pages_have_updates, incognito_availability)) { |
| base::AutoLock auto_lock(data->list_lock_); |
| @@ -394,7 +394,6 @@ JumpList::JumpList(Profile* profile) |
| app_id_ = |
| shell_integration::win::GetChromiumModelIdForProfile(profile_->GetPath()); |
| - icon_dir_ = profile_->GetPath().Append(chrome::kJumpListIconDirname); |
| scoped_refptr<history::TopSites> top_sites = |
| TopSitesFactory::GetForProfile(profile_); |
| @@ -680,18 +679,21 @@ void JumpList::DeferredRunUpdate() { |
| // 2) create new icons, 3) notify the OS. |
| update_jumplist_task_runner_->PostTask( |
| FROM_HERE, base::Bind(&RunUpdateJumpList, incognito_availability, app_id_, |
| - icon_dir_, base::RetainedRef(jumplist_data_))); |
| + profile_, base::RetainedRef(jumplist_data_))); |
| // Post a task to delete JumpListIcons folder as it's no longer needed. |
| // Now we have JumpListIconsMostVisited folder and JumpListIconsRecentClosed |
| // folder instead. |
| + base::FilePath icon_dir = |
| + profile_->GetPath().Append(chrome::kJumpListIconDirname); |
| + |
| delete_jumplisticons_task_runner_->PostTask( |
| FROM_HERE, |
| - base::Bind(&DeleteDirectoryAndLogResults, icon_dir_, kFileDeleteLimit)); |
| + base::Bind(&DeleteDirectoryAndLogResults, icon_dir, kFileDeleteLimit)); |
| // Post a task to delete JumpListIconsOld folder as it's no longer needed. |
| - base::FilePath icon_dir_old = icon_dir_.DirName().Append( |
| - icon_dir_.BaseName().value() + FILE_PATH_LITERAL("Old")); |
| + base::FilePath icon_dir_old = profile_->GetPath().Append( |
| + chrome::kJumpListIconDirname + FILE_PATH_LITERAL("Old")); |
| delete_jumplisticons_task_runner_->PostTask( |
| FROM_HERE, base::Bind(&DeleteDirectoryAndLogResults, |