| 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/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } // namespace internal | 73 } // namespace internal |
| 74 | 74 |
| 75 void OpenExternal(Profile* profile, const GURL& url) { | 75 void OpenExternal(Profile* profile, const GURL& url) { |
| 76 DCHECK([NSThread isMainThread]); | 76 DCHECK([NSThread isMainThread]); |
| 77 NSString* url_string = base::SysUTF8ToNSString(url.spec()); | 77 NSString* url_string = base::SysUTF8ToNSString(url.spec()); |
| 78 NSURL* ns_url = [NSURL URLWithString:url_string]; | 78 NSURL* ns_url = [NSURL URLWithString:url_string]; |
| 79 if (!ns_url || ![[NSWorkspace sharedWorkspace] openURL:ns_url]) | 79 if (!ns_url || ![[NSWorkspace sharedWorkspace] openURL:ns_url]) |
| 80 LOG(WARNING) << "NSWorkspace failed to open URL " << url; | 80 LOG(WARNING) << "NSWorkspace failed to open URL " << url; |
| 81 } | 81 } |
| 82 | 82 |
| 83 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | |
| 84 return [view window]; | |
| 85 } | |
| 86 | |
| 87 gfx::NativeView GetViewForWindow(gfx::NativeWindow window) { | 83 gfx::NativeView GetViewForWindow(gfx::NativeWindow window) { |
| 88 DCHECK(window); | 84 DCHECK(window); |
| 89 DCHECK([window contentView]); | 85 DCHECK([window contentView]); |
| 90 return [window contentView]; | 86 return [window contentView]; |
| 91 } | 87 } |
| 92 | 88 |
| 93 gfx::NativeView GetParent(gfx::NativeView view) { | 89 gfx::NativeView GetParent(gfx::NativeView view) { |
| 94 return nil; | 90 return nil; |
| 95 } | 91 } |
| 96 | 92 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 110 [[view window] isVisible]); | 106 [[view window] isVisible]); |
| 111 } | 107 } |
| 112 | 108 |
| 113 bool IsSwipeTrackingFromScrollEventsEnabled() { | 109 bool IsSwipeTrackingFromScrollEventsEnabled() { |
| 114 SEL selector = @selector(isSwipeTrackingFromScrollEventsEnabled); | 110 SEL selector = @selector(isSwipeTrackingFromScrollEventsEnabled); |
| 115 return [NSEvent respondsToSelector:selector] | 111 return [NSEvent respondsToSelector:selector] |
| 116 && [NSEvent performSelector:selector]; | 112 && [NSEvent performSelector:selector]; |
| 117 } | 113 } |
| 118 | 114 |
| 119 } // namespace platform_util | 115 } // namespace platform_util |
| OLD | NEW |