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

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

Issue 329743002: MacViews: Initial skeleton for implementing NativeWidgetMac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/cocoa/bridged_content_view.h ('k') | ui/views/cocoa/bridged_native_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ui/views/cocoa/bridged_content_view.h"
6
7 #include "base/logging.h"
8 #include "ui/gfx/canvas_paint_mac.h"
9 #include "ui/views/view.h"
10
11 @implementation BridgedContentView
12
13 @synthesize hostedView = hostedView_;
14
15 - (id)initWithView:(views::View*)viewToHost {
16 DCHECK(viewToHost);
17 gfx::Rect bounds = viewToHost->bounds();
18 // To keep things simple, assume the origin is (0, 0) until there exists a use
19 // case for something other than that.
20 DCHECK(bounds.origin().IsOrigin());
21 NSRect initialFrame = NSMakeRect(0, 0, bounds.width(), bounds.height());
22 if ((self = [super initWithFrame:initialFrame]))
23 hostedView_ = viewToHost;
24
25 return self;
26 }
27
28 - (void)clearView {
29 hostedView_ = NULL;
30 }
31
32 // NSView implementation.
33
34 - (void)setFrameSize:(NSSize)newSize {
35 [super setFrameSize:newSize];
36 if (!hostedView_)
37 return;
38
39 hostedView_->SetSize(gfx::Size(newSize.width, newSize.height));
40 }
41
42 - (void)drawRect:(NSRect)dirtyRect {
43 if (!hostedView_)
44 return;
45
46 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */);
47 hostedView_->Paint(&canvas, views::CullSet());
48 }
49
50 @end
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_content_view.h ('k') | ui/views/cocoa/bridged_native_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698