| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/closure_blocks_leopard_compat.h" | |
| 10 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 11 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
| 12 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 13 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 15 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" | 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
| 16 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 18 | 17 |
| 19 @interface BaseBubbleController (Private) | 18 @interface BaseBubbleController (Private) |
| 20 - (void)updateOriginFromAnchor; | 19 - (void)updateOriginFromAnchor; |
| 21 - (void)activateTabWithContents:(TabContents*)newContents | 20 - (void)activateTabWithContents:(TabContents*)newContents |
| 22 previousContents:(TabContents*)oldContents | 21 previousContents:(TabContents*)oldContents |
| 23 atIndex:(NSInteger)index | 22 atIndex:(NSInteger)index |
| 24 userGesture:(bool)wasUserGesture; | 23 userGesture:(bool)wasUserGesture; |
| 25 @end | 24 @end |
| 26 | 25 |
| 27 #if !defined(MAC_OS_X_VERSION_10_6) || \ | |
| 28 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | |
| 29 typedef unsigned long long NSEventMask; | |
| 30 | |
| 31 @interface NSEvent (SnowLeopardDeclarations) | |
| 32 + (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask | |
| 33 handler:(NSEvent* (^)(NSEvent*))block; | |
| 34 + (void)removeMonitor:(id)eventMonitor; | |
| 35 @end | |
| 36 | |
| 37 @interface NSOperationQueue (SnowLeopardDeclarations) | |
| 38 + (id)mainQueue; | |
| 39 @end | |
| 40 | |
| 41 @interface NSNotificationCenter (SnowLeopardDeclarations) | |
| 42 - (id)addObserverForName:(NSString*)name | |
| 43 object:(id)obj | |
| 44 queue:(NSOperationQueue*)queue | |
| 45 usingBlock:(void (^)(NSNotification*))block; | |
| 46 @end | |
| 47 #endif // MAC_OS_X_VERSION_10_6 | |
| 48 | |
| 49 @implementation BaseBubbleController | 26 @implementation BaseBubbleController |
| 50 | 27 |
| 51 @synthesize parentWindow = parentWindow_; | 28 @synthesize parentWindow = parentWindow_; |
| 52 @synthesize anchorPoint = anchor_; | 29 @synthesize anchorPoint = anchor_; |
| 53 @synthesize bubble = bubble_; | 30 @synthesize bubble = bubble_; |
| 54 | 31 |
| 55 - (id)initWithWindowNibPath:(NSString*)nibPath | 32 - (id)initWithWindowNibPath:(NSString*)nibPath |
| 56 parentWindow:(NSWindow*)parentWindow | 33 parentWindow:(NSWindow*)parentWindow |
| 57 anchoredAt:(NSPoint)anchoredAt { | 34 anchoredAt:(NSPoint)anchoredAt { |
| 58 nibPath = [base::mac::FrameworkBundle() pathForResource:nibPath | 35 nibPath = [base::mac::FrameworkBundle() pathForResource:nibPath |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 270 |
| 294 - (void)activateTabWithContents:(TabContents*)newContents | 271 - (void)activateTabWithContents:(TabContents*)newContents |
| 295 previousContents:(TabContents*)oldContents | 272 previousContents:(TabContents*)oldContents |
| 296 atIndex:(NSInteger)index | 273 atIndex:(NSInteger)index |
| 297 userGesture:(bool)wasUserGesture { | 274 userGesture:(bool)wasUserGesture { |
| 298 // The user switched tabs; close. | 275 // The user switched tabs; close. |
| 299 [self close]; | 276 [self close]; |
| 300 } | 277 } |
| 301 | 278 |
| 302 @end // BaseBubbleController | 279 @end // BaseBubbleController |
| OLD | NEW |