Logo Search packages:      
Sourcecode: chromium-browser version File versions  Download package


// Copyright (c) 2010 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.


#include <string>

#include "base/basictypes.h"
#include "base/move.h"
#include "base/ref_counted.h"
#include "base/string16.h"
#include "chrome/browser/chromeos/notifications/balloon_collection_impl.h"
#include "chrome/browser/notifications/notification_delegate.h"
#include "googleurl/src/gurl.h"

class Profile;

namespace chromeos {

// The system notification object handles the display of a system notification

class SystemNotification {
  // The profile is the current user profile. The id is any string used
  // to uniquely identify this notification. The title is the title of
  // the message to be displayed. On creation, the message is hidden.
  SystemNotification(Profile* profile, std::string id, int icon_resource_id,
                     string16 title);


  // Show will show or update the message for this notification
  // on a transition to urgent, the notification will be shown if it was
  // previously hidden or minimized by the user.
  void Show(const string16& message, bool urgent);

  // Hide will dismiss the notification, if the notification is already
  // hidden it does nothing
  void Hide();

  // Current visibility state for this notification.
  bool visible() const { return visible_; }

  // Current urgent state for this notification.
  bool urgent() const { return urgent_; }

  class Delegate : public NotificationDelegate {
    explicit Delegate(std::string id) : id_(base::move(id)) {}
    void Display() {}
    void Error() {}
    void Close(bool by_user) {}
    std::string id() const { return id_; }

    std::string id_;


  Profile* profile_;
  BalloonCollectionImpl* collection_;
  scoped_refptr<Delegate> delegate_;
  GURL icon_;
  string16 title_;
  bool visible_;
  bool urgent_;


}  // namespace chromeos


Generated by  Doxygen 1.6.0   Back to index