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

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

Issue 119103: Part 1 of dragging extensions on the shelf. This part was just about getting... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « chrome/browser/extensions/extension_view.cc ('k') | chrome/browser/views/browser_bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ 5 #ifndef CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_
6 #define CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_ 6 #define CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_
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 12 matching lines...) Expand all
23 }; 23 };
24 24
25 // Note that the bubble will size itself to the preferred size of |view|. 25 // Note that the bubble will size itself to the preferred size of |view|.
26 // |view| is the embedded view, |frame| is widget that the bubble is being 26 // |view| is the embedded view, |frame| is widget that the bubble is being
27 // positioned relative to, |origin| is the location that the bubble will 27 // positioned relative to, |origin| is the location that the bubble will
28 // be positioned relative to |frame|. 28 // be positioned relative to |frame|.
29 BrowserBubble(views::View* view, views::Widget* frame, 29 BrowserBubble(views::View* view, views::Widget* frame,
30 const gfx::Point& origin); 30 const gfx::Point& origin);
31 virtual ~BrowserBubble(); 31 virtual ~BrowserBubble();
32 32
33 // Call manually if you need to detach the bubble from tracking the browser's
34 // position. Note that you must call this manually before deleting this
35 // object since it can't be safely called from the destructor.
36 void DetachFromBrowser();
37
38 // Normally called automatically during construction, but if DetachFromBrowser
39 // has been called manually, then this call will reattach.
40 void AttachToBrowser();
41
33 // Get/Set the delegate. 42 // Get/Set the delegate.
34 Delegate* delegate() const { return delegate_; } 43 Delegate* delegate() const { return delegate_; }
35 void set_delegate(Delegate* del) { delegate_ = del; } 44 void set_delegate(Delegate* del) { delegate_ = del; }
36 45
37 // Notifications from BrowserView. 46 // Notifications from BrowserView.
38 // With no delegate, both of these default to Hiding the bubble. 47 // With no delegate, both of these default to Hiding the bubble.
39 virtual void BrowserWindowMoved(); 48 virtual void BrowserWindowMoved();
40 virtual void BrowserWindowClosed(); 49 virtual void BrowserWindowClosed();
41 50
42 // Show or hide the bubble. 51 // Show or hide the bubble.
43 void Show(); 52 void Show();
44 void Hide(); 53 void Hide();
45 bool is_visible() const { return visible_; } 54 bool is_visible() const { return visible_; }
46 55
47 // The contained view. 56 // The contained view.
48 views::View* view() const { return view_; } 57 views::View* view() const { return view_; }
49 58
50 // Set the bounds of the bubble relative to the browser window. 59 // Set the bounds of the bubble relative to the browser window.
51 void SetBounds(int x, int y, int w, int h); 60 void SetBounds(int x, int y, int w, int h);
61 void MoveTo(int x, int y);
52 int width() { return bounds_.width(); } 62 int width() { return bounds_.width(); }
53 int height() { return bounds_.height(); } 63 int height() { return bounds_.height(); }
54 64
55 // Reposition the bubble - as we are using a WS_POPUP for the bubble, 65 // Reposition the bubble - as we are using a WS_POPUP for the bubble,
56 // we have to manually position it when the browser window moves. 66 // we have to manually position it when the browser window moves.
57 void Reposition(); 67 void Reposition();
58 68
69 // Resize the bubble to fit the view.
70 void ResizeToView();
71
59 protected: 72 protected:
60 // Create the popup widget. 73 // Create the popup widget.
61 virtual void InitPopup(); 74 virtual void InitPopup();
62 75
63 // Destroy the popup widget.
64 virtual void DestroyPopup();
65
66 // Move the popup to an absolute position. 76 // Move the popup to an absolute position.
67 void MovePopup(int x, int y, int w, int h); 77 void MovePopup(int x, int y, int w, int h);
68 78
69 private: 79 private:
70 // The frame that this bubble is attached to. 80 // The frame that this bubble is attached to.
71 views::Widget* frame_; 81 views::Widget* frame_;
82 gfx::NativeView frame_native_view_;
72 83
73 // The view that is displayed in this bubble. 84 // The view that is displayed in this bubble.
74 views::View* view_; 85 views::View* view_;
75 86
76 // The actual widget that this bubble is in. 87 // The widget that this bubble is in.
77 scoped_ptr<views::Widget> popup_; 88 scoped_ptr<views::Widget> popup_;
78 89
79 // The bounds relative to the frame. 90 // The bounds relative to the frame.
80 gfx::Rect bounds_; 91 gfx::Rect bounds_;
81 92
82 // Current visibility. 93 // Current visibility.
83 bool visible_; 94 bool visible_;
84 95
85 // The delegate isn't owned by the bubble. 96 // The delegate isn't owned by the bubble.
86 Delegate* delegate_; 97 Delegate* delegate_;
87 98
99 // Is the bubble attached to a Browser window.
100 bool attached_;
101
88 DISALLOW_COPY_AND_ASSIGN(BrowserBubble); 102 DISALLOW_COPY_AND_ASSIGN(BrowserBubble);
89 }; 103 };
90 104
91 #endif // CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_ 105 #endif // CHROME_BROWSER_VIEWS_BROWSER_BUBBLE_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_view.cc ('k') | chrome/browser/views/browser_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698