Moved Linux specific shell integration declarations into own header.

This continues refactoring started in http://codereview.chromium.org/9958006/

BUG=None
TEST=Refactor; covered by existing tests


Review URL: http://codereview.chromium.org/10097004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132489 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 4f9caced..f58b7e6 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -232,21 +232,6 @@
 
 }  // namespace
 
-// static
-std::string ShellIntegration::GetDesktopName(base::Environment* env) {
-#if defined(GOOGLE_CHROME_BUILD)
-  return "google-chrome.desktop";
-#else  // CHROMIUM_BUILD
-  // Allow $CHROME_DESKTOP to override the built-in value, so that development
-  // versions can set themselves as the default without interfering with
-  // non-official, packaged versions using the built-in value.
-  std::string name;
-  if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty())
-    return name;
-  return "chromium-browser.desktop";
-#endif
-}
-
 namespace {
 
 // Utility function to get the path to the version of a script shipped with
@@ -307,7 +292,7 @@
     argv.push_back(kXdgSettingsDefaultSchemeHandler);
     argv.push_back(protocol);
   }
-  argv.push_back(ShellIntegration::GetDesktopName(env.get()));
+  argv.push_back(ShellIntegrationLinux::GetDesktopName(env.get()));
 
   int exit_code;
   bool ran_ok = LaunchXdgUtility(argv, &exit_code);
@@ -338,7 +323,7 @@
     argv.push_back(kXdgSettingsDefaultSchemeHandler);
     argv.push_back(protocol);
   }
-  argv.push_back(ShellIntegration::GetDesktopName(env.get()));
+  argv.push_back(ShellIntegrationLinux::GetDesktopName(env.get()));
 
   std::string reply;
   int success_code;
@@ -402,9 +387,24 @@
   return browser.find("irefox") != std::string::npos;
 }
 
-// static
-bool ShellIntegration::GetDesktopShortcutTemplate(
-    base::Environment* env, std::string* output) {
+namespace ShellIntegrationLinux {
+
+std::string GetDesktopName(base::Environment* env) {
+#if defined(GOOGLE_CHROME_BUILD)
+  return "google-chrome.desktop";
+#else  // CHROMIUM_BUILD
+  // Allow $CHROME_DESKTOP to override the built-in value, so that development
+  // versions can set themselves as the default without interfering with
+  // non-official, packaged versions using the built-in value.
+  std::string name;
+  if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty())
+    return name;
+  return "chromium-browser.desktop";
+#endif
+}
+
+bool GetDesktopShortcutTemplate(base::Environment* env,
+                                std::string* output) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
 
   std::vector<FilePath> search_paths;
@@ -446,8 +446,7 @@
   return false;
 }
 
-// static
-FilePath ShellIntegration::GetDesktopShortcutFilename(const GURL& url) {
+FilePath GetDesktopShortcutFilename(const GURL& url) {
   // Use a prefix, because xdg-desktop-menu requires it.
   std::string filename =
       std::string(chrome::kBrowserProcessExecutableName) + "-" + url.spec();
@@ -471,8 +470,7 @@
   return FilePath();
 }
 
-// static
-std::string ShellIntegration::GetDesktopFileContents(
+std::string GetDesktopFileContents(
     const std::string& template_contents,
     const std::string& app_name,
     const GURL& url,
@@ -590,9 +588,8 @@
   return output_buffer;
 }
 
-// static
-bool ShellIntegration::CreateDesktopShortcut(
-    const ShortcutInfo& shortcut_info,
+bool CreateDesktopShortcut(
+    const ShellIntegration::ShortcutInfo& shortcut_info,
     const std::string& shortcut_template) {
   DCHECK(!shortcut_info.is_platform_app);
   DCHECK(shortcut_info.extension_id.empty());
@@ -601,24 +598,22 @@
       shortcut_info, FilePath(), shortcut_template);
 }
 
-namespace ShellIntegrationLinux {
-
 bool CreateDesktopShortcutForChromeApp(
     const ShellIntegration::ShortcutInfo& shortcut_info,
     const FilePath& web_app_path,
     const std::string& shortcut_template) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
 
-  FilePath shortcut_filename = ShellIntegration::GetDesktopShortcutFilename(
-      shortcut_info.url);
+  FilePath shortcut_filename =
+      ShellIntegrationLinux::GetDesktopShortcutFilename(shortcut_info.url);
   if (shortcut_filename.empty())
     return false;
 
-  std::string icon_name = CreateShortcutIcon(shortcut_info, shortcut_filename);
+  std::string icon_name =CreateShortcutIcon(shortcut_info, shortcut_filename);
 
   std::string app_name =
       web_app::GenerateApplicationNameFromInfo(shortcut_info);
-  std::string contents = ShellIntegration::GetDesktopFileContents(
+  std::string contents = ShellIntegrationLinux::GetDesktopFileContents(
       shortcut_template,
       app_name,
       shortcut_info.url,