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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
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 #include "base/memory/scoped_ptr.h" 7 #include <memory>
8
8 #include "components/bubble/bubble_reference.h" 9 #include "components/bubble/bubble_reference.h"
9 10
10 @class InfoBubbleView; 11 @class InfoBubbleView;
11 class TabStripModelObserverBridge; 12 class TabStripModelObserverBridge;
12 13
13 // Base class for bubble controllers. Manages a xib that contains an 14 // Base class for bubble controllers. Manages a xib that contains an
14 // InfoBubbleWindow which contains an InfoBubbleView. Contains code to close 15 // InfoBubbleWindow which contains an InfoBubbleView. Contains code to close
15 // the bubble window on clicks outside of the window, and the like. 16 // the bubble window on clicks outside of the window, and the like.
16 // To use this class: 17 // To use this class:
17 // 1. Create a new xib that contains a window. Change the window's class to 18 // 1. Create a new xib that contains a window. Change the window's class to
18 // InfoBubbleWindow. Give it a child view that autosizes to the window's full 19 // InfoBubbleWindow. Give it a child view that autosizes to the window's full
19 // size, give it class InfoBubbleView. Make the controller the window's 20 // size, give it class InfoBubbleView. Make the controller the window's
20 // delegate. 21 // delegate.
21 // 2. Create a subclass of BaseBubbleController. 22 // 2. Create a subclass of BaseBubbleController.
22 // 3. Change the xib's File Owner to your subclass. 23 // 3. Change the xib's File Owner to your subclass.
23 // 4. Hook up the File Owner's |bubble_| to the InfoBubbleView in the xib. 24 // 4. Hook up the File Owner's |bubble_| to the InfoBubbleView in the xib.
24 @interface BaseBubbleController : NSWindowController<NSWindowDelegate> { 25 @interface BaseBubbleController : NSWindowController<NSWindowDelegate> {
25 @private 26 @private
26 NSWindow* parentWindow_; // weak 27 NSWindow* parentWindow_; // weak
27 NSPoint anchor_; 28 NSPoint anchor_;
28 // Offset of the anchor point relative to the parent window's upper-left-hand 29 // Offset of the anchor point relative to the parent window's upper-left-hand
29 // corner. Used to ensure that if the parent window is resized with the bubble 30 // corner. Used to ensure that if the parent window is resized with the bubble
30 // remaining visible, the bubble continues to be anchored correctly. 31 // remaining visible, the bubble continues to be anchored correctly.
31 NSPoint anchorOffset_; 32 NSPoint anchorOffset_;
32 33
33 IBOutlet InfoBubbleView* bubble_; // to set arrow position 34 IBOutlet InfoBubbleView* bubble_; // to set arrow position
34 // Bridge for tab change notifications. 35 // Bridge for tab change notifications.
35 scoped_ptr<TabStripModelObserverBridge> tabStripObserverBridge_; 36 std::unique_ptr<TabStripModelObserverBridge> tabStripObserverBridge_;
36 37
37 // Non-nil only on 10.7+. Both weak, owned by AppKit. 38 // Non-nil only on 10.7+. Both weak, owned by AppKit.
38 // A local event tap that will dismiss the bubble when a click is delivered 39 // A local event tap that will dismiss the bubble when a click is delivered
39 // outside the window. This is needed because the window shares first 40 // outside the window. This is needed because the window shares first
40 // responder with its parent. 41 // responder with its parent.
41 id eventTap_; 42 id eventTap_;
42 // A notification observer that gets triggered when any window resigns key. 43 // A notification observer that gets triggered when any window resigns key.
43 id resignationObserver_; 44 id resignationObserver_;
44 // The controlled window should be the key window when it's opened. True by 45 // The controlled window should be the key window when it's opened. True by
45 // default. 46 // default.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 99
99 @end 100 @end
100 101
101 // Methods for use by subclasses. 102 // Methods for use by subclasses.
102 @interface BaseBubbleController (Protected) 103 @interface BaseBubbleController (Protected)
103 // Registers event taps *after* the window is shown so that the bubble is 104 // Registers event taps *after* the window is shown so that the bubble is
104 // dismissed when it resigns key. This only needs to be called if 105 // dismissed when it resigns key. This only needs to be called if
105 // |-showWindow:| is overriden and does not call super. Noop on OSes <10.7. 106 // |-showWindow:| is overriden and does not call super. Noop on OSes <10.7.
106 - (void)registerKeyStateEventTap; 107 - (void)registerKeyStateEventTap;
107 @end 108 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698