| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SHELL_INTEGRATION_H__ | 5 #ifndef CHROME_BROWSER_SHELL_INTEGRATION_H_ |
| 6 #define CHROME_BROWSER_SHELL_INTEGRATION_H__ | 6 #define CHROME_BROWSER_SHELL_INTEGRATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 | 15 |
| 16 class FilePath; | 16 class FilePath; |
| 17 | 17 |
| 18 #if defined(USE_X11) |
| 18 namespace base { | 19 namespace base { |
| 19 class EnvironmentVariableGetter; | 20 class EnvVarGetter; |
| 20 } | 21 } |
| 22 #endif |
| 21 | 23 |
| 22 class ShellIntegration { | 24 class ShellIntegration { |
| 23 public: | 25 public: |
| 24 // Sets Chrome as default browser (only for current user). Returns false if | 26 // Sets Chrome as default browser (only for current user). Returns false if |
| 25 // this operation fails. | 27 // this operation fails. |
| 26 static bool SetAsDefaultBrowser(); | 28 static bool SetAsDefaultBrowser(); |
| 27 | 29 |
| 28 // On Linux, it may not be possible to determine or set the default browser | 30 // On Linux, it may not be possible to determine or set the default browser |
| 29 // on some desktop environments or configurations. So, we use this enum and | 31 // on some desktop environments or configurations. So, we use this enum and |
| 30 // not a plain bool. (Note however that if used like a bool, this enum will | 32 // not a plain bool. (Note however that if used like a bool, this enum will |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 // Re-implementation of chrome_plugin_utill::CPB_GetCommandLineArgumentsCommon | 70 // Re-implementation of chrome_plugin_utill::CPB_GetCommandLineArgumentsCommon |
| 69 // which is deprecated. If |extension_app_id| is non-empty, an arguments | 71 // which is deprecated. If |extension_app_id| is non-empty, an arguments |
| 70 // string is created using the kAppId=<id> flag. Otherwise, the kApp=<url> is | 72 // string is created using the kAppId=<id> flag. Otherwise, the kApp=<url> is |
| 71 // used. | 73 // used. |
| 72 static std::string GetCommandLineArgumentsCommon(const GURL& url, | 74 static std::string GetCommandLineArgumentsCommon(const GURL& url, |
| 73 const string16& extension_app_id); | 75 const string16& extension_app_id); |
| 74 | 76 |
| 75 #if defined(USE_X11) | 77 #if defined(USE_X11) |
| 76 static bool GetDesktopShortcutTemplate( | 78 static bool GetDesktopShortcutTemplate(base::EnvVarGetter* env_getter, |
| 77 base::EnvironmentVariableGetter* env_getter, std::string* output); | 79 std::string* output); |
| 78 | 80 |
| 79 // Returns filename for .desktop file based on |url|, sanitized for security. | 81 // Returns filename for .desktop file based on |url|, sanitized for security. |
| 80 static FilePath GetDesktopShortcutFilename(const GURL& url); | 82 static FilePath GetDesktopShortcutFilename(const GURL& url); |
| 81 | 83 |
| 82 // Returns contents for .desktop file based on |template_contents|, |url| | 84 // Returns contents for .desktop file based on |template_contents|, |url| |
| 83 // and |title|. The |template_contents| should be contents of .desktop file | 85 // and |title|. The |template_contents| should be contents of .desktop file |
| 84 // used to launch Chrome. | 86 // used to launch Chrome. |
| 85 static std::string GetDesktopFileContents( | 87 static std::string GetDesktopFileContents( |
| 86 const std::string& template_contents, const GURL& url, | 88 const std::string& template_contents, const GURL& url, |
| 87 const string16& extension_id, const string16& title, | 89 const string16& extension_id, const string16& title, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Updates the UI in our associated view with the current default browser | 164 // Updates the UI in our associated view with the current default browser |
| 163 // state. | 165 // state. |
| 164 void UpdateUI(DefaultBrowserState state); | 166 void UpdateUI(DefaultBrowserState state); |
| 165 | 167 |
| 166 DefaultBrowserObserver* observer_; | 168 DefaultBrowserObserver* observer_; |
| 167 | 169 |
| 168 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker); | 170 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker); |
| 169 }; | 171 }; |
| 170 }; | 172 }; |
| 171 | 173 |
| 172 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H__ | 174 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H_ |
| OLD | NEW |