OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Attempt to determine if this instance of Chrome is the default browser and | 34 // Attempt to determine if this instance of Chrome is the default browser and |
35 // return the appropriate state. (Defined as being the handler for HTTP/HTTPS | 35 // return the appropriate state. (Defined as being the handler for HTTP/HTTPS |
36 // protocols; we don't want to report "no" here if the user has simply chosen | 36 // protocols; we don't want to report "no" here if the user has simply chosen |
37 // to open HTML files in a text editor and FTP links with an FTP client.) | 37 // to open HTML files in a text editor and FTP links with an FTP client.) |
38 static DefaultBrowserState IsDefaultBrowser(); | 38 static DefaultBrowserState IsDefaultBrowser(); |
39 | 39 |
40 // Returns true if Firefox is likely to be the default browser for the current | 40 // Returns true if Firefox is likely to be the default browser for the current |
41 // user. This method is very fast so it can be invoked in the UI thread. | 41 // user. This method is very fast so it can be invoked in the UI thread. |
42 static bool IsFirefoxDefaultBrowser(); | 42 static bool IsFirefoxDefaultBrowser(); |
43 | 43 |
44 #if defined(OS_LINUX) | 44 #if defined(USE_X11) |
45 // Returns filename for .desktop file based on |url|, sanitized for security. | 45 // Returns filename for .desktop file based on |url|, sanitized for security. |
46 static FilePath GetDesktopShortcutFilename(const GURL& url); | 46 static FilePath GetDesktopShortcutFilename(const GURL& url); |
47 | 47 |
48 // Returns contents for .desktop file based on |template_contents|, |url| | 48 // Returns contents for .desktop file based on |template_contents|, |url| |
49 // and |title|. The |template_contents| should be contents of .desktop file | 49 // and |title|. The |template_contents| should be contents of .desktop file |
50 // used to launch Chrome. | 50 // used to launch Chrome. |
51 static std::string GetDesktopFileContents( | 51 static std::string GetDesktopFileContents( |
52 const std::string& template_contents, const GURL& url, | 52 const std::string& template_contents, const GURL& url, |
53 const string16& title); | 53 const string16& title); |
54 | 54 |
55 struct ShortcutInfo { | 55 struct ShortcutInfo { |
56 GURL url; | 56 GURL url; |
57 string16 title; | 57 string16 title; |
58 | 58 |
59 bool create_on_desktop; | 59 bool create_on_desktop; |
60 bool create_in_applications_menu; | 60 bool create_in_applications_menu; |
61 }; | 61 }; |
62 | 62 |
63 // Creates a desktop shortcut. It is not guaranteed to exist immediately after | 63 // Creates a desktop shortcut. It is not guaranteed to exist immediately after |
64 // returning from this function, because actual file operation is done on the | 64 // returning from this function, because actual file operation is done on the |
65 // file thread. | 65 // file thread. |
66 static void CreateDesktopShortcut(const ShortcutInfo& shortcut_info); | 66 static void CreateDesktopShortcut(const ShortcutInfo& shortcut_info); |
67 #endif // defined(OS_LINUX) | 67 #endif // defined(USE_X11) |
68 | 68 |
69 // The current default browser UI state | 69 // The current default browser UI state |
70 enum DefaultBrowserUIState { | 70 enum DefaultBrowserUIState { |
71 STATE_PROCESSING, | 71 STATE_PROCESSING, |
72 STATE_NOT_DEFAULT, | 72 STATE_NOT_DEFAULT, |
73 STATE_IS_DEFAULT, | 73 STATE_IS_DEFAULT, |
74 STATE_UNKNOWN | 74 STATE_UNKNOWN |
75 }; | 75 }; |
76 | 76 |
77 class DefaultBrowserObserver { | 77 class DefaultBrowserObserver { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 DefaultBrowserObserver* observer_; | 122 DefaultBrowserObserver* observer_; |
123 | 123 |
124 MessageLoop* ui_loop_; | 124 MessageLoop* ui_loop_; |
125 MessageLoop* file_loop_; | 125 MessageLoop* file_loop_; |
126 | 126 |
127 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker); | 127 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker); |
128 }; | 128 }; |
129 }; | 129 }; |
130 | 130 |
131 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H__ | 131 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H__ |
OLD | NEW |