| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/browser_trial.h" | 9 #include "chrome/browser/browser_trial.h" |
| 10 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" | 10 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // If we have a renderer, then inform it that we are being hidden so it can | 110 // If we have a renderer, then inform it that we are being hidden so it can |
| 111 // reduce its resource utilization. | 111 // reduce its resource utilization. |
| 112 render_widget_host_->WasHidden(); | 112 render_widget_host_->WasHidden(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { | 115 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { |
| 116 if (is_hidden_) | 116 if (is_hidden_) |
| 117 return; | 117 return; |
| 118 | 118 |
| 119 // TODO(avi): the TabContents object uses this method to size the newly | 119 // TODO(avi): the TabContents object uses this method to size the newly |
| 120 // created widget to the correct size. At the time of this call, we're not yet | 120 // created widget to the correct size. For that instance, we're not yet in the |
| 121 // in the view hierarchy so |size| ends up being 0x0. However, this works for | 121 // view hierarchy so |size| ends up being 0x0. However, this works for us |
| 122 // us because we're using the Cocoa view struture and resizer flags to fix | 122 // because we're using the Cocoa view struture and resizer flags to fix things |
| 123 // things up as soon as the view gets added to the hierarchy. Figure out if we | 123 // up as soon as the view gets added to the hierarchy. Figure out if we want |
| 124 // want to keep this flow or switch back to the flow Windows uses which sets | 124 // to keep this flow or switch back to the flow Windows uses which sets the |
| 125 // the size upon creation. http://crbug.com/8285. | 125 // size upon creation. <http://crbug.com/8285>. However, if the size is not |
| 126 // 0x0, this is a valid request. |
| 127 if (size.IsEmpty()) |
| 128 return; |
| 129 |
| 130 // Do conversions to upper-left origin, as "set size" means keep the |
| 131 // upper-left corner pinned. If the new size is valid, this is a popup whose |
| 132 // superview is another RenderWidgetHostViewCocoa, but even if it's directly |
| 133 // in a TabContentsViewCocoa, they're both BaseViews. |
| 134 gfx::Rect rect = |
| 135 [(BaseView*)[cocoa_view_ superview] NSRectToRect:[cocoa_view_ frame]]; |
| 136 rect.set_width(size.width()); |
| 137 rect.set_height(size.height()); |
| 138 [cocoa_view_ setFrame:[(BaseView*)[cocoa_view_ superview] RectToNSRect:rect]]; |
| 126 } | 139 } |
| 127 | 140 |
| 128 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() { | 141 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() { |
| 129 return native_view(); | 142 return native_view(); |
| 130 } | 143 } |
| 131 | 144 |
| 132 void RenderWidgetHostViewMac::MovePluginWindows( | 145 void RenderWidgetHostViewMac::MovePluginWindows( |
| 133 const std::vector<WebPluginGeometry>& plugin_window_moves) { | 146 const std::vector<WebPluginGeometry>& plugin_window_moves) { |
| 134 // All plugin stuff is TBD. TODO(avi,awalker): fill in | 147 // All plugin stuff is TBD. TODO(avi,awalker): fill in |
| 135 // http://crbug.com/8192 | 148 // http://crbug.com/8192 |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 // NSView calls this to get the text when displaying the tooltip. | 770 // NSView calls this to get the text when displaying the tooltip. |
| 758 - (NSString *)view:(NSView *)view | 771 - (NSString *)view:(NSView *)view |
| 759 stringForToolTip:(NSToolTipTag)tag | 772 stringForToolTip:(NSToolTipTag)tag |
| 760 point:(NSPoint)point | 773 point:(NSPoint)point |
| 761 userData:(void *)data { | 774 userData:(void *)data { |
| 762 return [[toolTip_ copy] autorelease]; | 775 return [[toolTip_ copy] autorelease]; |
| 763 } | 776 } |
| 764 | 777 |
| 765 @end | 778 @end |
| 766 | 779 |
| OLD | NEW |