| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <CoreServices/CoreServices.h> | 9 #include <CoreServices/CoreServices.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value(); | 27 LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // This function opens a file. This doesn't use LaunchServices or NSWorkspace | 30 // This function opens a file. This doesn't use LaunchServices or NSWorkspace |
| 31 // because of two bugs: | 31 // because of two bugs: |
| 32 // 1. Incorrect app activation with com.apple.quarantine: | 32 // 1. Incorrect app activation with com.apple.quarantine: |
| 33 // http://crbug.com/32921 | 33 // http://crbug.com/32921 |
| 34 // 2. Silent no-op for unassociated file types: http://crbug.com/50263 | 34 // 2. Silent no-op for unassociated file types: http://crbug.com/50263 |
| 35 // Instead, an AppleEvent is constructed to tell the Finder to open the | 35 // Instead, an AppleEvent is constructed to tell the Finder to open the |
| 36 // document. | 36 // document. |
| 37 void OpenItem(const FilePath& full_path) { | 37 void OpenItem(const FilePath& full_path, base::ProcessHandle* process_handle) { |
| 38 DCHECK([NSThread isMainThread]); | 38 DCHECK([NSThread isMainThread]); |
| 39 NSString* path_string = base::SysUTF8ToNSString(full_path.value()); | 39 NSString* path_string = base::SysUTF8ToNSString(full_path.value()); |
| 40 if (!path_string) | 40 if (!path_string) |
| 41 return; | 41 return; |
| 42 | 42 |
| 43 OSErr status; | 43 OSErr status; |
| 44 | 44 |
| 45 // Create the target of this AppleEvent, the Finder. | 45 // Create the target of this AppleEvent, the Finder. |
| 46 base::mac::ScopedAEDesc<AEAddressDesc> address; | 46 base::mac::ScopedAEDesc<AEAddressDesc> address; |
| 47 const OSType finderCreatorCode = 'MACS'; | 47 const OSType finderCreatorCode = 'MACS'; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 bool IsVisible(gfx::NativeView view) { | 147 bool IsVisible(gfx::NativeView view) { |
| 148 // A reasonable approximation of how you'd expect this to behave. | 148 // A reasonable approximation of how you'd expect this to behave. |
| 149 return (view && | 149 return (view && |
| 150 ![view isHiddenOrHasHiddenAncestor] && | 150 ![view isHiddenOrHasHiddenAncestor] && |
| 151 [view window] && | 151 [view window] && |
| 152 [[view window] isVisible]); | 152 [[view window] isVisible]); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace platform_util | 155 } // namespace platform_util |
| OLD | NEW |