| 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/tab_contents/web_contents_view_mac.h" | 7 #import "content/browser/tab_contents/web_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 [cocoa_view_ clearTabContentsView]; | 83 [cocoa_view_ clearTabContentsView]; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void WebContentsViewMac::CreateView(const gfx::Size& initial_size) { | 86 void WebContentsViewMac::CreateView(const gfx::Size& initial_size) { |
| 87 WebContentsViewCocoa* view = | 87 WebContentsViewCocoa* view = |
| 88 [[WebContentsViewCocoa alloc] initWithWebContentsViewMac:this]; | 88 [[WebContentsViewCocoa alloc] initWithWebContentsViewMac:this]; |
| 89 cocoa_view_.reset(view); | 89 cocoa_view_.reset(view); |
| 90 } | 90 } |
| 91 | 91 |
| 92 RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget( | 92 RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget( |
| 93 RenderWidgetHost* render_widget_host) { | 93 content::RenderWidgetHost* render_widget_host) { |
| 94 if (render_widget_host->GetView()) { | 94 if (render_widget_host->GetView()) { |
| 95 // During testing, the view will already be set up in most cases to the | 95 // During testing, the view will already be set up in most cases to the |
| 96 // test view, so we don't want to clobber it with a real one. To verify that | 96 // test view, so we don't want to clobber it with a real one. To verify that |
| 97 // this actually is happening (and somebody isn't accidentally creating the | 97 // this actually is happening (and somebody isn't accidentally creating the |
| 98 // view twice), we check for the RVH Factory, which will be set when we're | 98 // view twice), we check for the RVH Factory, which will be set when we're |
| 99 // making special ones (which go along with the special views). | 99 // making special ones (which go along with the special views). |
| 100 DCHECK(RenderViewHostFactory::has_factory()); | 100 DCHECK(RenderViewHostFactory::has_factory()); |
| 101 return render_widget_host->GetView(); | 101 return render_widget_host->GetView(); |
| 102 } | 102 } |
| 103 | 103 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // processing events. | 178 // processing events. |
| 179 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 179 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 180 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); | 180 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); |
| 181 NSPoint offset = NSPointFromCGPoint(image_offset.ToCGPoint()); | 181 NSPoint offset = NSPointFromCGPoint(image_offset.ToCGPoint()); |
| 182 [cocoa_view_ startDragWithDropData:drop_data | 182 [cocoa_view_ startDragWithDropData:drop_data |
| 183 dragOperationMask:mask | 183 dragOperationMask:mask |
| 184 image:gfx::SkBitmapToNSImage(image) | 184 image:gfx::SkBitmapToNSImage(image) |
| 185 offset:offset]; | 185 offset:offset]; |
| 186 } | 186 } |
| 187 | 187 |
| 188 void WebContentsViewMac::RenderViewCreated(RenderViewHost* host) { | 188 void WebContentsViewMac::RenderViewCreated(content::RenderViewHost* host) { |
| 189 // We want updates whenever the intrinsic width of the webpage changes. | 189 // We want updates whenever the intrinsic width of the webpage changes. |
| 190 // Put the RenderView into that mode. The preferred width is used for example | 190 // Put the RenderView into that mode. The preferred width is used for example |
| 191 // when the "zoom" button in the browser window is clicked. | 191 // when the "zoom" button in the browser window is clicked. |
| 192 host->EnablePreferredSizeMode(); | 192 host->EnablePreferredSizeMode(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void WebContentsViewMac::SetPageTitle(const string16& title) { | 195 void WebContentsViewMac::SetPageTitle(const string16& title) { |
| 196 // Meaningless on the Mac; widgets don't have a "title" attribute | 196 // Meaningless on the Mac; widgets don't have a "title" attribute |
| 197 } | 197 } |
| 198 | 198 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 [[[notification userInfo] objectForKey:kSelectionDirection] | 589 [[[notification userInfo] objectForKey:kSelectionDirection] |
| 590 unsignedIntegerValue]; | 590 unsignedIntegerValue]; |
| 591 if (direction == NSDirectSelection) | 591 if (direction == NSDirectSelection) |
| 592 return; | 592 return; |
| 593 | 593 |
| 594 [self tabContents]-> | 594 [self tabContents]-> |
| 595 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 595 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
| 596 } | 596 } |
| 597 | 597 |
| 598 @end | 598 @end |
| OLD | NEW |