Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / download / notification / download_notification.cc
blob8b324d414a9ecc3d614f48daba8e0687b59b25dc
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/download/notification/download_notification.h"
7 #include "chrome/browser/download/notification/download_notification_manager.h"
9 namespace {
11 ///////////////////////////////////////////////////////////////////////////////
12 // NotificationWatcher class:
13 ///////////////////////////////////////////////////////////////////////////////
15 class NotificationWatcher : public NotificationDelegate {
16 public:
17 explicit NotificationWatcher(DownloadNotification* item) : item_(item) {}
19 // NotificationDelegate overrides:
20 void Close(bool by_user) override {
21 item_->OnNotificationClose();
24 void Click() override {
25 item_->OnNotificationClick();
28 bool HasClickedListener() override {
29 return true;
32 void ButtonClick(int button_index) override {
33 item_->OnNotificationButtonClick(button_index);
36 std::string id() const override {
37 return item_->GetNotificationId();
40 private:
41 ~NotificationWatcher() override {}
43 DownloadNotification* item_;
45 DISALLOW_COPY_AND_ASSIGN(NotificationWatcher);
48 } // anonymous namespace
50 ///////////////////////////////////////////////////////////////////////////////
51 // DownloadNotification implementation:
52 ///////////////////////////////////////////////////////////////////////////////
54 // static
55 const char DownloadNotification::kDownloadNotificationOrigin[] =
56 "chrome://downloads";
58 DownloadNotification::DownloadNotification()
59 : watcher_(new NotificationWatcher(this)) {}
61 DownloadNotification::~DownloadNotification() {}
63 NotificationDelegate* DownloadNotification::watcher() const {
64 return watcher_.get();