| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_PINNED_CONTENTS_INFO_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_ | 6 #define CHROME_BROWSER_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/views/info_bubble.h" | 8 #include "chrome/browser/views/info_bubble.h" |
| 9 | 9 |
| 10 // This is a specialization of BorderContents, used to draw a border around | 10 // This is a specialization of BorderContents, used to draw a border around |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 gfx::Rect* contents_bounds, // Returned in window coordinates | 24 gfx::Rect* contents_bounds, // Returned in window coordinates |
| 25 gfx::Rect* window_bounds); // Returned in screen coordinates | 25 gfx::Rect* window_bounds); // Returned in screen coordinates |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 // The location of the pinned contents (in screen coordinates). | 28 // The location of the pinned contents (in screen coordinates). |
| 29 const gfx::Point bubble_anchor_; | 29 const gfx::Point bubble_anchor_; |
| 30 | 30 |
| 31 DISALLOW_COPY_AND_ASSIGN(PinnedContentsBorderContents); | 31 DISALLOW_COPY_AND_ASSIGN(PinnedContentsBorderContents); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 #if defined(OS_WIN) | |
| 35 // The window that surrounds the info bubble. See base class for details. | |
| 36 class PinnedContentsBorderWidget : public BorderWidget { | |
| 37 public: | |
| 38 explicit PinnedContentsBorderWidget(const gfx::Point& bubble_anchor) | |
| 39 : bubble_anchor_(bubble_anchor) {} | |
| 40 virtual ~PinnedContentsBorderWidget() {} | |
| 41 | |
| 42 // BorderWidget overrides: | |
| 43 virtual BorderContents* CreateBorderContents(); | |
| 44 | |
| 45 private: | |
| 46 // The location of the pinned contents (in screen coordinates). | |
| 47 const gfx::Point bubble_anchor_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(PinnedContentsBorderWidget); | |
| 50 }; | |
| 51 #endif | |
| 52 | |
| 53 // A specialization of the InfoBubble. Used to draw an InfoBubble which, in | 34 // A specialization of the InfoBubble. Used to draw an InfoBubble which, in |
| 54 // addition to having an arrow pointing to where the user clicked, also shifts | 35 // addition to having an arrow pointing to where the user clicked, also shifts |
| 55 // the bubble horizontally to fix it to a specific location. See base class | 36 // the bubble horizontally to fix it to a specific location. See base class |
| 56 // for details. | 37 // for details. |
| 57 class PinnedContentsInfoBubble : public InfoBubble { | 38 class PinnedContentsInfoBubble : public InfoBubble { |
| 58 public: | 39 public: |
| 59 // Shows the InfoBubble (see base class function for details). | 40 // Shows the InfoBubble (see base class function for details). |
| 60 // |bubble_anchor| specifies how far horizontally to shift the bubble in | 41 // |bubble_anchor| specifies how far horizontally to shift the bubble in |
| 61 // order to anchor its contents. Once the InfoBubble has been anchored its | 42 // order to anchor its contents. Once the InfoBubble has been anchored its |
| 62 // arrow may be pointing to a slightly different |y| location than specified | 43 // arrow may be pointing to a slightly different |y| location than specified |
| 63 // in |position_relative_to|. | 44 // in |position_relative_to|. |
| 64 static PinnedContentsInfoBubble* Show( | 45 static PinnedContentsInfoBubble* Show( |
| 65 views::Widget* parent, | 46 views::Widget* parent, |
| 66 const gfx::Rect& position_relative_to, | 47 const gfx::Rect& position_relative_to, |
| 67 BubbleBorder::ArrowLocation arrow_location, | 48 BubbleBorder::ArrowLocation arrow_location, |
| 68 const gfx::Point& bubble_anchor_, | 49 const gfx::Point& bubble_anchor_, |
| 69 views::View* contents, | 50 views::View* contents, |
| 70 InfoBubbleDelegate* delegate); | 51 InfoBubbleDelegate* delegate); |
| 71 | 52 |
| 53 // InfoBubble overrides: |
| 54 virtual BorderContents* CreateBorderContents(); |
| 55 |
| 72 private: | 56 private: |
| 73 explicit PinnedContentsInfoBubble(const gfx::Point& bubble_anchor) | 57 explicit PinnedContentsInfoBubble(const gfx::Point& bubble_anchor) |
| 74 : bubble_anchor_(bubble_anchor) {} | 58 : bubble_anchor_(bubble_anchor) {} |
| 75 virtual ~PinnedContentsInfoBubble() {} | 59 virtual ~PinnedContentsInfoBubble() {} |
| 76 | 60 |
| 77 // InfoBubble overrides: | |
| 78 #if defined(OS_WIN) | |
| 79 virtual BorderWidget* CreateBorderWidget(); | |
| 80 #endif | |
| 81 | |
| 82 // The location of the pinned contents (in screen coordinates). | 61 // The location of the pinned contents (in screen coordinates). |
| 83 const gfx::Point bubble_anchor_; | 62 const gfx::Point bubble_anchor_; |
| 84 | 63 |
| 85 DISALLOW_COPY_AND_ASSIGN(PinnedContentsInfoBubble); | 64 DISALLOW_COPY_AND_ASSIGN(PinnedContentsInfoBubble); |
| 86 }; | 65 }; |
| 87 | 66 |
| 88 #endif // CHROME_BROWSER_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_ | 67 #endif // CHROME_BROWSER_VIEWS_PINNED_CONTENTS_INFO_BUBBLE_H_ |
| OLD | NEW |