Index: mojo/services/native_viewport/native_viewport_mac.mm |
diff --git a/mojo/services/native_viewport/native_viewport_mac.mm b/mojo/services/native_viewport/native_viewport_mac.mm |
index 1a6d70aa8bde28e6206f26dee5c78218eebeec22..d856bcfff689b9788ead40f995d9c1f754dda970 100644 |
--- a/mojo/services/native_viewport/native_viewport_mac.mm |
+++ b/mojo/services/native_viewport/native_viewport_mac.mm |
@@ -8,38 +8,26 @@ |
#import <AppKit/NSView.h> |
#import <AppKit/NSWindow.h> |
-#include "base/bind.h" |
-#include "base/mac/scoped_nsobject.h" |
-#include "gpu/command_buffer/client/gl_in_process_context.h" |
-#include "gpu/command_buffer/client/gles2_implementation.h" |
-#include "ui/gfx/rect.h" |
- |
namespace mojo { |
namespace services { |
class NativeViewportMac : public NativeViewport { |
public: |
NativeViewportMac(NativeViewportDelegate* delegate) |
- : delegate_(delegate), |
- window_(nil), |
- rect_(10, 10, 500, 500) { |
- [NSApplication sharedApplication]; |
+ : NativeViewport(delegate), |
+ window_(nil) { |
+ bounds_ = gfx::Rect(10, 10, 500, 500); |
+ [NSApplication sharedApplication]; |
window_ = [[NSWindow alloc] |
- initWithContentRect:NSRectFromCGRect(rect_.ToCGRect()) |
+ initWithContentRect:NSRectFromCGRect(bounds_.ToCGRect()) |
styleMask:NSTitledWindowMask |
backing:NSBackingStoreBuffered |
defer:NO]; |
[window_ orderFront:nil]; |
+ widget_ = [window_ contentView]; |
- gpu::GLInProcessContextAttribs attribs; |
- gl_context_.reset(gpu::GLInProcessContext::CreateContext( |
- false, [window_ contentView], rect_.size(), false, |
- attribs, gfx::PreferDiscreteGpu)); |
- gl_context_->SetContextLostCallback(base::Bind( |
- &NativeViewportMac::OnGLContextLost, base::Unretained(this))); |
- |
- delegate_->OnGLContextAvailable(gl_context_->GetImplementation()); |
+ OnAcceleratedWidgetAvailable(); |
} |
virtual ~NativeViewportMac() { |
@@ -54,15 +42,7 @@ class NativeViewportMac : public NativeViewport { |
delegate_->OnDestroyed(); |
} |
- void OnGLContextLost() { |
- gl_context_.reset(); |
- delegate_->OnGLContextLost(); |
- } |
- |
- NativeViewportDelegate* delegate_; |
NSWindow* window_; |
- gfx::Rect rect_; |
- scoped_ptr<gpu::GLInProcessContext> gl_context_; |
DISALLOW_COPY_AND_ASSIGN(NativeViewportMac); |
}; |