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

Side by Side Diff: chrome/browser/shell_integration_mac.mm

Issue 1978643002: Now able to set Chrome as the default browser on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | 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/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/channel_info.h" 10 #include "chrome/common/channel_info.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 [default_client caseInsensitiveCompare:identifier]; 46 [default_client caseInsensitiveCompare:identifier];
47 return result == NSOrderedSame; 47 return result == NSOrderedSame;
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 // Sets Chromium as default browser to be used by the operating system. This 52 // Sets Chromium as default browser to be used by the operating system. This
53 // applies only for the current user. Returns false if this cannot be done, or 53 // applies only for the current user. Returns false if this cannot be done, or
54 // if the operation fails. 54 // if the operation fails.
55 bool SetAsDefaultBrowser() { 55 bool SetAsDefaultBrowser() {
56 if (CanSetAsDefaultBrowser()) 56 if (!CanSetAsDefaultBrowser())
57 return false; 57 return false;
58 58
59 // We really do want the outer bundle here, not the main bundle since setting 59 // We really do want the outer bundle here, not the main bundle since setting
60 // a shortcut to Chrome as the default browser doesn't make sense. 60 // a shortcut to Chrome as the default browser doesn't make sense.
61 NSString* identifier = [base::mac::OuterBundle() bundleIdentifier]; 61 NSString* identifier = [base::mac::OuterBundle() bundleIdentifier];
62 if (!identifier) 62 if (!identifier)
63 return false; 63 return false;
64 64
65 [[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:identifier]; 65 [[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:identifier];
66 return true; 66 return true;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 NSString* my_identifier = [base::mac::MainBundle() bundleIdentifier]; 146 NSString* my_identifier = [base::mac::MainBundle() bundleIdentifier];
147 if (!my_identifier) 147 if (!my_identifier)
148 return UNKNOWN_DEFAULT; 148 return UNKNOWN_DEFAULT;
149 149
150 NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()]; 150 NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
151 return IsIdentifierDefaultProtocolClient(my_identifier, protocol_ns) ? 151 return IsIdentifierDefaultProtocolClient(my_identifier, protocol_ns) ?
152 IS_DEFAULT : NOT_DEFAULT; 152 IS_DEFAULT : NOT_DEFAULT;
153 } 153 }
154 154
155 } // namespace shell_integration 155 } // namespace shell_integration
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698