| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "chrome/browser/policy/policy_path_parser.h" | 14 #include "chrome/browser/policy/policy_path_parser.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "components/version_info/version_info.h" |
| 17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 18 | 19 |
| 19 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 20 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 #if !defined(OS_WIN) | 24 #if !defined(OS_WIN) |
| 24 #include "chrome/common/chrome_version_info.h" | 25 #include "chrome/common/channel_info.h" |
| 25 #include "chrome/grit/chromium_strings.h" | 26 #include "chrome/grit/chromium_strings.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 using content::BrowserThread; | 30 using content::BrowserThread; |
| 30 | 31 |
| 31 ShellIntegration::DefaultWebClientSetPermission | 32 ShellIntegration::DefaultWebClientSetPermission |
| 32 ShellIntegration::CanSetAsDefaultProtocolClient() { | 33 ShellIntegration::CanSetAsDefaultProtocolClient() { |
| 33 // Allowed as long as the browser can become the operating system default | 34 // Allowed as long as the browser can become the operating system default |
| 34 // browser. | 35 // browser. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 #else | 106 #else |
| 106 if (!profile_path.empty()) | 107 if (!profile_path.empty()) |
| 107 command_line->AppendSwitchPath(switches::kProfileDirectory, | 108 command_line->AppendSwitchPath(switches::kProfileDirectory, |
| 108 profile_path.BaseName()); | 109 profile_path.BaseName()); |
| 109 #endif | 110 #endif |
| 110 } | 111 } |
| 111 | 112 |
| 112 #if !defined(OS_WIN) | 113 #if !defined(OS_WIN) |
| 113 | 114 |
| 114 base::string16 ShellIntegration::GetAppShortcutsSubdirName() { | 115 base::string16 ShellIntegration::GetAppShortcutsSubdirName() { |
| 115 if (chrome::VersionInfo::GetChannel() == version_info::Channel::CANARY) | 116 if (chrome::GetChannel() == version_info::Channel::CANARY) |
| 116 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY); | 117 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY); |
| 117 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME); | 118 return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME); |
| 118 } | 119 } |
| 119 | 120 |
| 120 // static | 121 // static |
| 121 bool ShellIntegration::SetAsDefaultBrowserInteractive() { | 122 bool ShellIntegration::SetAsDefaultBrowserInteractive() { |
| 122 return false; | 123 return false; |
| 123 } | 124 } |
| 124 | 125 |
| 125 // static | 126 // static |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 case ShellIntegration::SET_DEFAULT_INTERACTIVE: | 306 case ShellIntegration::SET_DEFAULT_INTERACTIVE: |
| 306 if (interactive_permitted) { | 307 if (interactive_permitted) { |
| 307 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( | 308 result = ShellIntegration::SetAsDefaultProtocolClientInteractive( |
| 308 protocol_); | 309 protocol_); |
| 309 } | 310 } |
| 310 break; | 311 break; |
| 311 } | 312 } |
| 312 | 313 |
| 313 return result; | 314 return result; |
| 314 } | 315 } |
| OLD | NEW |