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

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: Move the check to ash/. 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 DesktopNativeWidgetHelperAura::DesktopNativeWidgetHelperAura(
17 NativeWidgetAura* widget)
18 : widget_(widget) {
19 }
20
21 DesktopNativeWidgetHelperAura::~DesktopNativeWidgetHelperAura() {}
22
23 void DesktopNativeWidgetHelperAura::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 DesktopNativeWidgetHelperAura::ShowRootWindow() {
44 if (root_window_.get())
45 root_window_->ShowRootWindow();
46 }
47
48 aura::RootWindow* DesktopNativeWidgetHelperAura::GetRootWindow() {
49 return root_window_.get();
50 }
51
52 gfx::Rect DesktopNativeWidgetHelperAura::ModifyAndSetBounds(gfx::Rect bounds) {
53 if (root_window_.get() && !bounds.IsEmpty()) {
54 root_window_->SetHostBounds(bounds);
55 bounds.set_x(0);
56 bounds.set_y(0);
57 }
58
59 return bounds;
60 }
61
62 ////////////////////////////////////////////////////////////////////////////////
63 // DesktopNativeWidgetHelperAura, aura::RootWindowObserver implementation:
64
65 void DesktopNativeWidgetHelperAura::OnRootWindowResized(
66 const aura::RootWindow* root,
67 const gfx::Size& old_size) {
68 DCHECK_EQ(root, root_window_.get());
69 widget_->SetBounds(gfx::Rect(root->GetHostSize()));
70 }
71
72 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed(
73 const aura::RootWindow* root) {
74 DCHECK_EQ(root, root_window_.get());
75 widget_->GetWidget()->Close();
76 }
77
78 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_native_widget_helper_aura.h ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698