| 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 // Draws the view for the balloons. | 5 // Draws the view for the balloons. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ | 7 #ifndef CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ |
| 8 #define CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ | 8 #define CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ |
| 9 | 9 |
| 10 #include "app/gfx/path.h" | 10 #include "app/gfx/path.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public views::View, | 38 public views::View, |
| 39 public NotificationObserver, | 39 public NotificationObserver, |
| 40 public AnimationDelegate { | 40 public AnimationDelegate { |
| 41 public: | 41 public: |
| 42 BalloonViewImpl(); | 42 BalloonViewImpl(); |
| 43 ~BalloonViewImpl(); | 43 ~BalloonViewImpl(); |
| 44 | 44 |
| 45 // BalloonView interface. | 45 // BalloonView interface. |
| 46 void Show(Balloon* balloon); | 46 void Show(Balloon* balloon); |
| 47 void RepositionToBalloon(); | 47 void RepositionToBalloon(); |
| 48 void Close(); | 48 void Close(bool by_user); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // Overridden from views::View. | 51 // Overridden from views::View. |
| 52 virtual void Paint(gfx::Canvas* canvas); | 52 virtual void Paint(gfx::Canvas* canvas); |
| 53 virtual void DidChangeBounds(const gfx::Rect& previous, | 53 virtual void DidChangeBounds(const gfx::Rect& previous, |
| 54 const gfx::Rect& current); | 54 const gfx::Rect& current); |
| 55 virtual gfx::Size GetPreferredSize() { | 55 virtual gfx::Size GetPreferredSize() { |
| 56 return gfx::Size(1000, 1000); | 56 return gfx::Size(1000, 1000); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // NotificationObserver method. | 59 // NotificationObserver method. |
| 60 virtual void Observe(NotificationType type, | 60 virtual void Observe(NotificationType type, |
| 61 const NotificationSource& source, | 61 const NotificationSource& source, |
| 62 const NotificationDetails& details); | 62 const NotificationDetails& details); |
| 63 | 63 |
| 64 // AnimationDelegate method. | 64 // AnimationDelegate method. |
| 65 virtual void AnimationProgressed(const Animation* animation); | 65 virtual void AnimationProgressed(const Animation* animation); |
| 66 | 66 |
| 67 // How to mask the balloon contents to fit within the frame. | 67 // How to mask the balloon contents to fit within the frame. |
| 68 // Populates |path| with the outline. | 68 // Populates |path| with the outline. |
| 69 void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const; | 69 void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const; |
| 70 | 70 |
| 71 // Adjust the contents window size to be appropriate for the frame. | 71 // Adjust the contents window size to be appropriate for the frame. |
| 72 void SizeContentsWindow(); | 72 void SizeContentsWindow(); |
| 73 | 73 |
| 74 // Do the delayed close work. | 74 // Do the delayed close work. |
| 75 void DelayedClose(); | 75 void DelayedClose(bool by_user); |
| 76 | 76 |
| 77 // The height of the balloon's shelf. | 77 // The height of the balloon's shelf. |
| 78 // The shelf is where is close button is located. | 78 // The shelf is where is close button is located. |
| 79 int GetShelfHeight() const; | 79 int GetShelfHeight() const; |
| 80 | 80 |
| 81 // The width of the frame (not including any shadow). | 81 // The width of the frame (not including any shadow). |
| 82 int GetFrameWidth() const; | 82 int GetFrameWidth() const; |
| 83 | 83 |
| 84 // The height of the frame (not including any shadow). | 84 // The height of the frame (not including any shadow). |
| 85 int GetTotalFrameHeight() const; | 85 int GetTotalFrameHeight() const; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 scoped_ptr<SlideAnimation> animation_; | 125 scoped_ptr<SlideAnimation> animation_; |
| 126 gfx::Rect anim_frame_start_; | 126 gfx::Rect anim_frame_start_; |
| 127 gfx::Rect anim_frame_end_; | 127 gfx::Rect anim_frame_end_; |
| 128 | 128 |
| 129 NotificationRegistrar notification_registrar_; | 129 NotificationRegistrar notification_registrar_; |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl); | 131 DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 #endif // CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ | 134 #endif // CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ |
| OLD | NEW |