Bug 846945 - Downloaded / saved files should be searchable from the Metro Search charm. r=jimm.
authorBrian R. Bondy <netzen@gmail.com>
Mon, 25 Mar 2013 19:27:51 -0400
changeset 126188 598104a2101bcab8307396230b650789844e8387
parent 126187 02547d0a4402072c9c713dc53f85c22f72953b9b
child 126189 f8c8f4386fe079b00047b112b7520278cfc92077
push id25336
push userbbondy@mozilla.com
push dateTue, 26 Mar 2013 00:36:09 +0000
treeherdermozilla-inbound@598104a2101b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs846945
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 846945 - Downloaded / saved files should be searchable from the Metro Search charm. r=jimm.
uriloader/exthandler/nsExternalHelperAppService.cpp
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -102,16 +102,20 @@
 
 #include "ContentChild.h"
 #include "nsXULAppAPI.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDocShellTreeItem.h"
 #include "ExternalHelperAppChild.h"
 
+#ifdef XP_WIN
+#include "nsWindowsHelpers.h"
+#endif
+
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #endif
 
 #include "mozilla/Preferences.h"
 #include "mozilla/ipc/URIUtils.h"
 
 using namespace mozilla;
@@ -341,16 +345,26 @@ static nsresult GetDownloadDirectory(nsI
     dir = do_QueryInterface(ldir);
   }
   else {
     return NS_ERROR_FAILURE;
   }
 #elif defined(MOZ_PLATFORM_MAEMO)
   nsresult rv = NS_GetSpecialDirectory(NS_UNIX_XDG_DOCUMENTS_DIR, getter_AddRefs(dir));
   NS_ENSURE_SUCCESS(rv, rv);
+#elif defined(XP_WIN)
+  // On metro we want to be able to search opened files and the temp directory
+  // is exlcuded in searches.
+  nsresult rv;
+  if (IsRunningInWindowsMetro()) {
+    rv = NS_GetSpecialDirectory(NS_WIN_DEFAULT_DOWNLOAD_DIR, getter_AddRefs(dir));
+  } else {
+    rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dir));
+  }
+  NS_ENSURE_SUCCESS(rv, rv);
 #else
   // On all other platforms, we default to the systems temporary directory.
   nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dir));
   NS_ENSURE_SUCCESS(rv, rv);
 #endif
 
   NS_ASSERTION(dir, "Somehow we didn't get a download directory!");
   dir.forget(_directory);