Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/notifications/notification_object_proxy.cc

Issue 433273002: NotificationObjectProxy should own the DesktopNotificationDelegateImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pass as scoped_ptr Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/notification_object_proxy.h" 5 #include "chrome/browser/notifications/notification_object_proxy.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/public/browser/desktop_notification_delegate.h" 9 #include "content/public/browser/desktop_notification_delegate.h"
10 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
11 #include "content/public/browser/render_process_host.h" 11 #include "content/public/browser/render_process_host.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 13
14 NotificationObjectProxy::NotificationObjectProxy( 14 NotificationObjectProxy::NotificationObjectProxy(
15 content::RenderFrameHost* render_frame_host, 15 content::RenderFrameHost* render_frame_host,
16 content::DesktopNotificationDelegate* delegate) 16 scoped_ptr<content::DesktopNotificationDelegate> delegate)
17 : render_process_id_(render_frame_host->GetProcess()->GetID()), 17 : render_process_id_(render_frame_host->GetProcess()->GetID()),
18 render_frame_id_(render_frame_host->GetRoutingID()), 18 render_frame_id_(render_frame_host->GetRoutingID()),
19 delegate_(delegate), 19 delegate_(delegate.Pass()),
20 displayed_(false), 20 displayed_(false),
21 id_(base::GenerateGUID()) { 21 id_(base::GenerateGUID()) {
22 } 22 }
23 23
24 NotificationObjectProxy::~NotificationObjectProxy() {}
25
24 void NotificationObjectProxy::Display() { 26 void NotificationObjectProxy::Display() {
25 // This method is called each time the notification is shown to the user 27 // This method is called each time the notification is shown to the user
26 // but we only want to fire the event the first time. 28 // but we only want to fire the event the first time.
27 if (displayed_) 29 if (displayed_)
28 return; 30 return;
29 displayed_ = true; 31 displayed_ = true;
30 32
31 delegate_->NotificationDisplayed(); 33 delegate_->NotificationDisplayed();
32 } 34 }
33 35
(...skipping 14 matching lines...) Expand all
48 } 50 }
49 51
50 int NotificationObjectProxy::process_id() const { 52 int NotificationObjectProxy::process_id() const {
51 return render_process_id_; 53 return render_process_id_;
52 } 54 }
53 55
54 content::WebContents* NotificationObjectProxy::GetWebContents() const { 56 content::WebContents* NotificationObjectProxy::GetWebContents() const {
55 return content::WebContents::FromRenderFrameHost( 57 return content::WebContents::FromRenderFrameHost(
56 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_)); 58 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_));
57 } 59 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_object_proxy.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698