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

Unified Diff: chrome/browser/notifications/balloon.h

Issue 338051: Adds UI components for desktop notifications, including balloon view classes ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: use notused.png resources for try servers Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/notifications/balloon.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/balloon.h
===================================================================
--- chrome/browser/notifications/balloon.h (revision 0)
+++ chrome/browser/notifications/balloon.h (revision 0)
@@ -0,0 +1,91 @@
+// 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.
+
+// Handles the visible notification (or balloons).
+
+#ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_
+#define CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_
+
+#include <vector>
+
+#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 "chrome/browser/notifications/notification.h"
+
+class Balloon;
+class Profile;
+class SiteInstance;
+
+// Interface for a view that displays a balloon.
+class BalloonView {
+ public:
+ virtual ~BalloonView() { }
+
+ // Show the view on the screen.
+ virtual void Show(Balloon* balloon) = 0;
+
+ // Reposition the view to match the position of its balloon.
+ virtual void RepositionToBalloon() = 0;
+
+ // Close the view.
+ virtual void Close() = 0;
+};
+
+// Represents a Notification on the screen.
+class Balloon {
+ public:
+ class BalloonCloseListener {
+ public:
+ virtual ~BalloonCloseListener() {}
+
+ // Called when a balloon is closed.
+ virtual void OnBalloonClosed(Balloon* source) = 0;
+ };
+
+ // |listener| may be null in unit tests w/o actual UI.
+ Balloon(const Notification& notification,
+ Profile* profile,
+ BalloonCloseListener* listener);
+ virtual ~Balloon();
+
+ const Notification& notification() const { return notification_; }
+ Profile* profile() const { return profile_; }
+
+ const gfx::Point& position() const { return position_; }
+ void SetPosition(const gfx::Point& upper_left, bool reposition);
+
+ const gfx::Size& size() const { return size_; }
+ void set_size(const gfx::Size& size) { size_ = size; }
+
+ // Provides a view for this balloon. Ownership transfers
+ // to this object.
+ void set_view(BalloonView* balloon_view);
+
+ virtual void Show();
+ virtual void Close(bool by_user);
+
+ private:
+ // Non-owned pointer to the profile.
+ Profile* profile_;
+
+ // The notification being shown in this balloon.
+ Notification notification_;
+
+ // A listener to be called when the balloon closes.
+ BalloonCloseListener* close_listener_;
+
+ // The actual UI element for the balloon.
+ scoped_ptr<BalloonView> balloon_view_;
+
+ // Position and size of the balloon on the screen.
+ gfx::Point position_;
+ gfx::Size size_;
+
+ DISALLOW_COPY_AND_ASSIGN(Balloon);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_
Property changes on: chrome\browser\notifications\balloon.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/notifications/balloon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698