Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / notifications / notification_object_proxy.cc
blobe98a82cde6d25e7cef1d72fcd2321c4dc423e02e
1 // Copyright (c) 2012 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/notification_object_proxy.h"
7 #include "base/guid.h"
8 #include "content/public/browser/desktop_notification_delegate.h"
10 NotificationObjectProxy::NotificationObjectProxy(
11 scoped_ptr<content::DesktopNotificationDelegate> delegate)
12 : delegate_(delegate.Pass()),
13 displayed_(false),
14 id_(base::GenerateGUID()) {}
16 NotificationObjectProxy::~NotificationObjectProxy() {}
18 void NotificationObjectProxy::Display() {
19 // This method is called each time the notification is shown to the user
20 // but we only want to fire the event the first time.
21 if (displayed_)
22 return;
23 displayed_ = true;
25 delegate_->NotificationDisplayed();
28 void NotificationObjectProxy::Close(bool by_user) {
29 delegate_->NotificationClosed();
32 void NotificationObjectProxy::Click() {
33 delegate_->NotificationClick();
36 std::string NotificationObjectProxy::id() const {
37 return id_;