Linux desktop and icon files: Replace spaces with underscores.

Filenames with spaces break xdg-desktop-menu, meaning we can't install shortcuts
for non-default profiles (which have spaces in them).

TEST=Create an Applications Menu shortcut in a secondary profile. Ensure that
the application can be launched from the Unity launcher or similar.
BUG=257280

Review URL: https://chromiumcodereview.appspot.com/18533009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210752 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 8ef33207..b84d295 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -29,6 +29,7 @@
 #include "base/process_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_tokenizer.h"
+#include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/thread.h"
 #include "base/threading/thread_restrictions.h"
@@ -648,6 +649,9 @@
       .append("-")
       .append(profile_path.BaseName().value());
   file_util::ReplaceIllegalCharactersInPath(&filename, '_');
+  // Spaces in filenames break xdg-desktop-menu
+  // (see https://bugs.freedesktop.org/show_bug.cgi?id=66605).
+  ReplaceChars(filename, " ", "_", &filename);
   return base::FilePath(filename.append(".desktop"));
 }