Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1025)

Unified Diff: chrome/browser/download/download_status_updater_win.cc

Issue 11096013: Add functionality to the Windows 8 notification display functionality to invoke a caller specified … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win/metro.h ('k') | chrome/browser/ui/views/status_icons/status_icon_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
}
« no previous file with comments | « base/win/metro.h ('k') | chrome/browser/ui/views/status_icons/status_icon_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698