| OLD | NEW |
| 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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "content/browser/tab_contents/popup_menu_helper_mac.h" | 7 #include "content/browser/tab_contents/popup_menu_helper_mac.h" |
| 8 | 8 |
| 9 #import "base/mac/scoped_sending_event.h" | 9 #import "base/mac/scoped_sending_event.h" |
| 10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "content/browser/renderer_host/render_view_host_impl.h" | 12 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 13 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
| 15 #include "content/public/browser/notification_types.h" | 15 #include "content/public/browser/notification_types.h" |
| 16 #import "ui/base/cocoa/base_view.h" | 16 #import "ui/base/cocoa/base_view.h" |
| 17 #include "webkit/glue/webmenurunner_mac.h" | 17 #include "webkit/glue/webmenurunner_mac.h" |
| 18 | 18 |
| 19 using content::RenderViewHost; |
| 20 using content::RenderViewHostImpl; |
| 21 using content::RenderWidgetHost; |
| 22 |
| 19 PopupMenuHelper::PopupMenuHelper(RenderViewHost* render_view_host) | 23 PopupMenuHelper::PopupMenuHelper(RenderViewHost* render_view_host) |
| 20 : render_view_host_(static_cast<RenderViewHostImpl*>(render_view_host)) { | 24 : render_view_host_(static_cast<RenderViewHostImpl*>(render_view_host)) { |
| 21 notification_registrar_.Add( | 25 notification_registrar_.Add( |
| 22 this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 26 this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| 23 content::Source<RenderWidgetHost>(render_view_host)); | 27 content::Source<RenderWidgetHost>(render_view_host)); |
| 24 } | 28 } |
| 25 | 29 |
| 26 void PopupMenuHelper::ShowPopupMenu( | 30 void PopupMenuHelper::ShowPopupMenu( |
| 27 const gfx::Rect& bounds, | 31 const gfx::Rect& bounds, |
| 28 int item_height, | 32 int item_height, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 82 |
| 79 void PopupMenuHelper::Observe( | 83 void PopupMenuHelper::Observe( |
| 80 int type, | 84 int type, |
| 81 const content::NotificationSource& source, | 85 const content::NotificationSource& source, |
| 82 const content::NotificationDetails& details) { | 86 const content::NotificationDetails& details) { |
| 83 DCHECK(type == content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); | 87 DCHECK(type == content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); |
| 84 DCHECK(content::Source<RenderWidgetHost>(source).ptr() == render_view_host_); | 88 DCHECK(content::Source<RenderWidgetHost>(source).ptr() == render_view_host_); |
| 85 render_view_host_ = NULL; | 89 render_view_host_ = NULL; |
| 86 } | 90 } |
| 87 | 91 |
| OLD | NEW |