1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_
6 #define UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/strings/string16.h"
11 #import "ui/base/cocoa/tool_tip_base_view.h"
12 #import "ui/base/cocoa/tracking_area.h"
15 class TextInputClient
;
22 // The NSView that sits as the root contentView of the NSWindow, whilst it has
23 // a views::RootView present. Bridges requests from Cocoa to the hosted
25 @interface BridgedContentView
26 : ToolTipBaseView
<NSTextInputClient
, NSUserInterfaceValidations
> {
28 // Weak. The hosted RootView, owned by hostedView_->GetWidget().
29 views::View
* hostedView_
;
31 // Weak. If non-null the TextInputClient of the currently focused View in the
32 // hierarchy rooted at |hostedView_|. Owned by the focused View.
33 ui::TextInputClient
* textInputClient_
;
35 // A tracking area installed to enable mouseMoved events.
36 ui::ScopedCrTrackingArea cursorTrackingArea_
;
38 // Whether the view is reacting to a keyDown event on the view.
41 // The last tooltip text, used to limit updates.
42 base::string16 lastTooltipText_
;
45 @
property(readonly
, nonatomic
) views::View
* hostedView
;
46 @
property(assign
, nonatomic
) ui::TextInputClient
* textInputClient
;
48 // Initialize the NSView -> views::View bridge. |viewToHost| must be non-NULL.
49 - (id
)initWithView
:(views::View
*)viewToHost
;
51 // Clear the hosted view. For example, if it is about to be destroyed.
54 // Process a mouse event captured while the widget had global mouse capture.
55 - (void)processCapturedMouseEvent
:(NSEvent
*)theEvent
;
57 // Mac's version of views::corewm::TooltipController::UpdateIfRequired().
58 // Updates the tooltip on the ToolTipBaseView if the text needs to change.
59 // |locationInContent| is the position from the top left of the window's
60 // contentRect (also this NSView's frame), as given by a ui::LocatedEvent.
61 - (void)updateTooltipIfRequiredAt
:(const gfx::Point
&)locationInContent
;
65 #endif // UI_VIEWS_COCOA_BRIDGED_CONTENT_VIEW_H_