| Index: chrome/browser/notifications/balloon_view_win.h
|
| diff --git a/chrome/browser/notifications/balloon_view_win.h b/chrome/browser/notifications/balloon_view_win.h
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..dde0b38dd136204856344eef96b1018f60fc506b
|
| --- /dev/null
|
| +++ b/chrome/browser/notifications/balloon_view_win.h
|
| @@ -0,0 +1,131 @@
|
| +// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Draws the view for the balloons.
|
| +
|
| +#ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_VIEW_H_
|
| +#define CHROME_BROWSER_NOTIFICATIONS_BALLOON_VIEW_H_
|
| +
|
| +#include "app/slide_animation.h"
|
| +#include "base/basictypes.h"
|
| +#include "base/gfx/point.h"
|
| +#include "base/gfx/rect.h"
|
| +#include "base/gfx/size.h"
|
| +#include "base/scoped_ptr.h"
|
| +#include "base/task.h"
|
| +#include "chrome/common/notification_registrar.h"
|
| +#include "chrome/common/notification_service.h"
|
| +#include "views/view.h"
|
| +
|
| +namespace views {
|
| +class WidgetWin;
|
| +class ImagePainter;
|
| +class TextButton;
|
| +class ButtonListener;
|
| +} // namespace views
|
| +
|
| +class Balloon;
|
| +class BalloonContents;
|
| +class NotificationDetails;
|
| +class NotificationSource;
|
| +
|
| +class SlideAnimation;
|
| +
|
| +class BalloonView : public views::View,
|
| + public NotificationObserver,
|
| + public AnimationDelegate {
|
| + public:
|
| + BalloonView();
|
| + ~BalloonView();
|
| + void Show(Balloon* balloon);
|
| + void RepositionToBalloon();
|
| + void Close();
|
| +
|
| + private:
|
| + // Overridden from views::View.
|
| + virtual void Paint(gfx::Canvas* canvas);
|
| + virtual void DidChangeBounds(const gfx::Rect& previous,
|
| + const gfx::Rect& current);
|
| + virtual gfx::Size GetPreferredSize() {
|
| + return gfx::Size(1000, 1000);
|
| + }
|
| +
|
| + // Initialize the view, parented to |parent|, and show it.
|
| + void Init(HWND parent);
|
| +
|
| + // NotificationObserver method.
|
| + virtual void Observe(NotificationType type,
|
| + const NotificationSource& source,
|
| + const NotificationDetails& details);
|
| +
|
| + // AnimationDelegate method.
|
| + virtual void AnimationProgressed(const Animation* animation);
|
| +
|
| + // How to mask the balloon contents to fit within the frame.
|
| + // The caller is responsible for deleting the returned object.
|
| + HRGN GetContentsMask(gfx::Rect& contents_rect) const;
|
| +
|
| + // Adjust the contents window size to be appropriate for the frame.
|
| + void SizeContentsWindow();
|
| +
|
| + // Do the delayed close work.
|
| + void DelayedClose();
|
| +
|
| + // True after Init() has completed.
|
| + bool initialized_;
|
| +
|
| + // The height of the balloon's shelf.
|
| + // The shelf is where is close button is located.
|
| + int shelf_height() const;
|
| +
|
| + // The width of the frame (not including any shadow).
|
| + int frame_width() const;
|
| +
|
| + // The height of the frame (not including any shadow).
|
| + int total_frame_height() const;
|
| +
|
| + // The height of the part of the frame around the balloon.
|
| + int balloon_frame_height() const;
|
| +
|
| + // Where the balloon contents should be placed with respect to the top left
|
| + // of the frame.
|
| + gfx::Point contents_offset() const;
|
| +
|
| + // Where the balloon contents should be in screen coordinates.
|
| + gfx::Rect contents_rectangle() const;
|
| +
|
| + // The associated balloon.
|
| + Balloon* balloon_;
|
| +
|
| + // The window that contains the BalloonFrame.
|
| + views::WidgetWin* frame_container_;
|
| +
|
| + // The window that contains the BalloonContents.
|
| + views::WidgetWin* html_container_;
|
| +
|
| + // The html content renderer.
|
| + BalloonContents* html_contents_;
|
| +
|
| + // The following factory is used to call methods at a later time.
|
| + ScopedRunnableMethodFactory<BalloonView> method_factory_;
|
| +
|
| + scoped_ptr<views::ImagePainter> shelf_background_;
|
| + scoped_ptr<views::ImagePainter> balloon_background_;
|
| +
|
| + views::TextButton* close_button_;
|
| + scoped_ptr<views::ButtonListener> close_button_listener_;
|
| +
|
| + // An animation to move the balloon on the screen as the collection
|
| + // changes.
|
| + scoped_ptr<SlideAnimation> animation_;
|
| + gfx::Rect anim_frame_start_;
|
| + gfx::Rect anim_frame_end_;
|
| +
|
| + NotificationRegistrar notification_registrar_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BalloonView);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_VIEW_H_
|
| +
|
|
|