Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Side by Side Diff: chrome/browser/ui/cocoa/base_bubble_controller.h

Issue 10392108: Only close popup bubble when a tab switch happens. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/mac/cocoa_protocols.h" 7 #import "base/mac/cocoa_protocols.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 9
10 namespace BaseBubbleControllerInternal {
11 class Bridge;
12 }
13
14 @class InfoBubbleView; 10 @class InfoBubbleView;
11 class TabStripModelObserverBridge;
15 12
16 // Base class for bubble controllers. Manages a xib that contains an 13 // Base class for bubble controllers. Manages a xib that contains an
17 // InfoBubbleWindow which contains an InfoBubbleView. Contains code to close 14 // InfoBubbleWindow which contains an InfoBubbleView. Contains code to close
18 // the bubble window on clicks outside of the window, and the like. 15 // the bubble window on clicks outside of the window, and the like.
19 // To use this class: 16 // To use this class:
20 // 1. Create a new xib that contains a window. Change the window's class to 17 // 1. Create a new xib that contains a window. Change the window's class to
21 // InfoBubbleWindow. Give it a child view that autosizes to the window's full 18 // InfoBubbleWindow. Give it a child view that autosizes to the window's full
22 // size, give it class InfoBubbleView. Make the controller the window's 19 // size, give it class InfoBubbleView. Make the controller the window's
23 // delegate. 20 // delegate.
24 // 2. Create a subclass of BaseBubbleController. 21 // 2. Create a subclass of BaseBubbleController.
25 // 3. Change the xib's File Owner to your subclass. 22 // 3. Change the xib's File Owner to your subclass.
26 // 4. Hook up the File Owner's |bubble_| to the InfoBubbleView in the xib. 23 // 4. Hook up the File Owner's |bubble_| to the InfoBubbleView in the xib.
27 @interface BaseBubbleController : NSWindowController<NSWindowDelegate> { 24 @interface BaseBubbleController : NSWindowController<NSWindowDelegate> {
28 @private 25 @private
29 NSWindow* parentWindow_; // weak 26 NSWindow* parentWindow_; // weak
30 NSPoint anchor_; 27 NSPoint anchor_;
31 IBOutlet InfoBubbleView* bubble_; // to set arrow position 28 IBOutlet InfoBubbleView* bubble_; // to set arrow position
32 // Bridge that listens for notifications. 29 // Bridge for tab change notifications.
33 scoped_ptr<BaseBubbleControllerInternal::Bridge> baseBridge_; 30 scoped_ptr<TabStripModelObserverBridge> tabStripObserverBridge_;
34 31
35 // Non-nil only on 10.7+. Both weak, owned by AppKit. 32 // Non-nil only on 10.7+. Both weak, owned by AppKit.
36 // A local event tap that will dismiss the bubble when a click is delivered 33 // A local event tap that will dismiss the bubble when a click is delivered
37 // outside the window. This is needed because the window shares first 34 // outside the window. This is needed because the window shares first
38 // responder with its parent. 35 // responder with its parent.
39 id eventTap_; 36 id eventTap_;
40 // A notification observer that gets triggered when any window resigns key. 37 // A notification observer that gets triggered when any window resigns key.
41 id resignationObserver_; 38 id resignationObserver_;
42 } 39 }
43 40
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 77
81 @end 78 @end
82 79
83 // Methods for use by subclasses. 80 // Methods for use by subclasses.
84 @interface BaseBubbleController (Protected) 81 @interface BaseBubbleController (Protected)
85 // Registers event taps *after* the window is shown so that the bubble is 82 // Registers event taps *after* the window is shown so that the bubble is
86 // dismissed when it resigns key. This only needs to be called if 83 // dismissed when it resigns key. This only needs to be called if
87 // |-showWindow:| is overriden and does not call super. Noop on OSes <10.7. 84 // |-showWindow:| is overriden and does not call super. Noop on OSes <10.7.
88 - (void)registerKeyStateEventTap; 85 - (void)registerKeyStateEventTap;
89 @end 86 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/base_bubble_controller.mm » ('j') | chrome/browser/ui/cocoa/base_bubble_controller.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698