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

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

Issue 329743002: MacViews: Initial skeleton for implementing NativeWidgetMac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to master now we have stats 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
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_native_widget.h"
6
7 #include "base/logging.h"
Andre 2014/06/11 18:02:52 Is this for DCHECK? Seems inconsistent with Bridge
tapted 2014/06/12 09:13:12 Yep it's for the DCHECK. logging.h slips in easily
8 #import "ui/views/cocoa/bridged_content_view.h"
9
10 namespace views {
11
12 BridgedNativeWidget::BridgedNativeWidget() {
13 }
14
15 BridgedNativeWidget::~BridgedNativeWidget() {
16 SetRootView(NULL);
17 }
18
19 void BridgedNativeWidget::Init(base::scoped_nsobject<NSWindow> window) {
20 DCHECK(!window_);
21 window_.swap(window);
22 }
23
24 void BridgedNativeWidget::SetRootView(views::View* view) {
25 if (view == [bridged_view_ hostedView])
26 return;
27
28 [bridged_view_ clearView];
29 bridged_view_.reset();
30 // Note that there can still be references to the old |bridged_view_|
31 // floating around in Cocoa libraries at this point. However, references to
32 // the old views::View will be gone, so any method calls will become no-ops.
33
34 if (view)
35 bridged_view_.reset([[BridgedContentView alloc] initWithView:view]);
36 [window_ setContentView:bridged_view_];
37 }
38
39 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698