| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 /////////////////////////////////////////////////////////////////////////////// | 213 /////////////////////////////////////////////////////////////////////////////// |
| 214 // RenderWidgetHostView, public: | 214 // RenderWidgetHostView, public: |
| 215 | 215 |
| 216 // static | 216 // static |
| 217 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 217 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
| 218 RenderWidgetHost* widget) { | 218 RenderWidgetHost* widget) { |
| 219 return new RenderWidgetHostViewMac(widget); | 219 return new RenderWidgetHostViewMac(widget); |
| 220 } | 220 } |
| 221 | 221 |
| 222 // static | 222 // static |
| 223 void RenderWidgetHostViewBase::GetDefaultScreenInfo( | 223 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
| 224 WebKit::WebScreenInfo* results) { | 224 WebKit::WebScreenInfo* results) { |
| 225 *results = WebKit::WebScreenInfoFactory::screenInfo(NULL); | 225 *results = WebKit::WebScreenInfoFactory::screenInfo(NULL); |
| 226 } | 226 } |
| 227 | 227 |
| 228 /////////////////////////////////////////////////////////////////////////////// | 228 /////////////////////////////////////////////////////////////////////////////// |
| 229 // RenderWidgetHostViewMac, public: | 229 // RenderWidgetHostViewMac, public: |
| 230 | 230 |
| 231 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) | 231 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) |
| 232 : render_widget_host_(widget), | 232 : render_widget_host_(widget), |
| 233 about_to_validate_and_paint_(false), | 233 about_to_validate_and_paint_(false), |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 [cocoa_view_ setSelectedRange:range.ToNSRange()]; | 682 [cocoa_view_ setSelectedRange:range.ToNSRange()]; |
| 683 // Updaes markedRange when there is no marked text so that retrieving | 683 // Updaes markedRange when there is no marked text so that retrieving |
| 684 // markedRange immediately after calling setMarkdText: returns the current | 684 // markedRange immediately after calling setMarkdText: returns the current |
| 685 // caret position. | 685 // caret position. |
| 686 if (![cocoa_view_ hasMarkedText]) { | 686 if (![cocoa_view_ hasMarkedText]) { |
| 687 [cocoa_view_ setMarkedRange:range.ToNSRange()]; | 687 [cocoa_view_ setMarkedRange:range.ToNSRange()]; |
| 688 } | 688 } |
| 689 } | 689 } |
| 690 | 690 |
| 691 void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) { | 691 void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) { |
| 692 RenderWidgetHostViewBase::SetShowingContextMenu(showing); | 692 content::RenderWidgetHostViewBase::SetShowingContextMenu(showing); |
| 693 | 693 |
| 694 // If the menu was closed, restore the cursor to the saved version initially, | 694 // If the menu was closed, restore the cursor to the saved version initially, |
| 695 // as the renderer will not re-send it if there was no change. | 695 // as the renderer will not re-send it if there was no change. |
| 696 if (!showing) | 696 if (!showing) |
| 697 UpdateCursorIfNecessary(); | 697 UpdateCursorIfNecessary(); |
| 698 | 698 |
| 699 // Create a fake mouse event to inform the render widget that the mouse | 699 // Create a fake mouse event to inform the render widget that the mouse |
| 700 // left or entered. | 700 // left or entered. |
| 701 NSWindow* window = [cocoa_view_ window]; | 701 NSWindow* window = [cocoa_view_ window]; |
| 702 // TODO(asvitkine): If the location outside of the event stream doesn't | 702 // TODO(asvitkine): If the location outside of the event stream doesn't |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 | 1107 |
| 1108 void RenderWidgetHostViewMac::WindowFrameChanged() { | 1108 void RenderWidgetHostViewMac::WindowFrameChanged() { |
| 1109 if (render_widget_host_) { | 1109 if (render_widget_host_) { |
| 1110 render_widget_host_->Send(new ViewMsg_WindowFrameChanged( | 1110 render_widget_host_->Send(new ViewMsg_WindowFrameChanged( |
| 1111 render_widget_host_->routing_id(), GetRootWindowBounds(), | 1111 render_widget_host_->routing_id(), GetRootWindowBounds(), |
| 1112 GetViewBounds())); | 1112 GetViewBounds())); |
| 1113 } | 1113 } |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) { | 1116 void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) { |
| 1117 RenderWidgetHostViewBase::SetBackground(background); | 1117 content::RenderWidgetHostViewBase::SetBackground(background); |
| 1118 if (render_widget_host_) | 1118 if (render_widget_host_) |
| 1119 render_widget_host_->Send(new ViewMsg_SetBackground( | 1119 render_widget_host_->Send(new ViewMsg_SetBackground( |
| 1120 render_widget_host_->routing_id(), background)); | 1120 render_widget_host_->routing_id(), background)); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 void RenderWidgetHostViewMac::OnAccessibilityNotifications( | 1123 void RenderWidgetHostViewMac::OnAccessibilityNotifications( |
| 1124 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { | 1124 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { |
| 1125 if (!GetBrowserAccessibilityManager()) { | 1125 if (!GetBrowserAccessibilityManager()) { |
| 1126 SetBrowserAccessibilityManager( | 1126 SetBrowserAccessibilityManager( |
| 1127 BrowserAccessibilityManager::CreateEmptyDocument( | 1127 BrowserAccessibilityManager::CreateEmptyDocument( |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 if (!string) return NO; | 2763 if (!string) return NO; |
| 2764 | 2764 |
| 2765 // If the user is currently using an IME, confirm the IME input, | 2765 // If the user is currently using an IME, confirm the IME input, |
| 2766 // and then insert the text from the service, the same as TextEdit and Safari. | 2766 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2767 [self confirmComposition]; | 2767 [self confirmComposition]; |
| 2768 [self insertText:string]; | 2768 [self insertText:string]; |
| 2769 return YES; | 2769 return YES; |
| 2770 } | 2770 } |
| 2771 | 2771 |
| 2772 @end | 2772 @end |
| OLD | NEW |