| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 LAZY_INSTANCE_INITIALIZER; | 78 LAZY_INSTANCE_INITIALIZER; |
| 79 | 79 |
| 80 class DesktopNotificationDelegateImpl : public DesktopNotificationDelegate { | 80 class DesktopNotificationDelegateImpl : public DesktopNotificationDelegate { |
| 81 public: | 81 public: |
| 82 DesktopNotificationDelegateImpl(RenderFrameHost* render_frame_host, | 82 DesktopNotificationDelegateImpl(RenderFrameHost* render_frame_host, |
| 83 int notification_id) | 83 int notification_id) |
| 84 : render_process_id_(render_frame_host->GetProcess()->GetID()), | 84 : render_process_id_(render_frame_host->GetProcess()->GetID()), |
| 85 render_frame_id_(render_frame_host->GetRoutingID()), | 85 render_frame_id_(render_frame_host->GetRoutingID()), |
| 86 notification_id_(notification_id) {} | 86 notification_id_(notification_id) {} |
| 87 | 87 |
| 88 virtual ~DesktopNotificationDelegateImpl() {} | 88 ~DesktopNotificationDelegateImpl() override {} |
| 89 | 89 |
| 90 virtual void NotificationDisplayed() override { | 90 void NotificationDisplayed() override { |
| 91 RenderFrameHost* rfh = | 91 RenderFrameHost* rfh = |
| 92 RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 92 RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 93 if (!rfh) | 93 if (!rfh) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 rfh->Send(new DesktopNotificationMsg_PostDisplay( | 96 rfh->Send(new DesktopNotificationMsg_PostDisplay( |
| 97 rfh->GetRoutingID(), notification_id_)); | 97 rfh->GetRoutingID(), notification_id_)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 virtual void NotificationError() override { | 100 void NotificationError() override { |
| 101 RenderFrameHost* rfh = | 101 RenderFrameHost* rfh = |
| 102 RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 102 RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 103 if (!rfh) | 103 if (!rfh) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 rfh->Send(new DesktopNotificationMsg_PostError( | 106 rfh->Send(new DesktopNotificationMsg_PostError( |
| 107 rfh->GetRoutingID(), notification_id_)); | 107 rfh->GetRoutingID(), notification_id_)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 virtual void NotificationClosed(bool by_user) override { | 110 void NotificationClosed(bool by_user) override { |
| 111 RenderFrameHost* rfh = | 111 RenderFrameHost* rfh = |
| 112 RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 112 RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 113 if (!rfh) | 113 if (!rfh) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 rfh->Send(new DesktopNotificationMsg_PostClose( | 116 rfh->Send(new DesktopNotificationMsg_PostClose( |
| 117 rfh->GetRoutingID(), notification_id_, by_user)); | 117 rfh->GetRoutingID(), notification_id_, by_user)); |
| 118 static_cast<RenderFrameHostImpl*>(rfh)->NotificationClosed( | 118 static_cast<RenderFrameHostImpl*>(rfh)->NotificationClosed( |
| 119 notification_id_); | 119 notification_id_); |
| 120 } | 120 } |
| 121 | 121 |
| 122 virtual void NotificationClick() override { | 122 void NotificationClick() override { |
| 123 RenderFrameHost* rfh = | 123 RenderFrameHost* rfh = |
| 124 RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 124 RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 125 if (!rfh) | 125 if (!rfh) |
| 126 return; | 126 return; |
| 127 | 127 |
| 128 rfh->Send(new DesktopNotificationMsg_PostClick( | 128 rfh->Send(new DesktopNotificationMsg_PostClick( |
| 129 rfh->GetRoutingID(), notification_id_)); | 129 rfh->GetRoutingID(), notification_id_)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 private: | 132 private: |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 // Clear any state if a pending navigation is canceled or preempted. | 1563 // Clear any state if a pending navigation is canceled or preempted. |
| 1564 if (suspended_nav_params_) | 1564 if (suspended_nav_params_) |
| 1565 suspended_nav_params_.reset(); | 1565 suspended_nav_params_.reset(); |
| 1566 | 1566 |
| 1567 TRACE_EVENT_ASYNC_END0("navigation", | 1567 TRACE_EVENT_ASYNC_END0("navigation", |
| 1568 "RenderFrameHostImpl navigation suspended", this); | 1568 "RenderFrameHostImpl navigation suspended", this); |
| 1569 navigations_suspended_ = false; | 1569 navigations_suspended_ = false; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 } // namespace content | 1572 } // namespace content |
| OLD | NEW |