Chromium Code Reviews| 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 <QuartzCore/CAOpenGLLayer.h> | 5 #include <QuartzCore/CAOpenGLLayer.h> |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 8 | 8 |
| 9 #import "base/chrome_application_mac.h" | 9 #import "base/chrome_application_mac.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { | 117 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { |
| 118 [im_attributes_ release]; | 118 [im_attributes_ release]; |
| 119 } | 119 } |
| 120 | 120 |
| 121 /////////////////////////////////////////////////////////////////////////////// | 121 /////////////////////////////////////////////////////////////////////////////// |
| 122 // RenderWidgetHostViewMac, RenderWidgetHostView implementation: | 122 // RenderWidgetHostViewMac, RenderWidgetHostView implementation: |
| 123 | 123 |
| 124 void RenderWidgetHostViewMac::InitAsPopup( | 124 void RenderWidgetHostViewMac::InitAsPopup( |
| 125 RenderWidgetHostView* parent_host_view, | 125 RenderWidgetHostView* parent_host_view, |
| 126 const gfx::Rect& pos) { | 126 const gfx::Rect& pos) { |
| 127 [parent_host_view->GetNativeView() addSubview:cocoa_view_]; | |
| 128 [cocoa_view_ setCloseOnDeactivate:YES]; | 127 [cocoa_view_ setCloseOnDeactivate:YES]; |
| 129 [cocoa_view_ setCanBeKeyView:activatable_ ? YES : NO]; | 128 [cocoa_view_ setCanBeKeyView:activatable_ ? YES : NO]; |
| 129 [parent_host_view->GetNativeView() addSubview:cocoa_view_]; | |
|
rohitrao (ping after 24h)
2010/02/09 21:56:50
Why did this move?
| |
| 130 | 130 |
| 131 // TODO(avi):Why the hell are these screen coordinates? The Windows code calls | 131 // TODO(avi):Why the hell are these screen coordinates? The Windows code calls |
| 132 // ::MoveWindow() which indicates they should be local, but when running it I | 132 // ::MoveWindow() which indicates they should be local, but when running it I |
| 133 // get global ones instead! | 133 // get global ones instead! |
| 134 | 134 |
| 135 NSPoint global_origin = NSPointFromCGPoint(pos.origin().ToCGPoint()); | 135 NSPoint global_origin = NSPointFromCGPoint(pos.origin().ToCGPoint()); |
| 136 global_origin.y = [[[cocoa_view_ window] screen] frame].size.height - | 136 global_origin.y = [[[cocoa_view_ window] screen] frame].size.height - |
| 137 pos.height() - global_origin.y; | 137 pos.height() - global_origin.y; |
| 138 NSPoint window_origin = | 138 NSPoint window_origin = |
| 139 [[cocoa_view_ window] convertScreenToBase:global_origin]; | 139 [[cocoa_view_ window] convertScreenToBase:global_origin]; |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1537 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( | 1537 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( |
| 1538 UTF8ToUTF16([im_text UTF8String])); | 1538 UTF8ToUTF16([im_text UTF8String])); |
| 1539 } | 1539 } |
| 1540 renderWidgetHostView_->im_composing_ = false; | 1540 renderWidgetHostView_->im_composing_ = false; |
| 1541 } | 1541 } |
| 1542 | 1542 |
| 1543 - (void)viewDidMoveToWindow { | 1543 - (void)viewDidMoveToWindow { |
| 1544 // If we move into a new window, refresh the frame information. We don't need | 1544 // If we move into a new window, refresh the frame information. We don't need |
| 1545 // to do it if it was the same window as it used to be in, since that case | 1545 // to do it if it was the same window as it used to be in, since that case |
| 1546 // is covered by DidBecomeSelected. | 1546 // is covered by DidBecomeSelected. |
| 1547 NSWindow* newWindow = [self window]; | 1547 // We only want to do this for real browser views, not popups. |
| 1548 // Pointer comparison only, since we don't know if lastWindow_ is still valid. | 1548 if (canBeKeyView_) { |
| 1549 if (newWindow && (newWindow != lastWindow_)) { | 1549 NSWindow* newWindow = [self window]; |
| 1550 lastWindow_ = newWindow; | 1550 // Pointer comparison only, since we don't know if lastWindow_ is still |
| 1551 renderWidgetHostView_->WindowFrameChanged(); | 1551 // valid. |
| 1552 if (newWindow && (newWindow != lastWindow_)) { | |
| 1553 lastWindow_ = newWindow; | |
| 1554 renderWidgetHostView_->WindowFrameChanged(); | |
| 1555 } | |
| 1552 } | 1556 } |
| 1553 } | 1557 } |
| 1554 | 1558 |
| 1555 @end | 1559 @end |
| OLD | NEW |