| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 #include <propkey.h> | 9 #include <propkey.h> |
| 10 #include <propvarutil.h> | 10 #include <propvarutil.h> |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 if (!PathService::Get(base::FILE_EXE, &chrome_path)) | 423 if (!PathService::Get(base::FILE_EXE, &chrome_path)) |
| 424 return false; | 424 return false; |
| 425 | 425 |
| 426 // Retrieve the command-line switches of this process. | 426 // Retrieve the command-line switches of this process. |
| 427 CommandLine command_line(CommandLine::NO_PROGRAM); | 427 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 428 FilePath user_data_dir = CommandLine::ForCurrentProcess()-> | 428 FilePath user_data_dir = CommandLine::ForCurrentProcess()-> |
| 429 GetSwitchValuePath(switches::kUserDataDir); | 429 GetSwitchValuePath(switches::kUserDataDir); |
| 430 if (!user_data_dir.empty()) | 430 if (!user_data_dir.empty()) |
| 431 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 431 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
| 432 | 432 |
| 433 std::wstring chrome_switches = command_line.command_line_string(); | 433 std::wstring chrome_switches = command_line.GetCommandLineString(); |
| 434 | 434 |
| 435 // We allocate 60% of the given JumpList slots to "most-visited" items | 435 // We allocate 60% of the given JumpList slots to "most-visited" items |
| 436 // and 40% to "recently-closed" items, respectively. | 436 // and 40% to "recently-closed" items, respectively. |
| 437 // Nevertheless, if there are not so many items in |recently_closed_pages|, | 437 // Nevertheless, if there are not so many items in |recently_closed_pages|, |
| 438 // we give the remaining slots to "most-visited" items. | 438 // we give the remaining slots to "most-visited" items. |
| 439 const int kMostVisited = 60; | 439 const int kMostVisited = 60; |
| 440 const int kRecentlyClosed = 40; | 440 const int kRecentlyClosed = 40; |
| 441 const int kTotal = kMostVisited + kRecentlyClosed; | 441 const int kTotal = kMostVisited + kRecentlyClosed; |
| 442 size_t most_visited_items = MulDiv(max_slots, kMostVisited, kTotal); | 442 size_t most_visited_items = MulDiv(max_slots, kMostVisited, kTotal); |
| 443 size_t recently_closed_items = max_slots - most_visited_items; | 443 size_t recently_closed_items = max_slots - most_visited_items; |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 // the file thread. | 779 // the file thread. |
| 780 BrowserThread::PostTask( | 780 BrowserThread::PostTask( |
| 781 BrowserThread::FILE, FROM_HERE, | 781 BrowserThread::FILE, FROM_HERE, |
| 782 new JumpListUpdateTask(app_id_.c_str(), icon_dir_, most_visited_pages_, | 782 new JumpListUpdateTask(app_id_.c_str(), icon_dir_, most_visited_pages_, |
| 783 recently_closed_pages_)); | 783 recently_closed_pages_)); |
| 784 | 784 |
| 785 // Delete all items in these lists since we don't need these lists any longer. | 785 // Delete all items in these lists since we don't need these lists any longer. |
| 786 most_visited_pages_.clear(); | 786 most_visited_pages_.clear(); |
| 787 recently_closed_pages_.clear(); | 787 recently_closed_pages_.clear(); |
| 788 } | 788 } |
| OLD | NEW |