| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <IOSurface/IOSurface.h> | 9 #include <IOSurface/IOSurface.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 responderDelegate_; | 74 responderDelegate_; |
| 75 BOOL canBeKeyView_; | 75 BOOL canBeKeyView_; |
| 76 BOOL closeOnDeactivate_; | 76 BOOL closeOnDeactivate_; |
| 77 BOOL opaque_; | 77 BOOL opaque_; |
| 78 scoped_ptr<content::RenderWidgetHostViewMacEditCommandHelper> | 78 scoped_ptr<content::RenderWidgetHostViewMacEditCommandHelper> |
| 79 editCommand_helper_; | 79 editCommand_helper_; |
| 80 | 80 |
| 81 // Is YES if there was a mouse-down as yet unbalanced with a mouse-up. | 81 // Is YES if there was a mouse-down as yet unbalanced with a mouse-up. |
| 82 BOOL hasOpenMouseDown_; | 82 BOOL hasOpenMouseDown_; |
| 83 | 83 |
| 84 NSWindow* lastWindow_; // weak | |
| 85 | |
| 86 // The cursor for the page. This is passed up from the renderer. | 84 // The cursor for the page. This is passed up from the renderer. |
| 87 base::scoped_nsobject<NSCursor> currentCursor_; | 85 base::scoped_nsobject<NSCursor> currentCursor_; |
| 88 | 86 |
| 89 // Variables used by our implementaion of the NSTextInput protocol. | 87 // Variables used by our implementaion of the NSTextInput protocol. |
| 90 // An input method of Mac calls the methods of this protocol not only to | 88 // An input method of Mac calls the methods of this protocol not only to |
| 91 // notify an application of its status, but also to retrieve the status of | 89 // notify an application of its status, but also to retrieve the status of |
| 92 // the application. That is, an application cannot control an input method | 90 // the application. That is, an application cannot control an input method |
| 93 // directly. | 91 // directly. |
| 94 // This object keeps the status of a composition of the renderer and returns | 92 // This object keeps the status of a composition of the renderer and returns |
| 95 // it when an input method asks for it. | 93 // it when an input method asks for it. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 134 |
| 137 // Indicates if doCommandBySelector method receives any edit command when | 135 // Indicates if doCommandBySelector method receives any edit command when |
| 138 // handling a key down event. | 136 // handling a key down event. |
| 139 BOOL hasEditCommands_; | 137 BOOL hasEditCommands_; |
| 140 | 138 |
| 141 // Contains edit commands received by the -doCommandBySelector: method when | 139 // Contains edit commands received by the -doCommandBySelector: method when |
| 142 // handling a key down event, not including inserting commands, eg. insertTab, | 140 // handling a key down event, not including inserting commands, eg. insertTab, |
| 143 // etc. | 141 // etc. |
| 144 content::EditCommands editCommands_; | 142 content::EditCommands editCommands_; |
| 145 | 143 |
| 146 // The plugin that currently has focus (-1 if no plugin has focus). | |
| 147 int focusedPluginIdentifier_; | |
| 148 | |
| 149 // Whether or not plugin IME is currently enabled active. | |
| 150 BOOL pluginImeActive_; | |
| 151 | |
| 152 // Whether the previous mouse event was ignored due to hitTest check. | 144 // Whether the previous mouse event was ignored due to hitTest check. |
| 153 BOOL mouseEventWasIgnored_; | 145 BOOL mouseEventWasIgnored_; |
| 154 | 146 |
| 155 // Event monitor for scroll wheel end event. | 147 // Event monitor for scroll wheel end event. |
| 156 id endWheelMonitor_; | 148 id endWheelMonitor_; |
| 157 | 149 |
| 158 // When a gesture starts, the system does not inform the view of which type | 150 // When a gesture starts, the system does not inform the view of which type |
| 159 // of gesture is happening (magnify, rotate, etc), rather, it just informs | 151 // of gesture is happening (magnify, rotate, etc), rather, it just informs |
| 160 // the view that some as-yet-undefined gesture is starting. Capture the | 152 // the view that some as-yet-undefined gesture is starting. Capture the |
| 161 // information about the gesture's beginning event here. It will be used to | 153 // information about the gesture's beginning event here. It will be used to |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 189 |
| 198 - (void)setCanBeKeyView:(BOOL)can; | 190 - (void)setCanBeKeyView:(BOOL)can; |
| 199 - (void)setCloseOnDeactivate:(BOOL)b; | 191 - (void)setCloseOnDeactivate:(BOOL)b; |
| 200 - (void)setOpaque:(BOOL)opaque; | 192 - (void)setOpaque:(BOOL)opaque; |
| 201 // True for always-on-top special windows (e.g. Balloons and Panels). | 193 // True for always-on-top special windows (e.g. Balloons and Panels). |
| 202 - (BOOL)acceptsMouseEventsWhenInactive; | 194 - (BOOL)acceptsMouseEventsWhenInactive; |
| 203 // Cancel ongoing composition (abandon the marked text). | 195 // Cancel ongoing composition (abandon the marked text). |
| 204 - (void)cancelComposition; | 196 - (void)cancelComposition; |
| 205 // Confirm ongoing composition. | 197 // Confirm ongoing composition. |
| 206 - (void)confirmComposition; | 198 - (void)confirmComposition; |
| 207 // Enables or disables plugin IME. | |
| 208 - (void)setPluginImeActive:(BOOL)active; | |
| 209 // Updates the current plugin focus state. | |
| 210 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId; | |
| 211 // Evaluates the event in the context of plugin IME, if plugin IME is enabled. | |
| 212 // Returns YES if the event was handled. | |
| 213 - (BOOL)postProcessEventForPluginIme:(NSEvent*)event; | |
| 214 - (void)updateCursor:(NSCursor*)cursor; | 199 - (void)updateCursor:(NSCursor*)cursor; |
| 215 - (NSRect)firstViewRectForCharacterRange:(NSRange)theRange | 200 - (NSRect)firstViewRectForCharacterRange:(NSRange)theRange |
| 216 actualRange:(NSRangePointer)actualRange; | 201 actualRange:(NSRangePointer)actualRange; |
| 217 - (void)quickLookWithEvent:(NSEvent*)event; | 202 - (void)quickLookWithEvent:(NSEvent*)event; |
| 218 - (void)showLookUpDictionaryOverlayAtPoint:(NSPoint)point; | 203 - (void)showLookUpDictionaryOverlayAtPoint:(NSPoint)point; |
| 219 - (void)showLookUpDictionaryOverlayFromRange:(NSRange)range | 204 - (void)showLookUpDictionaryOverlayFromRange:(NSRange)range |
| 220 targetView:(NSView*)targetView; | 205 targetView:(NSView*)targetView; |
| 221 @end | 206 @end |
| 222 | 207 |
| 223 namespace content { | 208 namespace content { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 bool HasFocus() const override; | 263 bool HasFocus() const override; |
| 279 bool IsSurfaceAvailableForCopy() const override; | 264 bool IsSurfaceAvailableForCopy() const override; |
| 280 void Show() override; | 265 void Show() override; |
| 281 void Hide() override; | 266 void Hide() override; |
| 282 bool IsShowing() override; | 267 bool IsShowing() override; |
| 283 void WasUnOccluded() override; | 268 void WasUnOccluded() override; |
| 284 void WasOccluded() override; | 269 void WasOccluded() override; |
| 285 gfx::Rect GetViewBounds() const override; | 270 gfx::Rect GetViewBounds() const override; |
| 286 void SetShowingContextMenu(bool showing) override; | 271 void SetShowingContextMenu(bool showing) override; |
| 287 void SetActive(bool active) override; | 272 void SetActive(bool active) override; |
| 288 void SetWindowVisibility(bool visible) override; | |
| 289 void WindowFrameChanged() override; | |
| 290 void ShowDefinitionForSelection() override; | 273 void ShowDefinitionForSelection() override; |
| 291 bool SupportsSpeech() const override; | 274 bool SupportsSpeech() const override; |
| 292 void SpeakSelection() override; | 275 void SpeakSelection() override; |
| 293 bool IsSpeaking() const override; | 276 bool IsSpeaking() const override; |
| 294 void StopSpeaking() override; | 277 void StopSpeaking() override; |
| 295 void SetBackgroundColor(SkColor color) override; | 278 void SetBackgroundColor(SkColor color) override; |
| 296 | 279 |
| 297 // Implementation of RenderWidgetHostViewBase. | 280 // Implementation of RenderWidgetHostViewBase. |
| 298 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 281 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 299 const gfx::Rect& pos) override; | 282 const gfx::Rect& pos) override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 327 bool CanCopyToVideoFrame() const override; | 310 bool CanCopyToVideoFrame() const override; |
| 328 void BeginFrameSubscription( | 311 void BeginFrameSubscription( |
| 329 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override; | 312 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override; |
| 330 void EndFrameSubscription() override; | 313 void EndFrameSubscription() override; |
| 331 void OnSwapCompositorFrame(uint32_t output_surface_id, | 314 void OnSwapCompositorFrame(uint32_t output_surface_id, |
| 332 scoped_ptr<cc::CompositorFrame> frame) override; | 315 scoped_ptr<cc::CompositorFrame> frame) override; |
| 333 void ClearCompositorFrame() override; | 316 void ClearCompositorFrame() override; |
| 334 BrowserAccessibilityManager* CreateBrowserAccessibilityManager( | 317 BrowserAccessibilityManager* CreateBrowserAccessibilityManager( |
| 335 BrowserAccessibilityDelegate* delegate, bool for_root_frame) override; | 318 BrowserAccessibilityDelegate* delegate, bool for_root_frame) override; |
| 336 gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) override; | 319 gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) override; |
| 337 bool PostProcessEventForPluginIme( | |
| 338 const NativeWebKeyboardEvent& event) override; | |
| 339 | 320 |
| 340 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; | 321 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; |
| 341 void GetScreenInfo(blink::WebScreenInfo* results) override; | 322 void GetScreenInfo(blink::WebScreenInfo* results) override; |
| 342 bool GetScreenColorProfile(std::vector<char>* color_profile) override; | 323 bool GetScreenColorProfile(std::vector<char>* color_profile) override; |
| 343 gfx::Rect GetBoundsInRootWindow() override; | 324 gfx::Rect GetBoundsInRootWindow() override; |
| 344 void LockCompositingSurface() override; | 325 void LockCompositingSurface() override; |
| 345 void UnlockCompositingSurface() override; | 326 void UnlockCompositingSurface() override; |
| 346 | 327 |
| 347 bool LockMouse() override; | 328 bool LockMouse() override; |
| 348 void UnlockMouse() override; | 329 void UnlockMouse() override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 378 void OnDisplayMetricsChanged(const gfx::Display& display, | 359 void OnDisplayMetricsChanged(const gfx::Display& display, |
| 379 uint32_t metrics) override; | 360 uint32_t metrics) override; |
| 380 | 361 |
| 381 // Forwards the mouse event to the renderer. | 362 // Forwards the mouse event to the renderer. |
| 382 void ForwardMouseEvent(const blink::WebMouseEvent& event); | 363 void ForwardMouseEvent(const blink::WebMouseEvent& event); |
| 383 | 364 |
| 384 void KillSelf(); | 365 void KillSelf(); |
| 385 | 366 |
| 386 void SetTextInputActive(bool active); | 367 void SetTextInputActive(bool active); |
| 387 | 368 |
| 388 // Sends completed plugin IME notification and text back to the renderer. | |
| 389 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); | |
| 390 | |
| 391 const std::string& selected_text() const { return selected_text_; } | 369 const std::string& selected_text() const { return selected_text_; } |
| 392 const gfx::Range& composition_range() const { return composition_range_; } | 370 const gfx::Range& composition_range() const { return composition_range_; } |
| 393 const base::string16& selection_text() const { return selection_text_; } | 371 const base::string16& selection_text() const { return selection_text_; } |
| 394 size_t selection_text_offset() const { return selection_text_offset_; } | 372 size_t selection_text_offset() const { return selection_text_offset_; } |
| 395 | 373 |
| 396 // Returns true and stores first rectangle for character range if the | 374 // Returns true and stores first rectangle for character range if the |
| 397 // requested |range| is already cached, otherwise returns false. | 375 // requested |range| is already cached, otherwise returns false. |
| 398 // Exposed for testing. | 376 // Exposed for testing. |
| 399 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( | 377 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( |
| 400 NSRange range, NSRect* rect, NSRange* actual_range); | 378 NSRange range, NSRect* rect, NSRange* actual_range); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // ensure no dangling references. | 530 // ensure no dangling references. |
| 553 void ShutdownBrowserCompositor(); | 531 void ShutdownBrowserCompositor(); |
| 554 | 532 |
| 555 // The state of the the browser compositor and delegated frame host. See | 533 // The state of the the browser compositor and delegated frame host. See |
| 556 // BrowserCompositorViewState for details. | 534 // BrowserCompositorViewState for details. |
| 557 void EnsureBrowserCompositorView(); | 535 void EnsureBrowserCompositorView(); |
| 558 void SuspendBrowserCompositorView(); | 536 void SuspendBrowserCompositorView(); |
| 559 void DestroyBrowserCompositorView(); | 537 void DestroyBrowserCompositorView(); |
| 560 | 538 |
| 561 // IPC message handlers. | 539 // IPC message handlers. |
| 562 void OnPluginFocusChanged(bool focused, int plugin_id); | |
| 563 void OnStartPluginIme(); | |
| 564 void OnGetRenderedTextCompleted(const std::string& text); | 540 void OnGetRenderedTextCompleted(const std::string& text); |
| 565 | 541 |
| 566 // Send updated vsync parameters to the renderer. | 542 // Send updated vsync parameters to the renderer. |
| 567 void SendVSyncParametersToRenderer(); | 543 void SendVSyncParametersToRenderer(); |
| 568 | 544 |
| 569 // Dispatches a TTS session. | 545 // Dispatches a TTS session. |
| 570 void SpeakText(const std::string& text); | 546 void SpeakText(const std::string& text); |
| 571 | 547 |
| 572 // The associated view. This is weak and is inserted into the view hierarchy | 548 // The associated view. This is weak and is inserted into the view hierarchy |
| 573 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 549 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 | 601 |
| 626 // Factory used to safely scope delayed calls to ShutdownHost(). | 602 // Factory used to safely scope delayed calls to ShutdownHost(). |
| 627 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 603 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
| 628 | 604 |
| 629 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 605 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 630 }; | 606 }; |
| 631 | 607 |
| 632 } // namespace content | 608 } // namespace content |
| 633 | 609 |
| 634 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 610 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |