OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 | 912 |
913 // End of menubar observation code. | 913 // End of menubar observation code. |
914 | 914 |
915 // Begin (or end) watching for a click outside this window. Unlike | 915 // Begin (or end) watching for a click outside this window. Unlike |
916 // normal NSWindows, bookmark folder "fake menu" windows do not become | 916 // normal NSWindows, bookmark folder "fake menu" windows do not become |
917 // key or main. Thus, traditional notification (e.g. WillResignKey) | 917 // key or main. Thus, traditional notification (e.g. WillResignKey) |
918 // won't work. Our strategy is to watch (at the app level) for a | 918 // won't work. Our strategy is to watch (at the app level) for a |
919 // "click outside" these windows to detect when they logically lose | 919 // "click outside" these windows to detect when they logically lose |
920 // focus. | 920 // focus. |
921 - (void)watchForExitEvent:(BOOL)watch { | 921 - (void)watchForExitEvent:(BOOL)watch { |
922 CrApplication* app = static_cast<CrApplication*>([NSApplication | 922 BrowserCrApplication* app = static_cast<BrowserCrApplication*>( |
923 sharedApplication]); | 923 [BrowserCrApplication sharedApplication]); |
924 DCHECK([app isKindOfClass:[CrApplication class]]); | |
925 if (watch) { | 924 if (watch) { |
926 if (!watchingForExitEvent_) { | 925 if (!watchingForExitEvent_) { |
927 [app addEventHook:self]; | 926 [app addEventHook:self]; |
928 [self startObservingMenubar]; | 927 [self startObservingMenubar]; |
929 } | 928 } |
930 } else { | 929 } else { |
931 if (watchingForExitEvent_) { | 930 if (watchingForExitEvent_) { |
932 [app removeEventHook:self]; | 931 [app removeEventHook:self]; |
933 [self stopObservingMenubar]; | 932 [self stopObservingMenubar]; |
934 } | 933 } |
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 // to minimize touching the object passed in (likely a mock). | 2779 // to minimize touching the object passed in (likely a mock). |
2781 - (void)setButtonContextMenu:(id)menu { | 2780 - (void)setButtonContextMenu:(id)menu { |
2782 buttonContextMenu_ = menu; | 2781 buttonContextMenu_ = menu; |
2783 } | 2782 } |
2784 | 2783 |
2785 - (void)setIgnoreAnimations:(BOOL)ignore { | 2784 - (void)setIgnoreAnimations:(BOOL)ignore { |
2786 ignoreAnimations_ = ignore; | 2785 ignoreAnimations_ = ignore; |
2787 } | 2786 } |
2788 | 2787 |
2789 @end | 2788 @end |
OLD | NEW |