Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chrome/browser/shell_integration.h

Issue 164280: First step to create application shortcuts on Linux. (Closed)
Patch Set: now tested Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/string16.h"
11 13
14 class FilePath;
15 class GURL;
12 class MessageLoop; 16 class MessageLoop;
13 17
14 class ShellIntegration { 18 class ShellIntegration {
15 public: 19 public:
16 // Sets Chrome as default browser (only for current user). Returns false if 20 // Sets Chrome as default browser (only for current user). Returns false if
17 // this operation fails. 21 // this operation fails.
18 static bool SetAsDefaultBrowser(); 22 static bool SetAsDefaultBrowser();
19 23
20 // Returns true if this instance of Chrome is the default browser. (Defined 24 // Returns true if this instance of Chrome is the default browser. (Defined
21 // as being the handler for the http/https protocols... we don't want to 25 // as being the handler for the http/https protocols... we don't want to
22 // report false here if the user has simply chosen to open HTML files in a 26 // report false here if the user has simply chosen to open HTML files in a
23 // text editor and ftp links with a FTP client). 27 // text editor and ftp links with a FTP client).
24 static bool IsDefaultBrowser(); 28 static bool IsDefaultBrowser();
25 29
26 // Returns true if Firefox is likely to be the default browser for the current 30 // Returns true if Firefox is likely to be the default browser for the current
27 // user. This method is very fast so it can be invoked in the UI thread. 31 // user. This method is very fast so it can be invoked in the UI thread.
28 static bool IsFirefoxDefaultBrowser(); 32 static bool IsFirefoxDefaultBrowser();
29 33
34 #if defined(OS_LINUX)
35 // Returns filename for .desktop file based on |url|, sanitized for security.
36 static FilePath GetDesktopShortcutFilename(const GURL& url);
37
38 // Returns contents for .desktop file based on |template_contents|, |url|
39 // and |title|. The |template_contents| should be contents of .desktop file
40 // used to launch Chrome.
41 static std::string GetDesktopFileContents(
42 const std::string& template_contents, const GURL& url,
43 const string16& title);
44
45 // Creates a desktop shortcut for |url| with |title|. It is not guaranteed
46 // to exist immediately after returning from this function, because actual
47 // file operation is done on the file thread.
48 static void CreateDesktopShortcut(const GURL& url, const string16& title);
49 #endif // defined(OS_LINUX)
30 50
31 // The current default browser UI state 51 // The current default browser UI state
32 enum DefaultBrowserUIState { 52 enum DefaultBrowserUIState {
33 STATE_PROCESSING, 53 STATE_PROCESSING,
34 STATE_DEFAULT, 54 STATE_DEFAULT,
35 STATE_NOT_DEFAULT 55 STATE_NOT_DEFAULT
36 }; 56 };
37 57
38 class DefaultBrowserObserver { 58 class DefaultBrowserObserver {
39 public: 59 public:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 DefaultBrowserObserver* observer_; 103 DefaultBrowserObserver* observer_;
84 104
85 MessageLoop* ui_loop_; 105 MessageLoop* ui_loop_;
86 MessageLoop* file_loop_; 106 MessageLoop* file_loop_;
87 107
88 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker); 108 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserWorker);
89 }; 109 };
90 }; 110 };
91 111
92 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H__ 112 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698