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

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

Issue 10915079: remove --enable-experimental-extension-apis from packaged app shortcut args (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: is_platform_app data member on ShortcutInfo no longer required Created 8 years, 3 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
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/shell_integration_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/shell_integration.h" 5 #include "chrome/browser/shell_integration.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 18
19 using content::BrowserThread; 19 using content::BrowserThread;
20 20
21 ShellIntegration::DefaultWebClientSetPermission 21 ShellIntegration::DefaultWebClientSetPermission
22 ShellIntegration::CanSetAsDefaultProtocolClient() { 22 ShellIntegration::CanSetAsDefaultProtocolClient() {
23 // Allowed as long as the browser can become the operating system default 23 // Allowed as long as the browser can become the operating system default
24 // browser. 24 // browser.
25 return CanSetAsDefaultBrowser(); 25 return CanSetAsDefaultBrowser();
26 } 26 }
27 27
28 ShellIntegration::ShortcutInfo::ShortcutInfo() 28 ShellIntegration::ShortcutInfo::ShortcutInfo()
29 : is_platform_app(false), 29 : create_on_desktop(false),
30 create_on_desktop(false),
31 create_in_applications_menu(false), 30 create_in_applications_menu(false),
32 create_in_quick_launch_bar(false) { 31 create_in_quick_launch_bar(false) {
33 } 32 }
34 33
35 ShellIntegration::ShortcutInfo::~ShortcutInfo() {} 34 ShellIntegration::ShortcutInfo::~ShortcutInfo() {}
36 35
37 static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL; 36 static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL;
38 37
39 // static 38 // static
40 void ShellIntegration::SetAppModeInfo(const struct AppModeInfo* info) { 39 void ShellIntegration::SetAppModeInfo(const struct AppModeInfo* info) {
41 gAppModeInfo = info; 40 gAppModeInfo = info;
42 } 41 }
43 42
44 // static 43 // static
45 const struct ShellIntegration::AppModeInfo* ShellIntegration::AppModeInfo() { 44 const struct ShellIntegration::AppModeInfo* ShellIntegration::AppModeInfo() {
46 return gAppModeInfo; 45 return gAppModeInfo;
47 } 46 }
48 47
49 // static 48 // static
50 bool ShellIntegration::IsRunningInAppMode() { 49 bool ShellIntegration::IsRunningInAppMode() {
51 return gAppModeInfo != NULL; 50 return gAppModeInfo != NULL;
52 } 51 }
53 52
54 // static 53 // static
55 CommandLine ShellIntegration::CommandLineArgsForLauncher( 54 CommandLine ShellIntegration::CommandLineArgsForLauncher(
56 const GURL& url, 55 const GURL& url,
57 const std::string& extension_app_id, 56 const std::string& extension_app_id,
58 bool is_platform_app,
59 const FilePath& profile_path) { 57 const FilePath& profile_path) {
60 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 58 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
61 CommandLine new_cmd_line(CommandLine::NO_PROGRAM); 59 CommandLine new_cmd_line(CommandLine::NO_PROGRAM);
62 60
63 // Use the same UserDataDir for new launches that we currently have set. 61 // Use the same UserDataDir for new launches that we currently have set.
64 FilePath user_data_dir = cmd_line.GetSwitchValuePath(switches::kUserDataDir); 62 FilePath user_data_dir = cmd_line.GetSwitchValuePath(switches::kUserDataDir);
65 if (!user_data_dir.empty()) { 63 if (!user_data_dir.empty()) {
66 // Make sure user_data_dir is an absolute path. 64 // Make sure user_data_dir is an absolute path.
67 if (file_util::AbsolutePath(&user_data_dir) && 65 if (file_util::AbsolutePath(&user_data_dir) &&
68 file_util::PathExists(user_data_dir)) { 66 file_util::PathExists(user_data_dir)) {
69 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); 67 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir);
70 } 68 }
71 } 69 }
72 70
73 #if defined(OS_CHROMEOS) 71 #if defined(OS_CHROMEOS)
74 FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); 72 FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile);
75 if (!profile.empty()) 73 if (!profile.empty())
76 new_cmd_line.AppendSwitchPath(switches::kLoginProfile, profile); 74 new_cmd_line.AppendSwitchPath(switches::kLoginProfile, profile);
77 #else 75 #else
78 if (!profile_path.empty() && !extension_app_id.empty()) 76 if (!profile_path.empty() && !extension_app_id.empty())
79 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory, 77 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory,
80 profile_path.BaseName()); 78 profile_path.BaseName());
81 #endif 79 #endif
82 80
83 // If |extension_app_id| is present, we use the kAppId switch rather than 81 // If |extension_app_id| is present, we use the kAppId switch rather than
84 // the kApp switch (the launch url will be read from the extension app 82 // the kApp switch (the launch url will be read from the extension app
85 // during launch. 83 // during launch.
86 if (!extension_app_id.empty()) { 84 if (!extension_app_id.empty()) {
87 new_cmd_line.AppendSwitchASCII(switches::kAppId, extension_app_id); 85 new_cmd_line.AppendSwitchASCII(switches::kAppId, extension_app_id);
88 if (is_platform_app)
89 new_cmd_line.AppendSwitch(switches::kEnableExperimentalExtensionApis);
90 } else { 86 } else {
91 // Use '--app=url' instead of just 'url' to launch the browser with minimal 87 // Use '--app=url' instead of just 'url' to launch the browser with minimal
92 // chrome. 88 // chrome.
93 // Note: Do not change this flag! Old Gears shortcuts will break if you do! 89 // Note: Do not change this flag! Old Gears shortcuts will break if you do!
94 new_cmd_line.AppendSwitchASCII(switches::kApp, url.spec()); 90 new_cmd_line.AppendSwitchASCII(switches::kApp, url.spec());
95 } 91 }
96 return new_cmd_line; 92 return new_cmd_line;
97 } 93 }
98 94
99 #if !defined(OS_WIN) 95 #if !defined(OS_WIN)
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 259
264 ShellIntegration::DefaultWebClientState 260 ShellIntegration::DefaultWebClientState
265 ShellIntegration::DefaultProtocolClientWorker::CheckIsDefault() { 261 ShellIntegration::DefaultProtocolClientWorker::CheckIsDefault() {
266 return ShellIntegration::IsDefaultProtocolClient(protocol_); 262 return ShellIntegration::IsDefaultProtocolClient(protocol_);
267 } 263 }
268 264
269 bool ShellIntegration::DefaultProtocolClientWorker::SetAsDefault( 265 bool ShellIntegration::DefaultProtocolClientWorker::SetAsDefault(
270 bool interactive_permitted) { 266 bool interactive_permitted) {
271 return ShellIntegration::SetAsDefaultProtocolClient(protocol_); 267 return ShellIntegration::SetAsDefaultProtocolClient(protocol_);
272 } 268 }
OLDNEW
« no previous file with comments | « chrome/browser/shell_integration.h ('k') | chrome/browser/shell_integration_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698