OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "ui/gfx/image/image_family.h" | 14 #include "ui/gfx/image/image_family.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
| 17 namespace base { |
17 class CommandLine; | 18 class CommandLine; |
| 19 } |
18 | 20 |
19 class ShellIntegration { | 21 class ShellIntegration { |
20 public: | 22 public: |
21 // Sets Chrome as the default browser (only for the current user). Returns | 23 // Sets Chrome as the default browser (only for the current user). Returns |
22 // false if this operation fails. | 24 // false if this operation fails. |
23 static bool SetAsDefaultBrowser(); | 25 static bool SetAsDefaultBrowser(); |
24 | 26 |
25 // Initiates an OS shell flow which (if followed by the user) should set | 27 // Initiates an OS shell flow which (if followed by the user) should set |
26 // Chrome as the default browser. Returns false if the flow cannot be | 28 // Chrome as the default browser. Returns false if the flow cannot be |
27 // initialized, if it is not supported (introduced for Windows 8) or if the | 29 // initialized, if it is not supported (introduced for Windows 8) or if the |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 static const AppModeInfo* AppModeInfo(); | 155 static const AppModeInfo* AppModeInfo(); |
154 | 156 |
155 // Is the current instance of Chrome running in App mode. | 157 // Is the current instance of Chrome running in App mode. |
156 bool IsRunningInAppMode(); | 158 bool IsRunningInAppMode(); |
157 | 159 |
158 // Set up command line arguments for launching a URL or an app. | 160 // Set up command line arguments for launching a URL or an app. |
159 // The new command line reuses the current process's user data directory (and | 161 // The new command line reuses the current process's user data directory (and |
160 // login profile, for ChromeOS). | 162 // login profile, for ChromeOS). |
161 // If |extension_app_id| is non-empty, the arguments use kAppId=<id>. | 163 // If |extension_app_id| is non-empty, the arguments use kAppId=<id>. |
162 // Otherwise, kApp=<url> is used. | 164 // Otherwise, kApp=<url> is used. |
163 static CommandLine CommandLineArgsForLauncher( | 165 static base::CommandLine CommandLineArgsForLauncher( |
164 const GURL& url, | 166 const GURL& url, |
165 const std::string& extension_app_id, | 167 const std::string& extension_app_id, |
166 const base::FilePath& profile_path); | 168 const base::FilePath& profile_path); |
167 | 169 |
168 // Append command line arguments for launching a new chrome.exe process | 170 // Append command line arguments for launching a new chrome.exe process |
169 // based on the current process. | 171 // based on the current process. |
170 // The new command line reuses the current process's user data directory and | 172 // The new command line reuses the current process's user data directory and |
171 // profile. | 173 // profile. |
172 static void AppendProfileArgs(const base::FilePath& profile_path, | 174 static void AppendProfileArgs(const base::FilePath& profile_path, |
173 CommandLine* command_line); | 175 base::CommandLine* command_line); |
174 | 176 |
175 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
176 // Generates an application user model ID (AppUserModelId) for a given app | 178 // Generates an application user model ID (AppUserModelId) for a given app |
177 // name and profile path. The returned app id is in the format of | 179 // name and profile path. The returned app id is in the format of |
178 // "|app_name|[.<profile_id>]". "profile_id" is appended when user override | 180 // "|app_name|[.<profile_id>]". "profile_id" is appended when user override |
179 // the default value. | 181 // the default value. |
180 // Note: If the app has an installation specific suffix (e.g. on user-level | 182 // Note: If the app has an installation specific suffix (e.g. on user-level |
181 // Chrome installs), |app_name| should already be suffixed, this method will | 183 // Chrome installs), |app_name| should already be suffixed, this method will |
182 // then further suffix it with the profile id as described above. | 184 // then further suffix it with the profile id as described above. |
183 static base::string16 GetAppModelIdForProfile(const base::string16& app_name, | 185 static base::string16 GetAppModelIdForProfile(const base::string16& app_name, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // Set Chrome as the default handler for this protocol. | 363 // Set Chrome as the default handler for this protocol. |
362 virtual bool SetAsDefault(bool interactive_permitted) OVERRIDE; | 364 virtual bool SetAsDefault(bool interactive_permitted) OVERRIDE; |
363 | 365 |
364 std::string protocol_; | 366 std::string protocol_; |
365 | 367 |
366 DISALLOW_COPY_AND_ASSIGN(DefaultProtocolClientWorker); | 368 DISALLOW_COPY_AND_ASSIGN(DefaultProtocolClientWorker); |
367 }; | 369 }; |
368 }; | 370 }; |
369 | 371 |
370 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H_ | 372 #endif // CHROME_BROWSER_SHELL_INTEGRATION_H_ |
OLD | NEW |