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

Side by Side Diff: chrome/browser/ui/views/browser_bubble.h

Issue 8068020: Converts usage of GetBrowserViewForNativeWindow to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback, and make ShowPageInfo platform specific Created 9 years, 2 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) 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 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_
6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "views/bubble/bubble_border.h" 9 #include "views/bubble/bubble_border.h"
10 #include "views/view.h" 10 #include "views/view.h"
11 #include "views/widget/widget.h" 11 #include "views/widget/widget.h"
12 12
13 class Browser;
13 class BrowserBubbleHost; 14 class BrowserBubbleHost;
14 15
15 // A class for creating a floating window that is "attached" to a particular 16 // A class for creating a floating window that is "attached" to a particular
16 // Browser. If you don't install a delegate, the bubble will hide 17 // Browser. If you don't install a delegate, the bubble will hide
17 // automatically when the browser moves. The bubble is only shown manually. 18 // automatically when the browser moves. The bubble is only shown manually.
18 // Users are expected to delete the bubble when finished with it. 19 // Users are expected to delete the bubble when finished with it.
19 // Class assumes that RTL related mirroring is done by the view. 20 // Class assumes that RTL related mirroring is done by the view.
20 class BrowserBubble { 21 class BrowserBubble {
21 public: 22 public:
22 // Delegate to browser bubble events. 23 // Delegate to browser bubble events.
23 class Delegate { 24 class Delegate {
24 public: 25 public:
25 // Called when the Browser Window that this bubble is attached to moves. 26 // Called when the Browser Window that this bubble is attached to moves.
26 virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble) {} 27 virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble) {}
27 28
28 // Called with the Browser Window that this bubble is attached to is 29 // Called with the Browser Window that this bubble is attached to is
29 // about to close. 30 // about to close.
30 virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble) {} 31 virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble) {}
31 32
32 // Called when the bubble became active / got focus. 33 // Called when the bubble became active / got focus.
33 virtual void BubbleGotFocus(BrowserBubble* bubble) {} 34 virtual void BubbleGotFocus(BrowserBubble* bubble) {}
34 35
35 // Called when the bubble became inactive / lost focus. 36 // Called when the bubble became inactive / lost focus.
36 // |lost_focus_to_child| is true when a child window became active. 37 // |lost_focus_to_child| is true when a child window became active.
37 virtual void BubbleLostFocus(BrowserBubble* bubble, 38 virtual void BubbleLostFocus(BrowserBubble* bubble,
38 bool lost_focus_to_child) {} 39 bool lost_focus_to_child) {}
39 }; 40 };
40 41
41 // Note that the bubble will size itself to the preferred size of |view| plus 42 // Note that the bubble will size itself to the preferred size of |view| plus
42 // insets of bubble border. |view| is the embedded view, |frame| is widget 43 // insets of bubble border. |view| is the embedded view, |browser| is the
43 // that the bubble is being positioned relative to, |relative_to| is the 44 // browser that the bubble is being positioned relative to, |relative_to| is
44 // location that the bubble is showing relative to in screen coordinates, 45 // the location that the bubble is showing relative to in screen coordinates,
45 // e.g. if the buuble is showing for a toolbar button, |relative_to| usually 46 // e.g. if the buuble is showing for a toolbar button, |relative_to| usually
46 // would be the bounds of the toolbar button in screen coordiates, 47 // would be the bounds of the toolbar button in screen coordiates,
47 // |arrow_location| is the location where the arrow should on the bubble. 48 // |arrow_location| is the location where the arrow should on the bubble.
48 BrowserBubble(views::View* view, 49 BrowserBubble(Browser* browser,
49 views::Widget* frame, 50 views::View* view,
50 const gfx::Rect& relative_to, 51 const gfx::Rect& relative_to,
51 views::BubbleBorder::ArrowLocation arrow_location); 52 views::BubbleBorder::ArrowLocation arrow_location);
52 virtual ~BrowserBubble(); 53 virtual ~BrowserBubble();
53 54
54 // Call manually if you need to detach the bubble from tracking the browser's 55 // Call manually if you need to detach the bubble from tracking the browser's
55 // position. Note that you must call this manually before deleting this 56 // position. Note that you must call this manually before deleting this
56 // object since it can't be safely called from the destructor. 57 // object since it can't be safely called from the destructor.
57 void DetachFromBrowser(); 58 void DetachFromBrowser();
58 59
59 // Normally called automatically during construction, but if DetachFromBrowser 60 // Normally called automatically during construction, but if DetachFromBrowser
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Is the bubble attached to a Browser window. 133 // Is the bubble attached to a Browser window.
133 bool attached_; 134 bool attached_;
134 135
135 // Non-owning pointer to the host of this bubble. 136 // Non-owning pointer to the host of this bubble.
136 BrowserBubbleHost* bubble_host_; 137 BrowserBubbleHost* bubble_host_;
137 138
138 DISALLOW_COPY_AND_ASSIGN(BrowserBubble); 139 DISALLOW_COPY_AND_ASSIGN(BrowserBubble);
139 }; 140 };
140 141
141 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_ 142 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698