summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/notification/download_notification.h
blob: 3f1a1a447b1fc01ae591729cfa78881fea5ccd0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2015 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.

#ifndef CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_H_
#define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_H_

#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/download/download_commands.h"
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/notifications/notification_delegate.h"
#include "chrome/browser/notifications/notification_test_util.h"
#include "content/public/browser/download_item.h"
#include "grit/theme_resources.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_observer.h"

namespace test {
class DownloadItemNotificationTest;
}

class DownloadNotificationManagerForProfile;

class DownloadNotification {
 public:
  DownloadNotification();
  virtual ~DownloadNotification();

  static const char kDownloadNotificationOrigin[];

  virtual void OnDownloadUpdated(content::DownloadItem* item) = 0;
  virtual void OnDownloadRemoved(content::DownloadItem* item) = 0;

  virtual bool HasNotificationClickedListener();
  virtual void OnNotificationClose() {}
  virtual void OnNotificationClick() {}
  virtual void OnNotificationButtonClick(int button_index) {}
  virtual std::string GetNotificationId() const = 0;

  // This method may break a layout of notification center. See the comment in
  // message_center::MessageCenter::ForceNotificationFlush() for detail.
  void InvokeUnsafeForceNotificationFlush(
      message_center::MessageCenter* message_center, const std::string& id);

 protected:
  NotificationDelegate* watcher() const;

 private:
  scoped_refptr<NotificationDelegate> watcher_;

  DISALLOW_COPY_AND_ASSIGN(DownloadNotification);
};

#endif  // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_H_