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 #import "content/browser/web_contents/web_contents_view_mac.h" | 7 #import "content/browser/web_contents/web_contents_view_mac.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 300 |
301 void WebContentsViewMac::ShowPopupMenu( | 301 void WebContentsViewMac::ShowPopupMenu( |
302 RenderFrameHost* render_frame_host, | 302 RenderFrameHost* render_frame_host, |
303 const gfx::Rect& bounds, | 303 const gfx::Rect& bounds, |
304 int item_height, | 304 int item_height, |
305 double item_font_size, | 305 double item_font_size, |
306 int selected_item, | 306 int selected_item, |
307 const std::vector<MenuItem>& items, | 307 const std::vector<MenuItem>& items, |
308 bool right_aligned, | 308 bool right_aligned, |
309 bool allow_multiple_selection) { | 309 bool allow_multiple_selection) { |
310 popup_menu_helper_.reset(new PopupMenuHelper(render_frame_host)); | 310 popup_menu_helper_.reset(new PopupMenuHelper(this, render_frame_host)); |
311 popup_menu_helper_->ShowPopupMenu(bounds, item_height, item_font_size, | 311 popup_menu_helper_->ShowPopupMenu(bounds, item_height, item_font_size, |
312 selected_item, items, right_aligned, | 312 selected_item, items, right_aligned, |
313 allow_multiple_selection); | 313 allow_multiple_selection); |
314 popup_menu_helper_.reset(); | 314 // Note: |this| may be deleted here. |
315 } | 315 } |
316 | 316 |
317 void WebContentsViewMac::HidePopupMenu() { | 317 void WebContentsViewMac::HidePopupMenu() { |
318 if (popup_menu_helper_) | 318 if (popup_menu_helper_) |
319 popup_menu_helper_->Hide(); | 319 popup_menu_helper_->Hide(); |
320 } | 320 } |
321 | 321 |
| 322 void WebContentsViewMac::OnMenuClosed() { |
| 323 popup_menu_helper_.reset(); |
| 324 } |
| 325 |
322 gfx::Rect WebContentsViewMac::GetViewBounds() const { | 326 gfx::Rect WebContentsViewMac::GetViewBounds() const { |
323 // This method is not currently used on mac. | 327 // This method is not currently used on mac. |
324 NOTIMPLEMENTED(); | 328 NOTIMPLEMENTED(); |
325 return gfx::Rect(); | 329 return gfx::Rect(); |
326 } | 330 } |
327 | 331 |
328 void WebContentsViewMac::SetAllowOtherViews(bool allow) { | 332 void WebContentsViewMac::SetAllowOtherViews(bool allow) { |
329 if (allow_other_views_ == allow) | 333 if (allow_other_views_ == allow) |
330 return; | 334 return; |
331 | 335 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 738 |
735 - (void)viewDidHide { | 739 - (void)viewDidHide { |
736 [self updateWebContentsVisibility]; | 740 [self updateWebContentsVisibility]; |
737 } | 741 } |
738 | 742 |
739 - (void)viewDidUnhide { | 743 - (void)viewDidUnhide { |
740 [self updateWebContentsVisibility]; | 744 [self updateWebContentsVisibility]; |
741 } | 745 } |
742 | 746 |
743 @end | 747 @end |
OLD | NEW |