| 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/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/common/chrome_version_info.h" | 10 #include "chrome/common/channel_info.h" |
| 11 #include "components/version_info/version_info.h" |
| 11 #import "third_party/mozilla/NSWorkspace+Utils.h" | 12 #import "third_party/mozilla/NSWorkspace+Utils.h" |
| 12 | 13 |
| 13 ShellIntegration::DefaultWebClientSetPermission | 14 ShellIntegration::DefaultWebClientSetPermission |
| 14 ShellIntegration::CanSetAsDefaultBrowser() { | 15 ShellIntegration::CanSetAsDefaultBrowser() { |
| 15 if (chrome::VersionInfo::GetChannel() != | 16 if (chrome::GetChannel() != version_info::Channel::CANARY) { |
| 16 version_info::Channel::CANARY) { | |
| 17 return SET_DEFAULT_UNATTENDED; | 17 return SET_DEFAULT_UNATTENDED; |
| 18 } | 18 } |
| 19 | 19 |
| 20 return SET_DEFAULT_NOT_ALLOWED; | 20 return SET_DEFAULT_NOT_ALLOWED; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Sets Chromium as default browser to be used by the operating system. This | 23 // Sets Chromium as default browser to be used by the operating system. This |
| 24 // applies only for the current user. Returns false if this cannot be done, or | 24 // applies only for the current user. Returns false if this cannot be done, or |
| 25 // if the operation fails. | 25 // if the operation fails. |
| 26 bool ShellIntegration::SetAsDefaultBrowser() { | 26 bool ShellIntegration::SetAsDefaultBrowser() { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // We really do want the main bundle here since it makes sense to set an | 146 // We really do want the main bundle here since it makes sense to set an |
| 147 // app shortcut as a default protocol handler. | 147 // app shortcut as a default protocol handler. |
| 148 NSString* my_identifier = [base::mac::MainBundle() bundleIdentifier]; | 148 NSString* my_identifier = [base::mac::MainBundle() bundleIdentifier]; |
| 149 if (!my_identifier) | 149 if (!my_identifier) |
| 150 return UNKNOWN_DEFAULT; | 150 return UNKNOWN_DEFAULT; |
| 151 | 151 |
| 152 NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()]; | 152 NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()]; |
| 153 return IsIdentifierDefaultProtocolClient(my_identifier, protocol_ns) ? | 153 return IsIdentifierDefaultProtocolClient(my_identifier, protocol_ns) ? |
| 154 IS_DEFAULT : NOT_DEFAULT; | 154 IS_DEFAULT : NOT_DEFAULT; |
| 155 } | 155 } |
| OLD | NEW |