| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #import "third_party/mozilla/NSWorkspace+Utils.h" | 8 #import "third_party/mozilla/NSWorkspace+Utils.h" |
| 9 | 9 |
| 10 // Sets Chromium as default browser (only for current user). Returns false if | 10 // Sets Chromium as default browser (only for current user). Returns false if |
| 11 // this operation fails (which we can't check for). | 11 // this operation fails (which we can't check for). |
| 12 bool ShellIntegration::SetAsDefaultBrowser() { | 12 bool ShellIntegration::SetAsDefaultBrowser() { |
| 13 // We really do want the main bundle here, not mac_util::MainAppBundle(), | 13 // We really do want the main bundle here, not base::mac::MainAppBundle(), |
| 14 // which is the bundle for the framework. | 14 // which is the bundle for the framework. |
| 15 NSString* identifier = [[NSBundle mainBundle] bundleIdentifier]; | 15 NSString* identifier = [[NSBundle mainBundle] bundleIdentifier]; |
| 16 [[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:identifier]; | 16 [[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:identifier]; |
| 17 return true; | 17 return true; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Returns true if |identifier| is the bundle id of the default browser. | 22 // Returns true if |identifier| is the bundle id of the default browser. |
| 23 bool IsIdentifierDefaultBrowser(NSString* identifier) { | 23 bool IsIdentifierDefaultBrowser(NSString* identifier) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 if (!myIdentifier) | 44 if (!myIdentifier) |
| 45 return UNKNOWN_DEFAULT_BROWSER; | 45 return UNKNOWN_DEFAULT_BROWSER; |
| 46 return IsIdentifierDefaultBrowser(myIdentifier) ? IS_DEFAULT_BROWSER | 46 return IsIdentifierDefaultBrowser(myIdentifier) ? IS_DEFAULT_BROWSER |
| 47 : NOT_DEFAULT_BROWSER; | 47 : NOT_DEFAULT_BROWSER; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Returns true if Firefox is the default browser for the current user. | 50 // Returns true if Firefox is the default browser for the current user. |
| 51 bool ShellIntegration::IsFirefoxDefaultBrowser() { | 51 bool ShellIntegration::IsFirefoxDefaultBrowser() { |
| 52 return IsIdentifierDefaultBrowser(@"org.mozilla.firefox"); | 52 return IsIdentifierDefaultBrowser(@"org.mozilla.firefox"); |
| 53 } | 53 } |
| OLD | NEW |