Refactor ad hoc delegate methods into BrowserDelegate protocol.

This commit is contained in:
Corey Johnson
2012-02-29 17:30:50 -08:00
parent 670b9dc52d
commit 569bed9ee1
4 changed files with 18 additions and 7 deletions

View File

@@ -117,6 +117,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
042180E614FF080D00DF25EA /* BrowserDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserDelegate.h; sourceTree = "<group>"; };
0487C91214FED5360045E5E3 /* Atom.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Atom.app; sourceTree = BUILT_PRODUCTS_DIR; };
0487C91614FED5360045E5E3 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
0487C91914FED5360045E5E3 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -377,6 +378,7 @@
0487C93D14FED6090045E5E3 /* Atom.mm */,
0487C93E14FED6090045E5E3 /* AtomController.h */,
0487C93F14FED6090045E5E3 /* AtomController.mm */,
042180E614FF080D00DF25EA /* BrowserDelegate.h */,
0487C94014FED6090045E5E3 /* client_handler.h */,
0487C94114FED6090045E5E3 /* client_handler.mm */,
0487C94214FED6090045E5E3 /* main.mm */,

View File

@@ -1,3 +1,4 @@
#import "BrowserDelegate.h"
#import "include/cef.h"
#import "include/cef_application_mac.h"
@@ -5,7 +6,7 @@ class ClientHandler;
@class AtomController;
@interface Atom : NSApplication<CefAppProtocol> {
@interface Atom : NSApplication<CefAppProtocol, BrowserDelegate> {
NSView *_hiddenGlobalView;
BOOL handlingSendEvent_;
CefRefPtr<ClientHandler> _clientHandler;

View File

@@ -1,9 +1,11 @@
#import <Cocoa/Cocoa.h>
#import "BrowserDelegate.h"
#import "include/cef.h"
class ClientHandler;
@interface AtomController : NSWindowController <NSWindowDelegate> {
@interface AtomController : NSWindowController <NSWindowDelegate, BrowserDelegate> {
NSView *_webView;
NSString *_bootstrapScript;
NSString *_pathToOpen;
@@ -18,11 +20,6 @@ class ClientHandler;
- (void)createBrowser;
- (void)afterCreated;
- (void)loadStart;
- (bool)keyEventOfType:(cef_handler_keyevent_type_t)type code:(int)code modifiers:(int)modifiers isSystemKey:(bool)isSystemKey isAfterJavaScript:(bool)isAfterJavaScript;
@property (nonatomic, retain) IBOutlet NSView *webView;
@end

View File

@@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
#import "include/cef.h"
@protocol BrowserDelegate <NSObject>
@optional
- (void)afterCreated;
- (void)loadStart;
- (bool)keyEventOfType:(cef_handler_keyevent_type_t)type code:(int)code modifiers:(int)modifiers isSystemKey:(bool)isSystemKey isAfterJavaScript:(bool)isAfterJavaScript;
@end