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

Side by Side Diff: ui/views/widget/desktop_native_widget_helper_aura.cc

Issue 10081022: Aura/ash split: Remove hacks and get chrome linking without ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hopefully fix macro problem. Created 8 years, 8 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 (c) 2012 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 #include "ui/views/widget/desktop_native_widget_helper_aura.h"
6
7 #include "ui/views/widget/native_widget_aura.h"
8 #include "ui/aura/root_window.h"
9 #include "ui/aura/desktop/desktop_activation_client.h"
10 #include "ui/aura/desktop/desktop_dispatcher_client.h"
11 #include "ui/aura/desktop/desktop_root_window_event_filter.h"
12 #include "ui/aura/client/dispatcher_client.h"
13
14 namespace views {
15
16 DesktopNatitveWidgetHelperAura::DesktopNatitveWidgetHelperAura(
17 NativeWidgetAura* widget)
18 : widget_(widget) {
19 }
20
21 DesktopNatitveWidgetHelperAura::~DesktopNatitveWidgetHelperAura() {}
22
23 void DesktopNatitveWidgetHelperAura::PreInitialize(
24 const Widget::InitParams& params) {
25 gfx::Rect bounds = params.bounds;
26 if (bounds.IsEmpty()) {
27 // We must pass some non-zero value when we initialize a RootWindow. This
28 // will probably be SetBounds()ed soon.
29 bounds.set_size(gfx::Size(100, 100));
30 }
31 root_window_.reset(new aura::RootWindow(bounds));
32 root_window_->SetEventFilter(
33 new aura::DesktopRootWindowEventFilter(root_window_.get()));
34 root_window_->AddRootWindowObserver(this);
35
36 aura::client::SetActivationClient(
37 root_window_.get(),
38 new aura::DesktopActivationClient(root_window_.get()));
39 aura::client::SetDispatcherClient(root_window_.get(),
40 new aura::DesktopDispatcherClient);
41 }
42
43 void DesktopNatitveWidgetHelperAura::ShowRootWindow() {
44 if (root_window_.get())
45 root_window_->ShowRootWindow();
46 }
47
48 gfx::Rect DesktopNatitveWidgetHelperAura::ModifyAndSetBounds(gfx::Rect bounds) {
49 if (root_window_.get() && !bounds.IsEmpty()) {
50 root_window_->SetHostBounds(bounds);
51 bounds.set_x(0);
52 bounds.set_y(0);
53 }
54
55 return bounds;
56 }
57
58 ////////////////////////////////////////////////////////////////////////////////
59 // DesktopNatitveWidgetHelperAura, aura::RootWindowObserver implementation:
60
61 void DesktopNatitveWidgetHelperAura::OnRootWindowResized(
62 const aura::RootWindow* root,
63 const gfx::Size& old_size) {
64 widget_->SetBounds(gfx::Rect(root->GetHostSize()));
65 }
66
67 void DesktopNatitveWidgetHelperAura::OnRootWindowHostClosed(
68 const aura::RootWindow* root) {
69 widget_->GetWidget()->Close();
70 }
71
72 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698