Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / notifications / persistent_notification_delegate.cc
blob212a6d84cb2a56e30c39e1984f56f93acf5a75c0
1 // Copyright 2014 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/notifications/persistent_notification_delegate.h"
7 #include "base/bind.h"
8 #include "base/guid.h"
9 #include "chrome/browser/notifications/platform_notification_service_impl.h"
10 #include "content/public/common/persistent_notification_status.h"
12 PersistentNotificationDelegate::PersistentNotificationDelegate(
13 content::BrowserContext* browser_context,
14 int64_t persistent_notification_id,
15 const GURL& origin)
16 : browser_context_(browser_context),
17 persistent_notification_id_(persistent_notification_id),
18 origin_(origin),
19 id_(base::GenerateGUID()) {}
21 PersistentNotificationDelegate::~PersistentNotificationDelegate() {}
23 void PersistentNotificationDelegate::Display() {}
25 void PersistentNotificationDelegate::Close(bool by_user) {
26 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose(
27 browser_context_,
28 persistent_notification_id_,
29 origin_);
32 void PersistentNotificationDelegate::Click() {
33 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick(
34 browser_context_,
35 persistent_notification_id_,
36 origin_,
37 -1 /* action_index */);
40 void PersistentNotificationDelegate::ButtonClick(int button_index) {
41 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick(
42 browser_context_,
43 persistent_notification_id_,
44 origin_,
45 button_index);
48 std::string PersistentNotificationDelegate::id() const {
49 return id_;