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

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

Issue 1159033008: Refactor ViewsDelegate singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 5 years, 6 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
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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 770 }
771 771
772 gfx::Size BridgedNativeWidget::GetClientAreaSize() const { 772 gfx::Size BridgedNativeWidget::GetClientAreaSize() const {
773 NSRect content_rect = [window_ contentRectForFrameRect:[window_ frame]]; 773 NSRect content_rect = [window_ contentRectForFrameRect:[window_ frame]];
774 return gfx::Size(NSWidth(content_rect), NSHeight(content_rect)); 774 return gfx::Size(NSWidth(content_rect), NSHeight(content_rect));
775 } 775 }
776 776
777 void BridgedNativeWidget::CreateCompositor() { 777 void BridgedNativeWidget::CreateCompositor() {
778 DCHECK(!compositor_); 778 DCHECK(!compositor_);
779 DCHECK(!compositor_widget_); 779 DCHECK(!compositor_widget_);
780 DCHECK(ViewsDelegate::views_delegate); 780 DCHECK(ViewsDelegate::GetInstance());
781 781
782 ui::ContextFactory* context_factory = 782 ui::ContextFactory* context_factory =
783 ViewsDelegate::views_delegate->GetContextFactory(); 783 ViewsDelegate::GetInstance()->GetContextFactory();
784 DCHECK(context_factory); 784 DCHECK(context_factory);
785 785
786 AddCompositorSuperview(); 786 AddCompositorSuperview();
787 787
788 // TODO(tapted): Get this value from GpuDataManagerImpl via ViewsDelegate. 788 // TODO(tapted): Get this value from GpuDataManagerImpl via ViewsDelegate.
789 bool needs_gl_finish_workaround = false; 789 bool needs_gl_finish_workaround = false;
790 790
791 compositor_widget_.reset( 791 compositor_widget_.reset(
792 new ui::AcceleratedWidgetMac(needs_gl_finish_workaround)); 792 new ui::AcceleratedWidgetMac(needs_gl_finish_workaround));
793 compositor_.reset(new ui::Compositor(compositor_widget_->accelerated_widget(), 793 compositor_.reset(new ui::Compositor(compositor_widget_->accelerated_widget(),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 window_, &kWindowPropertiesKey); 864 window_, &kWindowPropertiesKey);
865 if (!properties) { 865 if (!properties) {
866 properties = [NSMutableDictionary dictionary]; 866 properties = [NSMutableDictionary dictionary];
867 objc_setAssociatedObject(window_, &kWindowPropertiesKey, 867 objc_setAssociatedObject(window_, &kWindowPropertiesKey,
868 properties, OBJC_ASSOCIATION_RETAIN); 868 properties, OBJC_ASSOCIATION_RETAIN);
869 } 869 }
870 return properties; 870 return properties;
871 } 871 }
872 872
873 } // namespace views 873 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698