| 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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include <Cocoa/Cocoa.h> | 7 #include <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 MockRenderWidgetHostImpl* rwh = | 1044 MockRenderWidgetHostImpl* rwh = |
| 1045 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); | 1045 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); |
| 1046 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(rwh, true); | 1046 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(rwh, true); |
| 1047 | 1047 |
| 1048 // Add a delegate to the view. | 1048 // Add a delegate to the view. |
| 1049 base::scoped_nsobject<MockRenderWidgetHostViewMacDelegate> view_delegate( | 1049 base::scoped_nsobject<MockRenderWidgetHostViewMacDelegate> view_delegate( |
| 1050 [[MockRenderWidgetHostViewMacDelegate alloc] init]); | 1050 [[MockRenderWidgetHostViewMacDelegate alloc] init]); |
| 1051 view->SetDelegate(view_delegate.get()); | 1051 view->SetDelegate(view_delegate.get()); |
| 1052 | 1052 |
| 1053 base::WeakPtr<RenderWidgetHostViewBase> guest_rwhv_weak = | 1053 base::WeakPtr<RenderWidgetHostViewBase> guest_rwhv_weak = |
| 1054 (new RenderWidgetHostViewGuest( | 1054 (RenderWidgetHostViewGuest::Create(rwh, NULL, view->GetWeakPtr())) |
| 1055 rwh, NULL, view->GetWeakPtr()))->GetWeakPtr(); | 1055 ->GetWeakPtr(); |
| 1056 | 1056 |
| 1057 // Remove the cocoa_view() so |view| also goes away before |rwh|. | 1057 // Remove the cocoa_view() so |view| also goes away before |rwh|. |
| 1058 { | 1058 { |
| 1059 base::scoped_nsobject<RenderWidgetHostViewCocoa> rwhv_cocoa; | 1059 base::scoped_nsobject<RenderWidgetHostViewCocoa> rwhv_cocoa; |
| 1060 rwhv_cocoa.reset([view->cocoa_view() retain]); | 1060 rwhv_cocoa.reset([view->cocoa_view() retain]); |
| 1061 } | 1061 } |
| 1062 RecycleAndWait(); | 1062 RecycleAndWait(); |
| 1063 | 1063 |
| 1064 // Clean up. | 1064 // Clean up. |
| 1065 rwh->ShutdownAndDestroyWidget(true); | 1065 rwh->ShutdownAndDestroyWidget(true); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 // Repeat for the tab's view. | 1483 // Repeat for the tab's view. |
| 1484 [rwhv_cocoa_ setMarkedText:text | 1484 [rwhv_cocoa_ setMarkedText:text |
| 1485 selectedRange:selectedRange | 1485 selectedRange:selectedRange |
| 1486 replacementRange:replacementRange]; | 1486 replacementRange:replacementRange]; |
| 1487 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); | 1487 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); |
| 1488 rwhv_mac_->ImeCancelComposition(); | 1488 rwhv_mac_->ImeCancelComposition(); |
| 1489 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); | 1489 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 } // namespace content | 1492 } // namespace content |
| OLD | NEW |