Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 2622083007: MacViews: Make window content views layer-backed. (Closed)
Patch Set: Experimental! Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // the old views::View will be gone, so any method calls will become no-ops. 539 // the old views::View will be gone, so any method calls will become no-ops.
540 540
541 if (view) { 541 if (view) {
542 bridged_view_.reset([[BridgedContentView alloc] initWithView:view]); 542 bridged_view_.reset([[BridgedContentView alloc] initWithView:view]);
543 drag_drop_client_.reset(new DragDropClientMac(this, view)); 543 drag_drop_client_.reset(new DragDropClientMac(this, view));
544 544
545 // Objective C initializers can return nil. However, if |view| is non-NULL 545 // Objective C initializers can return nil. However, if |view| is non-NULL
546 // this should be treated as an error and caught early. 546 // this should be treated as an error and caught early.
547 CHECK(bridged_view_); 547 CHECK(bridged_view_);
548 } 548 }
549 [bridged_view_ setWantsLayer:YES];
549 [window_ setContentView:bridged_view_]; 550 [window_ setContentView:bridged_view_];
550 } 551 }
551 552
552 void BridgedNativeWidget::SetVisibilityState(WindowVisibilityState new_state) { 553 void BridgedNativeWidget::SetVisibilityState(WindowVisibilityState new_state) {
553 // Ensure that: 554 // Ensure that:
554 // - A window with an invisible parent is not made visible. 555 // - A window with an invisible parent is not made visible.
555 // - A parent changing visibility updates child window visibility. 556 // - A parent changing visibility updates child window visibility.
556 // * But only when changed via this function - ignore changes via the 557 // * But only when changed via this function - ignore changes via the
557 // NSWindow API, or changes propagating out from here. 558 // NSWindow API, or changes propagating out from here.
558 wants_to_be_visible_ = new_state != HIDE_WINDOW; 559 wants_to_be_visible_ = new_state != HIDE_WINDOW;
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 DCHECK(!compositor_); 1261 DCHECK(!compositor_);
1261 DCHECK(!compositor_widget_); 1262 DCHECK(!compositor_widget_);
1262 DCHECK(ViewsDelegate::GetInstance()); 1263 DCHECK(ViewsDelegate::GetInstance());
1263 1264
1264 ui::ContextFactory* context_factory = 1265 ui::ContextFactory* context_factory =
1265 ViewsDelegate::GetInstance()->GetContextFactory(); 1266 ViewsDelegate::GetInstance()->GetContextFactory();
1266 DCHECK(context_factory); 1267 DCHECK(context_factory);
1267 ui::ContextFactoryPrivate* context_factory_private = 1268 ui::ContextFactoryPrivate* context_factory_private =
1268 ViewsDelegate::GetInstance()->GetContextFactoryPrivate(); 1269 ViewsDelegate::GetInstance()->GetContextFactoryPrivate();
1269 1270
1270 AddCompositorSuperview(); 1271 //AddCompositorSuperview();
1272 compositor_superview_.reset([bridged_view_ retain]);
1271 1273
1272 compositor_widget_.reset(new ui::AcceleratedWidgetMac()); 1274 compositor_widget_.reset(new ui::AcceleratedWidgetMac());
1273 compositor_.reset(new ui::Compositor(context_factory, context_factory_private, 1275 compositor_.reset(new ui::Compositor(context_factory, context_factory_private,
1274 GetCompositorTaskRunner())); 1276 GetCompositorTaskRunner()));
1275 compositor_->SetAcceleratedWidget(compositor_widget_->accelerated_widget()); 1277 compositor_->SetAcceleratedWidget(compositor_widget_->accelerated_widget());
1276 compositor_widget_->SetNSView(this); 1278 compositor_widget_->SetNSView(this);
1277 } 1279 }
1278 1280
1279 void BridgedNativeWidget::InitCompositor() { 1281 void BridgedNativeWidget::InitCompositor() {
1280 DCHECK(layer()); 1282 DCHECK(layer());
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1427 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1426 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1428 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1427 // changes. Previously we tried adding an NSView and removing it, but for some 1429 // changes. Previously we tried adding an NSView and removing it, but for some
1428 // reason it required reposting the mouse-down event, and didn't always work. 1430 // reason it required reposting the mouse-down event, and didn't always work.
1429 // Calling the below seems to be an effective solution. 1431 // Calling the below seems to be an effective solution.
1430 [window_ setMovableByWindowBackground:NO]; 1432 [window_ setMovableByWindowBackground:NO];
1431 [window_ setMovableByWindowBackground:YES]; 1433 [window_ setMovableByWindowBackground:YES];
1432 } 1434 }
1433 1435
1434 } // namespace views 1436 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698