| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEWS_BROWSER_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_H_ | 6 #define CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_H_ |
| 7 | 7 |
| 8 #include "views/view.h" | 8 #include "views/view.h" |
| 9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble) {} | 22 virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble) {} |
| 23 | 23 |
| 24 // Called with the Browser Window that this bubble is attached to is | 24 // Called with the Browser Window that this bubble is attached to is |
| 25 // about to close. | 25 // about to close. |
| 26 virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble) {} | 26 virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble) {} |
| 27 | 27 |
| 28 // Called when the bubble became active / got focus. | 28 // Called when the bubble became active / got focus. |
| 29 virtual void BubbleGotFocus(BrowserBubble* bubble) {} | 29 virtual void BubbleGotFocus(BrowserBubble* bubble) {} |
| 30 | 30 |
| 31 // Called when the bubble became inactive / lost focus. | 31 // Called when the bubble became inactive / lost focus. |
| 32 virtual void BubbleLostFocus(BrowserBubble* bubble) {} | 32 // |focused_view| is the NativeView getting the focus, it may be NULL if the |
| 33 // popup was closed programatically. |
| 34 virtual void BubbleLostFocus(BrowserBubble* bubble, |
| 35 gfx::NativeView focused_view) {} |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 // Note that the bubble will size itself to the preferred size of |view|. | 38 // Note that the bubble will size itself to the preferred size of |view|. |
| 36 // |view| is the embedded view, |frame| is widget that the bubble is being | 39 // |view| is the embedded view, |frame| is widget that the bubble is being |
| 37 // positioned relative to, |origin| is the location that the bubble will | 40 // positioned relative to, |origin| is the location that the bubble will |
| 38 // be positioned relative to |frame|. | 41 // be positioned relative to |frame|. |
| 39 BrowserBubble(views::View* view, views::Widget* frame, | 42 BrowserBubble(views::View* view, views::Widget* frame, |
| 40 const gfx::Point& origin); | 43 const gfx::Point& origin); |
| 41 virtual ~BrowserBubble(); | 44 virtual ~BrowserBubble(); |
| 42 | 45 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 int height() { return bounds_.height(); } | 77 int height() { return bounds_.height(); } |
| 75 const gfx::Rect& bounds() const { return bounds_; } | 78 const gfx::Rect& bounds() const { return bounds_; } |
| 76 | 79 |
| 77 // Reposition the bubble - as we are using a WS_POPUP for the bubble, | 80 // Reposition the bubble - as we are using a WS_POPUP for the bubble, |
| 78 // we have to manually position it when the browser window moves. | 81 // we have to manually position it when the browser window moves. |
| 79 void Reposition(); | 82 void Reposition(); |
| 80 | 83 |
| 81 // Resize the bubble to fit the view. | 84 // Resize the bubble to fit the view. |
| 82 void ResizeToView(); | 85 void ResizeToView(); |
| 83 | 86 |
| 87 // Returns the NativeView containing that popup. |
| 88 gfx::NativeView native_view() const { return frame_native_view_; } |
| 89 |
| 84 protected: | 90 protected: |
| 85 // Create the popup widget. | 91 // Create the popup widget. |
| 86 virtual void InitPopup(); | 92 virtual void InitPopup(); |
| 87 | 93 |
| 88 // Move the popup to an absolute position. | 94 // Move the popup to an absolute position. |
| 89 void MovePopup(int x, int y, int w, int h); | 95 void MovePopup(int x, int y, int w, int h); |
| 90 | 96 |
| 91 // The widget that this bubble is in. | 97 // The widget that this bubble is in. |
| 92 views::Widget* popup_; | 98 views::Widget* popup_; |
| 93 | 99 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 108 // The delegate isn't owned by the bubble. | 114 // The delegate isn't owned by the bubble. |
| 109 Delegate* delegate_; | 115 Delegate* delegate_; |
| 110 | 116 |
| 111 // Is the bubble attached to a Browser window. | 117 // Is the bubble attached to a Browser window. |
| 112 bool attached_; | 118 bool attached_; |
| 113 | 119 |
| 114 DISALLOW_COPY_AND_ASSIGN(BrowserBubble); | 120 DISALLOW_COPY_AND_ASSIGN(BrowserBubble); |
| 115 }; | 121 }; |
| 116 | 122 |
| 117 #endif // CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_H_ | 123 #endif // CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_H_ |
| OLD | NEW |