Chromium Code Reviews| Index: chrome/browser/download/download_status_updater_win.cc |
| =================================================================== |
| --- chrome/browser/download/download_status_updater_win.cc (revision 160886) |
| +++ chrome/browser/download/download_status_updater_win.cc (working copy) |
| @@ -7,15 +7,18 @@ |
| #include <string> |
| #include <shobjidl.h> |
| +#include "base/file_path.h" |
| #include "base/logging.h" |
| #include "base/stl_util.h" |
| #include "base/string_number_conversions.h" |
| #include "base/win/metro.h" |
| #include "base/win/scoped_comptr.h" |
| #include "base/win/windows_version.h" |
| +#include "chrome/browser/platform_util.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_list.h" |
| #include "chrome/browser/ui/browser_window.h" |
| +#include "content/public/browser/browser_thread.h" |
| #include "googleurl/src/gurl.h" |
| #include "grit/generated_resources.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -67,20 +70,29 @@ |
| } |
| } |
| +void MetroDownloadNotificationClickedHandler(const wchar_t* download_path) { |
| + // Metro chrome will invoke these handlers on the metro thread. |
| + DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| + |
| + // Ensure that we invoke the function to display the downloaded item on the |
| + // UI thread. |
| + content::BrowserThread::PostTask( |
| + content::BrowserThread::UI, FROM_HERE, |
| + base::Bind(platform_util::ShowItemInFolder, FilePath(download_path))); |
| +} |
| + |
| } // namespace |
| void DownloadStatusUpdater::UpdateAppIconDownloadProgress( |
| content::DownloadItem* download) { |
| // Always update overall progress. |
| - |
| float progress = 0; |
| int download_count = 0; |
| bool progress_known = GetProgress(&progress, &download_count); |
| UpdateTaskbarProgressBar(download_count, progress_known, progress); |
| // Fire notifications when downloads complete. |
| - |
| if (!base::win::IsMetroProcess()) |
| return; |
| @@ -116,7 +128,9 @@ |
| title.c_str(), |
| body.c_str(), |
| L"", |
| - notification_id.c_str()); |
| + notification_id.c_str(), |
| + MetroDownloadNotificationClickedHandler, |
| + download->GetTargetFilePath().value().c_str()); |
|
cpu_(ooo_6.6-7.5)
2012/10/09 21:46:49
seems you are passing a pointer to a temporary str
ananta
2012/10/09 21:58:34
This is fine as the export in metro_driver copies
|
| } |
| } |