| 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 "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/debug/crash_logging.h" | 11 #include "base/debug/crash_logging.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
| 15 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
| 16 #include "base/mac/sdk_forward_declarations.h" |
| 16 #import "base/memory/scoped_nsobject.h" | 17 #import "base/memory/scoped_nsobject.h" |
| 17 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 20 #include "base/stringprintf.h" | 21 #include "base/stringprintf.h" |
| 21 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
| 22 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
| 23 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
| 24 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 25 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 25 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" | 26 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // These are not documented, so use only after checking -respondsToSelector:. | 74 // These are not documented, so use only after checking -respondsToSelector:. |
| 74 @interface NSApplication (UndocumentedSpeechMethods) | 75 @interface NSApplication (UndocumentedSpeechMethods) |
| 75 - (void)speakString:(NSString*)string; | 76 - (void)speakString:(NSString*)string; |
| 76 - (void)stopSpeaking:(id)sender; | 77 - (void)stopSpeaking:(id)sender; |
| 77 - (BOOL)isSpeaking; | 78 - (BOOL)isSpeaking; |
| 78 @end | 79 @end |
| 79 | 80 |
| 80 // Declare things that are part of the 10.7 SDK. | 81 // Declare things that are part of the 10.7 SDK. |
| 81 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 82 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 82 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 83 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 83 enum { | |
| 84 NSEventPhaseNone = 0, // event not associated with a phase. | |
| 85 NSEventPhaseBegan = 0x1 << 0, | |
| 86 NSEventPhaseStationary = 0x1 << 1, | |
| 87 NSEventPhaseChanged = 0x1 << 2, | |
| 88 NSEventPhaseEnded = 0x1 << 3, | |
| 89 NSEventPhaseCancelled = 0x1 << 4, | |
| 90 }; | |
| 91 typedef NSUInteger NSEventPhase; | |
| 92 | |
| 93 @interface NSEvent (LionAPI) | |
| 94 - (NSEventPhase)phase; | |
| 95 @end | |
| 96 | |
| 97 @interface NSWindow (LionAPI) | |
| 98 - (CGFloat)backingScaleFactor; | |
| 99 @end | |
| 100 | |
| 101 @interface NSView (NSOpenGLSurfaceResolutionLionAPI) | 84 @interface NSView (NSOpenGLSurfaceResolutionLionAPI) |
| 102 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag; | 85 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag; |
| 103 @end | 86 @end |
| 104 | 87 |
| 105 static NSString* const NSWindowDidChangeBackingPropertiesNotification = | 88 static NSString* const NSWindowDidChangeBackingPropertiesNotification = |
| 106 @"NSWindowDidChangeBackingPropertiesNotification"; | 89 @"NSWindowDidChangeBackingPropertiesNotification"; |
| 107 static NSString* const NSBackingPropertyOldScaleFactorKey = | 90 static NSString* const NSBackingPropertyOldScaleFactorKey = |
| 108 @"NSBackingPropertyOldScaleFactorKey"; | 91 @"NSBackingPropertyOldScaleFactorKey"; |
| 109 // Note: Apple's example code (linked from the comment above | 92 // Note: Apple's example code (linked from the comment above |
| 110 // -windowDidChangeBackingProperties:) uses | 93 // -windowDidChangeBackingProperties:) uses |
| (...skipping 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3401 if (!string) return NO; | 3384 if (!string) return NO; |
| 3402 | 3385 |
| 3403 // If the user is currently using an IME, confirm the IME input, | 3386 // If the user is currently using an IME, confirm the IME input, |
| 3404 // and then insert the text from the service, the same as TextEdit and Safari. | 3387 // and then insert the text from the service, the same as TextEdit and Safari. |
| 3405 [self confirmComposition]; | 3388 [self confirmComposition]; |
| 3406 [self insertText:string]; | 3389 [self insertText:string]; |
| 3407 return YES; | 3390 return YES; |
| 3408 } | 3391 } |
| 3409 | 3392 |
| 3410 @end | 3393 @end |
| OLD | NEW |