| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "mojo/services/native_viewport/native_viewport.h" | 5 #include "mojo/services/native_viewport/native_viewport.h" |
| 6 | 6 |
| 7 #import <AppKit/NSApplication.h> | 7 #import <AppKit/NSApplication.h> |
| 8 #import <AppKit/NSView.h> | 8 #import <AppKit/NSView.h> |
| 9 #import <AppKit/NSWindow.h> | 9 #import <AppKit/NSWindow.h> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual void Init(const gfx::Rect& bounds) OVERRIDE { | 31 virtual void Init(const gfx::Rect& bounds) OVERRIDE { |
| 32 [NSApplication sharedApplication]; | 32 [NSApplication sharedApplication]; |
| 33 | 33 |
| 34 rect_ = bounds; | 34 rect_ = bounds; |
| 35 window_ = [[NSWindow alloc] | 35 window_ = [[NSWindow alloc] |
| 36 initWithContentRect:NSRectFromCGRect(rect_.ToCGRect()) | 36 initWithContentRect:NSRectFromCGRect(rect_.ToCGRect()) |
| 37 styleMask:NSTitledWindowMask | 37 styleMask:NSTitledWindowMask |
| 38 backing:NSBackingStoreBuffered | 38 backing:NSBackingStoreBuffered |
| 39 defer:NO]; | 39 defer:NO]; |
| 40 delegate_->OnAcceleratedWidgetAvailable([window_ contentView]); | 40 delegate_->OnAcceleratedWidgetAvailable([window_ contentView]); |
| 41 delegate_->OnBoundsChanged(rect_); |
| 41 } | 42 } |
| 42 | 43 |
| 43 virtual void Show() OVERRIDE { | 44 virtual void Show() OVERRIDE { |
| 44 [window_ orderFront:nil]; | 45 [window_ orderFront:nil]; |
| 45 } | 46 } |
| 46 | 47 |
| 47 virtual void Close() OVERRIDE { | 48 virtual void Close() OVERRIDE { |
| 48 // TODO(beng): perform this in response to NSWindow destruction. | 49 // TODO(beng): perform this in response to NSWindow destruction. |
| 49 delegate_->OnDestroyed(); | 50 delegate_->OnDestroyed(); |
| 50 } | 51 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 74 | 75 |
| 75 // static | 76 // static |
| 76 scoped_ptr<NativeViewport> NativeViewport::Create( | 77 scoped_ptr<NativeViewport> NativeViewport::Create( |
| 77 shell::Context* context, | 78 shell::Context* context, |
| 78 NativeViewportDelegate* delegate) { | 79 NativeViewportDelegate* delegate) { |
| 79 return scoped_ptr<NativeViewport>(new NativeViewportMac(delegate)).Pass(); | 80 return scoped_ptr<NativeViewport>(new NativeViewportMac(delegate)).Pass(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace services | 83 } // namespace services |
| 83 } // namespace mojo | 84 } // namespace mojo |
| OLD | NEW |