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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 } | 995 } |
996 | 996 |
997 void RenderFrameHostImpl::OnShowDesktopNotification( | 997 void RenderFrameHostImpl::OnShowDesktopNotification( |
998 int notification_id, | 998 int notification_id, |
999 const ShowDesktopNotificationHostMsgParams& params) { | 999 const ShowDesktopNotificationHostMsgParams& params) { |
1000 scoped_ptr<DesktopNotificationDelegateImpl> delegate( | 1000 scoped_ptr<DesktopNotificationDelegateImpl> delegate( |
1001 new DesktopNotificationDelegateImpl(this, notification_id)); | 1001 new DesktopNotificationDelegateImpl(this, notification_id)); |
1002 | 1002 |
1003 base::Closure cancel_callback; | 1003 base::Closure cancel_callback; |
1004 GetContentClient()->browser()->ShowDesktopNotification( | 1004 GetContentClient()->browser()->ShowDesktopNotification( |
1005 params, | 1005 params, this, delegate.Pass(), &cancel_callback); |
1006 this, | |
1007 delegate.PassAs<DesktopNotificationDelegate>(), | |
1008 &cancel_callback); | |
1009 cancel_notification_callbacks_[notification_id] = cancel_callback; | 1006 cancel_notification_callbacks_[notification_id] = cancel_callback; |
1010 } | 1007 } |
1011 | 1008 |
1012 void RenderFrameHostImpl::OnCancelDesktopNotification(int notification_id) { | 1009 void RenderFrameHostImpl::OnCancelDesktopNotification(int notification_id) { |
1013 if (!cancel_notification_callbacks_.count(notification_id)) { | 1010 if (!cancel_notification_callbacks_.count(notification_id)) { |
1014 NOTREACHED(); | 1011 NOTREACHED(); |
1015 return; | 1012 return; |
1016 } | 1013 } |
1017 cancel_notification_callbacks_[notification_id].Run(); | 1014 cancel_notification_callbacks_[notification_id].Run(); |
1018 cancel_notification_callbacks_.erase(notification_id); | 1015 cancel_notification_callbacks_.erase(notification_id); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 // Clear any state if a pending navigation is canceled or preempted. | 1555 // Clear any state if a pending navigation is canceled or preempted. |
1559 if (suspended_nav_params_) | 1556 if (suspended_nav_params_) |
1560 suspended_nav_params_.reset(); | 1557 suspended_nav_params_.reset(); |
1561 | 1558 |
1562 TRACE_EVENT_ASYNC_END0("navigation", | 1559 TRACE_EVENT_ASYNC_END0("navigation", |
1563 "RenderFrameHostImpl navigation suspended", this); | 1560 "RenderFrameHostImpl navigation suspended", this); |
1564 navigations_suspended_ = false; | 1561 navigations_suspended_ = false; |
1565 } | 1562 } |
1566 | 1563 |
1567 } // namespace content | 1564 } // namespace content |
OLD | NEW |