diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 22:55:41 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 22:55:41 +0000 |
commit | c4e78d797638462afc492e8eddc62f34e6b1eeaa (patch) | |
tree | c4814c0d0810ebfb52587ac6d313fb24d9b0cea8 /content/shell | |
parent | 85ec28cc3e98585a9c2931cb394605cc691ed603 (diff) | |
download | chromium_src-c4e78d797638462afc492e8eddc62f34e6b1eeaa.zip chromium_src-c4e78d797638462afc492e8eddc62f34e6b1eeaa.tar.gz chromium_src-c4e78d797638462afc492e8eddc62f34e6b1eeaa.tar.bz2 |
Mac content shell: Implement CrApplication.
BUG=115784
TEST=popup menus work in content shell
Review URL: https://chromiumcodereview.appspot.com/9834080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128790 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/shell_application_mac.h | 25 | ||||
-rw-r--r-- | content/shell/shell_application_mac.mm | 24 | ||||
-rw-r--r-- | content/shell/shell_browser_main_parts_mac.mm | 4 |
3 files changed, 53 insertions, 0 deletions
diff --git a/content/shell/shell_application_mac.h b/content/shell/shell_application_mac.h new file mode 100644 index 0000000..3450ff3 --- /dev/null +++ b/content/shell/shell_application_mac.h @@ -0,0 +1,25 @@ +// Copyright (c) 2012 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. + +#ifndef CONTENT_SHELL_SHELL_APPLICATION_MAC_H_ +#define CONTENT_SHELL_SHELL_APPLICATION_MAC_H_ + +#include "base/message_pump_mac.h" +#include "base/mac/scoped_sending_event.h" + +@interface ShellCrApplication : NSApplication<CrAppProtocol, + CrAppControlProtocol> { + @private + BOOL handlingSendEvent_; +} + +// CrAppProtocol: +- (BOOL)isHandlingSendEvent; + +// CrAppControlProtocol: +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent; + +@end + +#endif // CONTENT_SHELL_SHELL_APPLICATION_MAC_H_ diff --git a/content/shell/shell_application_mac.mm b/content/shell/shell_application_mac.mm new file mode 100644 index 0000000..8e816aa --- /dev/null +++ b/content/shell/shell_application_mac.mm @@ -0,0 +1,24 @@ +// Copyright (c) 2012 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. + +#include "content/shell/shell_application_mac.h" + +@implementation ShellCrApplication + +- (BOOL)isHandlingSendEvent { + return handlingSendEvent_; +} + +- (void)sendEvent:(NSEvent*)event { + BOOL wasHandlingSendEvent = handlingSendEvent_; + handlingSendEvent_ = YES; + [super sendEvent:event]; + handlingSendEvent_ = wasHandlingSendEvent; +} + +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { + handlingSendEvent_ = handlingSendEvent; +} + +@end diff --git a/content/shell/shell_browser_main_parts_mac.mm b/content/shell/shell_browser_main_parts_mac.mm index 1aeac32..687c161 100644 --- a/content/shell/shell_browser_main_parts_mac.mm +++ b/content/shell/shell_browser_main_parts_mac.mm @@ -8,10 +8,14 @@ #include "base/mac/bundle_locations.h" #include "base/memory/scoped_nsobject.h" +#include "content/shell/shell_application_mac.h" namespace content { void ShellBrowserMainParts::PreMainMessageLoopStart() { + // Force the NSApplication subclass to be used. + [ShellCrApplication sharedApplication]; + scoped_nsobject<NSNib> nib([[NSNib alloc] initWithNibNamed:@"MainMenu" bundle:base::mac::FrameworkBundle()]); |