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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 // Display a popup menu for WebKit using Cocoa widgets. | 242 // Display a popup menu for WebKit using Cocoa widgets. |
243 void WebContentsViewMac::ShowPopupMenu( | 243 void WebContentsViewMac::ShowPopupMenu( |
244 const gfx::Rect& bounds, | 244 const gfx::Rect& bounds, |
245 int item_height, | 245 int item_height, |
246 double item_font_size, | 246 double item_font_size, |
247 int selected_item, | 247 int selected_item, |
248 const std::vector<MenuItem>& items, | 248 const std::vector<MenuItem>& items, |
249 bool right_aligned, | 249 bool right_aligned, |
250 bool allow_multiple_selection) { | 250 bool allow_multiple_selection) { |
251 PopupMenuHelper popup_menu_helper(web_contents_->GetRenderViewHost()); | 251 popup_menu_helper_.reset( |
252 popup_menu_helper.ShowPopupMenu(bounds, item_height, item_font_size, | 252 new PopupMenuHelper(web_contents_->GetRenderViewHost())); |
253 selected_item, items, right_aligned, | 253 popup_menu_helper_->ShowPopupMenu(bounds, item_height, item_font_size, |
254 allow_multiple_selection); | 254 selected_item, items, right_aligned, |
| 255 allow_multiple_selection); |
| 256 popup_menu_helper_.reset(); |
| 257 } |
| 258 |
| 259 void WebContentsViewMac::HidePopupMenu() { |
| 260 if (popup_menu_helper_) |
| 261 popup_menu_helper_->Hide(); |
255 } | 262 } |
256 | 263 |
257 gfx::Rect WebContentsViewMac::GetViewBounds() const { | 264 gfx::Rect WebContentsViewMac::GetViewBounds() const { |
258 // This method is not currently used on mac. | 265 // This method is not currently used on mac. |
259 NOTIMPLEMENTED(); | 266 NOTIMPLEMENTED(); |
260 return gfx::Rect(); | 267 return gfx::Rect(); |
261 } | 268 } |
262 | 269 |
263 void WebContentsViewMac::SetAllowOverlappingViews(bool overlapping) { | 270 void WebContentsViewMac::SetAllowOverlappingViews(bool overlapping) { |
264 if (allow_overlapping_views_ == overlapping) | 271 if (allow_overlapping_views_ == overlapping) |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // When the subviews require a layout, their size should be reset to the size | 632 // When the subviews require a layout, their size should be reset to the size |
626 // of this view. (It is possible for the size to get out of sync as an | 633 // of this view. (It is possible for the size to get out of sync as an |
627 // optimization in preparation for an upcoming WebContentsView resize. | 634 // optimization in preparation for an upcoming WebContentsView resize. |
628 // http://crbug.com/264207) | 635 // http://crbug.com/264207) |
629 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { | 636 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { |
630 for (NSView* subview in self.subviews) | 637 for (NSView* subview in self.subviews) |
631 [subview setFrame:self.bounds]; | 638 [subview setFrame:self.bounds]; |
632 } | 639 } |
633 | 640 |
634 @end | 641 @end |
OLD | NEW |