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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
12 #import "base/mac/scoped_nsautorelease_pool.h" | 12 #import "base/mac/scoped_nsautorelease_pool.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #import "base/memory/scoped_nsobject.h" | 14 #import "base/memory/scoped_nsobject.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
17 #include "base/sys_string_conversions.h" | 17 #include "base/sys_string_conversions.h" |
18 #import "chrome/app/breakpad_mac.h" | |
19 #include "chrome/browser/browser_trial.h" | 18 #include "chrome/browser/browser_trial.h" |
20 #import "chrome/browser/renderer_host/accelerated_plugin_view_mac.h" | 19 #import "chrome/browser/renderer_host/accelerated_plugin_view_mac.h" |
21 #import "chrome/browser/renderer_host/text_input_client_mac.h" | 20 #import "chrome/browser/renderer_host/text_input_client_mac.h" |
22 #include "chrome/browser/spellchecker_platform_engine.h" | 21 #include "chrome/browser/spellchecker_platform_engine.h" |
23 #import "chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h" | 22 #import "chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h" |
24 #import "chrome/browser/ui/cocoa/view_id_util.h" | 23 #import "chrome/browser/ui/cocoa/view_id_util.h" |
25 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
26 #include "chrome/common/spellcheck_messages.h" | 25 #include "chrome/common/spellcheck_messages.h" |
27 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 26 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
28 #include "content/browser/browser_thread.h" | 27 #include "content/browser/browser_thread.h" |
29 #include "content/browser/gpu/gpu_process_host.h" | 28 #include "content/browser/gpu/gpu_process_host.h" |
30 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 29 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
31 #include "content/browser/plugin_process_host.h" | 30 #include "content/browser/plugin_process_host.h" |
32 #include "content/browser/renderer_host/backing_store_mac.h" | 31 #include "content/browser/renderer_host/backing_store_mac.h" |
33 #include "content/browser/renderer_host/render_process_host.h" | 32 #include "content/browser/renderer_host/render_process_host.h" |
34 #include "content/browser/renderer_host/render_view_host.h" | 33 #include "content/browser/renderer_host/render_view_host.h" |
35 #include "content/browser/renderer_host/render_view_host_observer.h" | 34 #include "content/browser/renderer_host/render_view_host_observer.h" |
36 #include "content/browser/renderer_host/render_widget_host.h" | 35 #include "content/browser/renderer_host/render_widget_host.h" |
37 #include "content/common/edit_command.h" | 36 #include "content/common/edit_command.h" |
38 #include "content/common/gpu/gpu_messages.h" | 37 #include "content/common/gpu/gpu_messages.h" |
39 #include "content/common/native_web_keyboard_event.h" | 38 #include "content/common/native_web_keyboard_event.h" |
40 #include "content/common/plugin_messages.h" | 39 #include "content/common/plugin_messages.h" |
41 #include "content/common/view_messages.h" | 40 #include "content/common/view_messages.h" |
42 #include "skia/ext/platform_canvas.h" | 41 #include "skia/ext/platform_canvas.h" |
43 #import "third_party/mozilla/ComplexTextInputPanel.h" | 42 #import "third_party/mozilla/ComplexTextInputPanel.h" |
44 #include "third_party/skia/include/core/SkColor.h" | 43 #include "third_party/skia/include/core/SkColor.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | |
47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
48 #include "ui/gfx/point.h" | 46 #include "ui/gfx/point.h" |
49 #include "ui/gfx/surface/io_surface_support_mac.h" | 47 #include "ui/gfx/surface/io_surface_support_mac.h" |
50 #include "webkit/glue/webaccessibility.h" | 48 #include "webkit/glue/webaccessibility.h" |
51 #include "webkit/plugins/npapi/webplugin.h" | 49 #include "webkit/plugins/npapi/webplugin.h" |
52 | 50 |
53 using WebKit::WebInputEvent; | 51 using WebKit::WebInputEvent; |
54 using WebKit::WebInputEventFactory; | 52 using WebKit::WebInputEventFactory; |
55 using WebKit::WebMouseEvent; | 53 using WebKit::WebMouseEvent; |
56 using WebKit::WebMouseWheelEvent; | 54 using WebKit::WebMouseWheelEvent; |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 472 |
475 void RenderWidgetHostViewMac::UpdateCursorIfNecessary() { | 473 void RenderWidgetHostViewMac::UpdateCursorIfNecessary() { |
476 // Do something special (as Win Chromium does) for arrow cursor while loading | 474 // Do something special (as Win Chromium does) for arrow cursor while loading |
477 // a page? TODO(avi): decide | 475 // a page? TODO(avi): decide |
478 // Can we synchronize to the event stream? Switch to -[NSWindow | 476 // Can we synchronize to the event stream? Switch to -[NSWindow |
479 // mouseLocationOutsideOfEventStream] if we cannot. TODO(avi): test and see | 477 // mouseLocationOutsideOfEventStream] if we cannot. TODO(avi): test and see |
480 NSEvent* event = [[cocoa_view_ window] currentEvent]; | 478 NSEvent* event = [[cocoa_view_ window] currentEvent]; |
481 if ([event window] != [cocoa_view_ window]) | 479 if ([event window] != [cocoa_view_ window]) |
482 return; | 480 return; |
483 | 481 |
484 // TODO(shess): Store additional information in breakpad dumps for | |
485 // debugging http://crbug.com/73356 . | |
486 scoped_ptr<ScopedCrashKey> key; | |
487 if (current_cursor_.IsCustom()) { | |
488 NSString* kCrashKey = @"custom-cursor-size"; | |
489 const gfx::Size size = current_cursor_.custom_size(); | |
490 NSString* crashValue = | |
491 [NSString stringWithFormat:@"{%d, %d}", size.width(), size.height()]; | |
492 key.reset(new ScopedCrashKey(kCrashKey, crashValue)); | |
493 } | |
494 | |
495 NSCursor* ns_cursor = current_cursor_.GetCursor(); | 482 NSCursor* ns_cursor = current_cursor_.GetCursor(); |
496 [ns_cursor set]; | 483 [ns_cursor set]; |
497 } | 484 } |
498 | 485 |
499 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) { | 486 void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) { |
500 is_loading_ = is_loading; | 487 is_loading_ = is_loading; |
501 // If we ever decide to show the waiting cursor while the page is loading | 488 // If we ever decide to show the waiting cursor while the page is loading |
502 // like Chrome does on Windows, call |UpdateCursorIfNecessary()| here. | 489 // like Chrome does on Windows, call |UpdateCursorIfNecessary()| here. |
503 } | 490 } |
504 | 491 |
(...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 if (!string) return NO; | 2589 if (!string) return NO; |
2603 | 2590 |
2604 // If the user is currently using an IME, confirm the IME input, | 2591 // If the user is currently using an IME, confirm the IME input, |
2605 // and then insert the text from the service, the same as TextEdit and Safari. | 2592 // and then insert the text from the service, the same as TextEdit and Safari. |
2606 [self confirmComposition]; | 2593 [self confirmComposition]; |
2607 [self insertText:string]; | 2594 [self insertText:string]; |
2608 return YES; | 2595 return YES; |
2609 } | 2596 } |
2610 | 2597 |
2611 @end | 2598 @end |
OLD | NEW |