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