| 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/menus/simple_menu_model.h" | 10 #include "app/menus/simple_menu_model.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // AnimationDelegate interface. | 96 // AnimationDelegate interface. |
| 97 virtual void AnimationProgressed(const Animation* animation); | 97 virtual void AnimationProgressed(const Animation* animation); |
| 98 | 98 |
| 99 // Launches the options menu at screen coordinates |pt|. | 99 // Launches the options menu at screen coordinates |pt|. |
| 100 void RunOptionsMenu(const gfx::Point& pt); | 100 void RunOptionsMenu(const gfx::Point& pt); |
| 101 | 101 |
| 102 // Initializes the options menu. | 102 // Initializes the options menu. |
| 103 void CreateOptionsMenu(); | 103 void CreateOptionsMenu(); |
| 104 | 104 |
| 105 // How to mask the balloon contents to fit within the frame. | 105 // Masks the contents to fit within the frame. |
| 106 // Populates |path| with the outline. | |
| 107 void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const; | 106 void GetContentsMask(const gfx::Rect& contents_rect, gfx::Path* path) const; |
| 108 | 107 |
| 108 // Masks the frame for the rounded corners of the shadow-bubble. |
| 109 void GetFrameMask(const gfx::Rect&, gfx::Path* path) const; |
| 110 |
| 109 // Adjust the contents window size to be appropriate for the frame. | 111 // Adjust the contents window size to be appropriate for the frame. |
| 110 void SizeContentsWindow(); | 112 void SizeContentsWindow(); |
| 111 | 113 |
| 112 // Do the delayed close work. | 114 // Do the delayed close work. |
| 113 void DelayedClose(bool by_user); | 115 void DelayedClose(bool by_user); |
| 114 | 116 |
| 115 // The height of the balloon's shelf. | 117 // The height of the balloon's shelf. |
| 116 // The shelf is where is close button is located. | 118 // The shelf is where is close button is located. |
| 117 int GetShelfHeight() const; | 119 int GetShelfHeight() const; |
| 118 | 120 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 146 // The window that contains the contents of the notification. | 148 // The window that contains the contents of the notification. |
| 147 // Pointer owned by the View subclass. | 149 // Pointer owned by the View subclass. |
| 148 views::Widget* html_container_; | 150 views::Widget* html_container_; |
| 149 | 151 |
| 150 // The renderer of the HTML contents. | 152 // The renderer of the HTML contents. |
| 151 scoped_ptr<BalloonViewHost> html_contents_; | 153 scoped_ptr<BalloonViewHost> html_contents_; |
| 152 | 154 |
| 153 // The following factory is used to call methods at a later time. | 155 // The following factory is used to call methods at a later time. |
| 154 ScopedRunnableMethodFactory<BalloonViewImpl> method_factory_; | 156 ScopedRunnableMethodFactory<BalloonViewImpl> method_factory_; |
| 155 | 157 |
| 156 // Image painters for the frame of the toast. | |
| 157 scoped_ptr<views::Painter> shelf_background_; | |
| 158 scoped_ptr<views::Painter> balloon_background_; | |
| 159 | |
| 160 // Pointer to sub-view is owned by the View sub-class. | 158 // Pointer to sub-view is owned by the View sub-class. |
| 161 views::ImageButton* close_button_; | 159 views::ImageButton* close_button_; |
| 162 | 160 |
| 163 // Pointer to sub-view is owned by View class. | 161 // Pointer to sub-view is owned by View class. |
| 164 views::Label* source_label_; | 162 views::Label* source_label_; |
| 165 | 163 |
| 166 // An animation to move the balloon on the screen as its position changes. | 164 // An animation to move the balloon on the screen as its position changes. |
| 167 scoped_ptr<SlideAnimation> animation_; | 165 scoped_ptr<SlideAnimation> animation_; |
| 168 gfx::Rect anim_frame_start_; | 166 gfx::Rect anim_frame_start_; |
| 169 gfx::Rect anim_frame_end_; | 167 gfx::Rect anim_frame_end_; |
| 170 | 168 |
| 171 // The options menu. | 169 // The options menu. |
| 172 scoped_ptr<menus::SimpleMenuModel> options_menu_contents_; | 170 scoped_ptr<menus::SimpleMenuModel> options_menu_contents_; |
| 173 scoped_ptr<views::Menu2> options_menu_menu_; | 171 scoped_ptr<views::Menu2> options_menu_menu_; |
| 174 views::MenuButton* options_menu_button_; | 172 views::MenuButton* options_menu_button_; |
| 175 | 173 |
| 176 NotificationRegistrar notification_registrar_; | 174 NotificationRegistrar notification_registrar_; |
| 177 | 175 |
| 178 DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl); | 176 DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl); |
| 179 }; | 177 }; |
| 180 | 178 |
| 181 #endif // CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ | 179 #endif // CHROME_BROWSER_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ |
| OLD | NEW |