| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 bool HasFocus() const override; | 270 bool HasFocus() const override; |
| 279 bool IsSurfaceAvailableForCopy() const override; | 271 bool IsSurfaceAvailableForCopy() const override; |
| 280 void Show() override; | 272 void Show() override; |
| 281 void Hide() override; | 273 void Hide() override; |
| 282 bool IsShowing() override; | 274 bool IsShowing() override; |
| 283 void WasUnOccluded() override; | 275 void WasUnOccluded() override; |
| 284 void WasOccluded() override; | 276 void WasOccluded() override; |
| 285 gfx::Rect GetViewBounds() const override; | 277 gfx::Rect GetViewBounds() const override; |
| 286 void SetShowingContextMenu(bool showing) override; | 278 void SetShowingContextMenu(bool showing) override; |
| 287 void SetActive(bool active) override; | 279 void SetActive(bool active) override; |
| 288 void SetWindowVisibility(bool visible) override; | |
| 289 void WindowFrameChanged() override; | |
| 290 void ShowDefinitionForSelection() override; | 280 void ShowDefinitionForSelection() override; |
| 291 bool SupportsSpeech() const override; | 281 bool SupportsSpeech() const override; |
| 292 void SpeakSelection() override; | 282 void SpeakSelection() override; |
| 293 bool IsSpeaking() const override; | 283 bool IsSpeaking() const override; |
| 294 void StopSpeaking() override; | 284 void StopSpeaking() override; |
| 295 void SetBackgroundColor(SkColor color) override; | 285 void SetBackgroundColor(SkColor color) override; |
| 296 | 286 |
| 297 // Implementation of RenderWidgetHostViewBase. | 287 // Implementation of RenderWidgetHostViewBase. |
| 298 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 288 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 299 const gfx::Rect& pos) override; | 289 const gfx::Rect& pos) override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 327 bool CanCopyToVideoFrame() const override; | 317 bool CanCopyToVideoFrame() const override; |
| 328 void BeginFrameSubscription( | 318 void BeginFrameSubscription( |
| 329 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override; | 319 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override; |
| 330 void EndFrameSubscription() override; | 320 void EndFrameSubscription() override; |
| 331 void OnSwapCompositorFrame(uint32_t output_surface_id, | 321 void OnSwapCompositorFrame(uint32_t output_surface_id, |
| 332 scoped_ptr<cc::CompositorFrame> frame) override; | 322 scoped_ptr<cc::CompositorFrame> frame) override; |
| 333 void ClearCompositorFrame() override; | 323 void ClearCompositorFrame() override; |
| 334 BrowserAccessibilityManager* CreateBrowserAccessibilityManager( | 324 BrowserAccessibilityManager* CreateBrowserAccessibilityManager( |
| 335 BrowserAccessibilityDelegate* delegate, bool for_root_frame) override; | 325 BrowserAccessibilityDelegate* delegate, bool for_root_frame) override; |
| 336 gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) override; | 326 gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) override; |
| 337 bool PostProcessEventForPluginIme( | |
| 338 const NativeWebKeyboardEvent& event) override; | |
| 339 | 327 |
| 340 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; | 328 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; |
| 341 void GetScreenInfo(blink::WebScreenInfo* results) override; | 329 void GetScreenInfo(blink::WebScreenInfo* results) override; |
| 342 bool GetScreenColorProfile(std::vector<char>* color_profile) override; | 330 bool GetScreenColorProfile(std::vector<char>* color_profile) override; |
| 343 gfx::Rect GetBoundsInRootWindow() override; | 331 gfx::Rect GetBoundsInRootWindow() override; |
| 344 void LockCompositingSurface() override; | 332 void LockCompositingSurface() override; |
| 345 void UnlockCompositingSurface() override; | 333 void UnlockCompositingSurface() override; |
| 346 | 334 |
| 347 bool LockMouse() override; | 335 bool LockMouse() override; |
| 348 void UnlockMouse() override; | 336 void UnlockMouse() override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 378 void OnDisplayMetricsChanged(const gfx::Display& display, | 366 void OnDisplayMetricsChanged(const gfx::Display& display, |
| 379 uint32_t metrics) override; | 367 uint32_t metrics) override; |
| 380 | 368 |
| 381 // Forwards the mouse event to the renderer. | 369 // Forwards the mouse event to the renderer. |
| 382 void ForwardMouseEvent(const blink::WebMouseEvent& event); | 370 void ForwardMouseEvent(const blink::WebMouseEvent& event); |
| 383 | 371 |
| 384 void KillSelf(); | 372 void KillSelf(); |
| 385 | 373 |
| 386 void SetTextInputActive(bool active); | 374 void SetTextInputActive(bool active); |
| 387 | 375 |
| 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_; } | 376 const std::string& selected_text() const { return selected_text_; } |
| 392 const gfx::Range& composition_range() const { return composition_range_; } | 377 const gfx::Range& composition_range() const { return composition_range_; } |
| 393 const base::string16& selection_text() const { return selection_text_; } | 378 const base::string16& selection_text() const { return selection_text_; } |
| 394 size_t selection_text_offset() const { return selection_text_offset_; } | 379 size_t selection_text_offset() const { return selection_text_offset_; } |
| 395 | 380 |
| 396 // Returns true and stores first rectangle for character range if the | 381 // Returns true and stores first rectangle for character range if the |
| 397 // requested |range| is already cached, otherwise returns false. | 382 // requested |range| is already cached, otherwise returns false. |
| 398 // Exposed for testing. | 383 // Exposed for testing. |
| 399 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( | 384 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( |
| 400 NSRange range, NSRect* rect, NSRange* actual_range); | 385 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. | 537 // ensure no dangling references. |
| 553 void ShutdownBrowserCompositor(); | 538 void ShutdownBrowserCompositor(); |
| 554 | 539 |
| 555 // The state of the the browser compositor and delegated frame host. See | 540 // The state of the the browser compositor and delegated frame host. See |
| 556 // BrowserCompositorViewState for details. | 541 // BrowserCompositorViewState for details. |
| 557 void EnsureBrowserCompositorView(); | 542 void EnsureBrowserCompositorView(); |
| 558 void SuspendBrowserCompositorView(); | 543 void SuspendBrowserCompositorView(); |
| 559 void DestroyBrowserCompositorView(); | 544 void DestroyBrowserCompositorView(); |
| 560 | 545 |
| 561 // IPC message handlers. | 546 // IPC message handlers. |
| 562 void OnPluginFocusChanged(bool focused, int plugin_id); | |
| 563 void OnStartPluginIme(); | |
| 564 void OnGetRenderedTextCompleted(const std::string& text); | 547 void OnGetRenderedTextCompleted(const std::string& text); |
| 565 | 548 |
| 566 // Send updated vsync parameters to the renderer. | 549 // Send updated vsync parameters to the renderer. |
| 567 void SendVSyncParametersToRenderer(); | 550 void SendVSyncParametersToRenderer(); |
| 568 | 551 |
| 569 // Dispatches a TTS session. | 552 // Dispatches a TTS session. |
| 570 void SpeakText(const std::string& text); | 553 void SpeakText(const std::string& text); |
| 571 | 554 |
| 572 // The associated view. This is weak and is inserted into the view hierarchy | 555 // 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 | 556 // 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 | 608 |
| 626 // Factory used to safely scope delayed calls to ShutdownHost(). | 609 // Factory used to safely scope delayed calls to ShutdownHost(). |
| 627 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 610 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
| 628 | 611 |
| 629 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 612 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 630 }; | 613 }; |
| 631 | 614 |
| 632 } // namespace content | 615 } // namespace content |
| 633 | 616 |
| 634 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 617 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |