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

Side by Side Diff: views/widget/native_widget_aura.cc

Issue 7744045: Show a Window in the aura views demo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « views/widget/native_widget_aura.h ('k') | views/widget/widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/widget/native_widget_aura.h" 5 #include "views/widget/native_widget_aura.h"
6 6
7 #include "aura/window.h" 7 #include "aura/window.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/compositor/layer.h" 9 #include "ui/gfx/compositor/layer.h"
10 #include "ui/gfx/font.h"
10 #include "views/widget/native_widget_delegate.h" 11 #include "views/widget/native_widget_delegate.h"
11 12
13 #if defined(OS_WIN)
14 #include "base/win/scoped_gdi_object.h"
15 #include "base/win/win_util.h"
16 #include "ui/base/l10n/l10n_util_win.h"
17 #endif
18
12 namespace views { 19 namespace views {
13 20
14 //////////////////////////////////////////////////////////////////////////////// 21 ////////////////////////////////////////////////////////////////////////////////
15 // NativeWidgetAura, public: 22 // NativeWidgetAura, public:
16 23
17 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) 24 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate)
18 : delegate_(delegate), 25 : delegate_(delegate),
19 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))) { 26 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))) {
20 window_->set_id(1200); 27 window_->set_id(1200);
21 } 28 }
22 29
23 NativeWidgetAura::~NativeWidgetAura() { 30 NativeWidgetAura::~NativeWidgetAura() {
24 } 31 }
25 32
33 // static
34 gfx::Font NativeWidgetAura::GetWindowTitleFont() {
35 #if defined(OS_WIN)
36 NONCLIENTMETRICS ncm;
37 base::win::GetNonClientMetrics(&ncm);
38 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
39 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
40 return gfx::Font(caption_font);
41 #else
42 return gfx::Font();
43 #endif
44 }
45
26 //////////////////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////////////////
27 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: 47 // NativeWidgetAura, internal::NativeWidgetPrivate implementation:
28 48
29 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { 49 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
30 window_->Init(); 50 window_->Init();
31 window_->SetBounds(params.bounds, 0); 51 window_->SetBounds(params.bounds, 0);
32 window_->SetParent(params.parent); 52 window_->SetParent(params.parent);
33 // TODO(beng): do this some other way. 53 // TODO(beng): do this some other way.
34 delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); 54 delegate_->OnNativeWidgetSizeChanged(params.bounds.size());
35 window_->SetVisibility(aura::Window::VISIBILITY_SHOWN); 55 window_->SetVisibility(aura::Window::VISIBILITY_SHOWN);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 431 }
412 432
413 // static 433 // static
414 bool NativeWidgetPrivate::IsMouseButtonDown() { 434 bool NativeWidgetPrivate::IsMouseButtonDown() {
415 NOTIMPLEMENTED(); 435 NOTIMPLEMENTED();
416 return false; 436 return false;
417 } 437 }
418 438
419 } // namespace internal 439 } // namespace internal
420 } // namespace views 440 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/native_widget_aura.h ('k') | views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698