2010-10-23 19:00:47 +02:00
|
|
|
// Copyright (c) 2008 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_WEBVIEW_MAC_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_WEBVIEW_MAC_H_
|
|
|
|
#pragma once
|
|
|
|
|
2010-10-23 19:00:47 +02:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2011-09-16 18:17:19 +02:00
|
|
|
#import "base/mac/cocoa_protocols.h"
|
2012-06-07 20:41:32 +02:00
|
|
|
#include "base/string16.h"
|
2011-08-02 18:50:06 +02:00
|
|
|
#include "base/memory/scoped_nsobject.h"
|
2012-06-07 20:41:32 +02:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
|
|
|
|
#include <Vector>
|
2010-10-23 19:00:47 +02:00
|
|
|
|
|
|
|
class CefBrowserImpl;
|
2011-08-02 18:50:06 +02:00
|
|
|
@class WebDragSource;
|
|
|
|
@class WebDropTarget;
|
|
|
|
struct WebDropData;
|
2010-10-23 19:00:47 +02:00
|
|
|
|
|
|
|
// A view to wrap the WebCore view and help it live in a Cocoa world. The
|
|
|
|
// (rough) equivalent of Apple's WebView.
|
|
|
|
|
2012-06-07 20:41:32 +02:00
|
|
|
@interface BrowserWebView : NSView<NSTextInputClient> {
|
2010-10-23 19:00:47 +02:00
|
|
|
@private
|
2012-01-10 00:46:23 +01:00
|
|
|
CefBrowserImpl* browser_; // weak
|
|
|
|
NSTrackingArea* trackingArea_;
|
2012-04-02 21:05:42 +02:00
|
|
|
bool is_in_setfocus_;
|
2011-08-02 18:50:06 +02:00
|
|
|
|
|
|
|
scoped_nsobject<WebDragSource> dragSource_;
|
|
|
|
scoped_nsobject<WebDropTarget> dropTarget_;
|
2012-06-07 20:41:32 +02:00
|
|
|
|
|
|
|
// Represents the input-method attributes supported by this object.
|
|
|
|
scoped_nsobject<NSArray> validAttributesForMarkedText_;
|
|
|
|
|
|
|
|
// Indicates if we are currently handling a key down event.
|
|
|
|
BOOL handlingKeyDown_;
|
|
|
|
|
|
|
|
// Indicates if there is any marked text.
|
|
|
|
BOOL hasMarkedText_;
|
|
|
|
|
|
|
|
// Indicates if unmarkText is called or not when handling a keyboard
|
|
|
|
// event.
|
|
|
|
BOOL unmarkTextCalled_;
|
|
|
|
|
|
|
|
// The range of current marked text inside the whole content of the DOM node
|
|
|
|
// being edited.
|
|
|
|
// TODO(suzhe): This is currently a fake value, as we do not support accessing
|
|
|
|
// the whole content yet.
|
|
|
|
NSRange markedRange_;
|
|
|
|
|
|
|
|
// The selected range, cached from a message sent by the renderer.
|
|
|
|
NSRange selectedRange_;
|
|
|
|
|
|
|
|
// Text to be inserted which was generated by handling a key down event.
|
|
|
|
string16 textToBeInserted_;
|
|
|
|
|
|
|
|
// Marked text which was generated by handling a key down event.
|
|
|
|
string16 markedText_;
|
|
|
|
|
|
|
|
// Underline information of the |markedText_|.
|
|
|
|
std::vector<WebKit::WebCompositionUnderline> underlines_;
|
2010-10-23 19:00:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)mouseDown:(NSEvent *)theEvent;
|
|
|
|
- (void)rightMouseDown:(NSEvent *)theEvent;
|
|
|
|
- (void)otherMouseDown:(NSEvent *)theEvent;
|
|
|
|
- (void)mouseUp:(NSEvent *)theEvent;
|
|
|
|
- (void)rightMouseUp:(NSEvent *)theEvent;
|
|
|
|
- (void)otherMouseUp:(NSEvent *)theEvent;
|
|
|
|
- (void)mouseMoved:(NSEvent *)theEvent;
|
|
|
|
- (void)mouseDragged:(NSEvent *)theEvent;
|
|
|
|
- (void)scrollWheel:(NSEvent *)theEvent;
|
|
|
|
- (void)rightMouseDragged:(NSEvent *)theEvent;
|
|
|
|
- (void)otherMouseDragged:(NSEvent *)theEvent;
|
|
|
|
- (void)mouseEntered:(NSEvent *)theEvent;
|
|
|
|
- (void)mouseExited:(NSEvent *)theEvent;
|
|
|
|
- (void)keyDown:(NSEvent *)theEvent;
|
|
|
|
- (void)keyUp:(NSEvent *)theEvent;
|
|
|
|
- (BOOL)isOpaque;
|
|
|
|
- (void)setFrame:(NSRect)frameRect;
|
|
|
|
|
2012-09-26 18:42:42 +02:00
|
|
|
// Forward the keyboard event to the editor
|
|
|
|
- (void)forwardKeyEventToEditor: (NSEvent *)theEvent;
|
|
|
|
|
2011-08-02 19:30:11 +02:00
|
|
|
// Register this WebView as a drag/drop target.
|
|
|
|
- (void)registerDragDrop;
|
|
|
|
|
2011-08-02 18:50:06 +02:00
|
|
|
// Called from BrowserWebViewDelegate::startDragging() to initiate dragging.
|
|
|
|
- (void)startDragWithDropData:(const WebDropData&)dropData
|
|
|
|
dragOperationMask:(NSDragOperation)operationMask
|
|
|
|
image:(NSImage*)image
|
|
|
|
offset:(NSPoint)offset;
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
@property (nonatomic, assign) CefBrowserImpl* browser;
|
2012-04-02 21:05:42 +02:00
|
|
|
@property (nonatomic, assign) bool in_setfocus;
|
2010-10-23 19:00:47 +02:00
|
|
|
|
|
|
|
@end
|
2012-01-10 00:46:23 +01:00
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_WEBVIEW_MAC_H_
|