Fix build break
[chromium-blink-merge.git] / chrome / browser / notifications / notification_object_proxy.cc
blobdd07b514673fb66b02fef8e5ad8bf9d09086cb12
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/stringprintf.h"
8 #include "content/public/browser/render_view_host.h"
10 using content::RenderViewHost;
12 NotificationObjectProxy::NotificationObjectProxy(int process_id, int route_id,
13 int notification_id, bool worker)
14 : process_id_(process_id),
15 route_id_(route_id),
16 notification_id_(notification_id),
17 worker_(worker) {
18 if (worker_) {
19 // TODO(johnnyg): http://crbug.com/23065 Worker support coming soon.
20 NOTREACHED();
24 void NotificationObjectProxy::Display() {
25 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
26 if (host)
27 host->DesktopNotificationPostDisplay(notification_id_);
30 void NotificationObjectProxy::Error() {
31 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
32 if (host)
33 host->DesktopNotificationPostError(notification_id_, string16());
36 void NotificationObjectProxy::Close(bool by_user) {
37 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
38 if (host)
39 host->DesktopNotificationPostClose(notification_id_, by_user);
42 void NotificationObjectProxy::Click() {
43 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
44 if (host)
45 host->DesktopNotificationPostClick(notification_id_);
48 std::string NotificationObjectProxy::id() const {
49 return base::StringPrintf("%d:%d:%d:%d", process_id_, route_id_,
50 notification_id_, worker_);
53 RenderViewHost* NotificationObjectProxy::GetRenderViewHost() const {
54 return RenderViewHost::FromID(process_id_, route_id_);