| 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 #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/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/policy/policy_path_parser.h" | 15 #include "chrome/browser/policy/policy_path_parser.h" |
| 16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 | 20 |
| 21 #if defined(OS_CHROMEOS) | |
| 22 #include "chromeos/chromeos_switches.h" | |
| 23 #endif | |
| 24 | |
| 25 using content::BrowserThread; | 21 using content::BrowserThread; |
| 26 | 22 |
| 27 ShellIntegration::DefaultWebClientSetPermission | 23 ShellIntegration::DefaultWebClientSetPermission |
| 28 ShellIntegration::CanSetAsDefaultProtocolClient() { | 24 ShellIntegration::CanSetAsDefaultProtocolClient() { |
| 29 // Allowed as long as the browser can become the operating system default | 25 // Allowed as long as the browser can become the operating system default |
| 30 // browser. | 26 // browser. |
| 31 return CanSetAsDefaultBrowser(); | 27 return CanSetAsDefaultBrowser(); |
| 32 } | 28 } |
| 33 | 29 |
| 34 ShellIntegration::ShortcutInfo::ShortcutInfo() | 30 ShellIntegration::ShortcutInfo::ShortcutInfo() |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #endif | 74 #endif |
| 79 if (!user_data_dir.empty()) { | 75 if (!user_data_dir.empty()) { |
| 80 // Make sure user_data_dir is an absolute path. | 76 // Make sure user_data_dir is an absolute path. |
| 81 if (file_util::AbsolutePath(&user_data_dir) && | 77 if (file_util::AbsolutePath(&user_data_dir) && |
| 82 file_util::PathExists(user_data_dir)) { | 78 file_util::PathExists(user_data_dir)) { |
| 83 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 79 new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
| 84 } | 80 } |
| 85 } | 81 } |
| 86 | 82 |
| 87 #if defined(OS_CHROMEOS) | 83 #if defined(OS_CHROMEOS) |
| 88 base::FilePath profile = cmd_line.GetSwitchValuePath( | 84 base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); |
| 89 chromeos::switches::kLoginProfile); | |
| 90 if (!profile.empty()) | 85 if (!profile.empty()) |
| 91 new_cmd_line.AppendSwitchPath(chromeos::switches::kLoginProfile, profile); | 86 new_cmd_line.AppendSwitchPath(switches::kLoginProfile, profile); |
| 92 #else | 87 #else |
| 93 if (!profile_path.empty() && !extension_app_id.empty()) | 88 if (!profile_path.empty() && !extension_app_id.empty()) |
| 94 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory, | 89 new_cmd_line.AppendSwitchPath(switches::kProfileDirectory, |
| 95 profile_path.BaseName()); | 90 profile_path.BaseName()); |
| 96 #endif | 91 #endif |
| 97 | 92 |
| 98 // If |extension_app_id| is present, we use the kAppId switch rather than | 93 // If |extension_app_id| is present, we use the kAppId switch rather than |
| 99 // the kApp switch (the launch url will be read from the extension app | 94 // the kApp switch (the launch url will be read from the extension app |
| 100 // during launch. | 95 // during launch. |
| 101 if (!extension_app_id.empty()) { | 96 if (!extension_app_id.empty()) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( | 292 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( |
| 298 protocol_); | 293 protocol_); |
| 299 } | 294 } |
| 300 break; | 295 break; |
| 301 default: | 296 default: |
| 302 NOTREACHED(); | 297 NOTREACHED(); |
| 303 } | 298 } |
| 304 | 299 |
| 305 return result; | 300 return result; |
| 306 } | 301 } |
| OLD | NEW |