- Add HTML5 drag&drop support (issue #140).
- Client application must now provide NSApplication implementing CefAppProtocol and call CefRunMessageLoop() (issue #248).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@269 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-08-02 16:50:06 +00:00
parent b2100d27bd
commit 7d006a8dd6
28 changed files with 1778 additions and 356 deletions

View File

@@ -3,67 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <AppKit/AppKit.h>
#include "include/cef.h"
#import "include/cef_application_mac.h"
#include "cef_process_ui_thread.h"
#include "browser_webkit_glue.h"
#include "base/message_pump_mac.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "third_party/WebKit/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.h"
// CrAppProtocol implementation.
@interface CrApplication : NSApplication<CrAppProtocol> {
@private
BOOL handlingSendEvent_;
}
- (BOOL)isHandlingSendEvent;
@end
@implementation CrApplication
- (BOOL)isHandlingSendEvent {
return handlingSendEvent_;
}
- (void)sendEvent:(NSEvent*)event {
BOOL wasHandlingSendEvent = handlingSendEvent_;
handlingSendEvent_ = YES;
[super sendEvent:event];
handlingSendEvent_ = wasHandlingSendEvent;
}
@end
namespace {
// Memory autorelease pool.
static NSAutoreleasePool* g_autopool = nil;
void RunLoopObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity,
void* info)
{
CefDoMessageLoopWork();
}
} // namespace
void CefProcessUIThread::PlatformInit() {
// Initialize the CrApplication instance.
[CrApplication sharedApplication];
g_autopool = [[NSAutoreleasePool alloc] init];
// The NSApplication instance must implement the CefAppProtocol protocol.
DCHECK([[NSApplication sharedApplication]
conformsToProtocol:@protocol(CefAppProtocol)]);
InitWebCoreSystemInterface();
// Register the run loop observer.
CFRunLoopObserverRef observer =
CFRunLoopObserverCreate(NULL,
kCFRunLoopBeforeWaiting,
YES, /* repeat */
0,
&RunLoopObserver,
NULL);
if (observer) {
CFRunLoopAddObserver(CFRunLoopGetCurrent(), observer,
kCFRunLoopCommonModes);
}
webkit_glue::InitializeDataPak();
// On Mac, the select popup menus are rendered by the browser.
@@ -71,6 +26,4 @@ void CefProcessUIThread::PlatformInit() {
}
void CefProcessUIThread::PlatformCleanUp() {
[g_autopool release];
}