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

Side by Side Diff: trunk/src/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 127073003: Revert 243413 "Resize the widget when top level popup windows cr..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 | « no previous file | trunk/src/ui/views/widget/widget_unittest.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) 2012 The Chromium Authors. All rights reserved. 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 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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "ui/aura/client/activation_client.h" 9 #include "ui/aura/client/activation_client.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 top_level_handler->top_level_widget_ = new Widget(); 98 top_level_handler->top_level_widget_ = new Widget();
99 top_level_handler->top_level_widget_->Init(init_params); 99 top_level_handler->top_level_widget_->Init(init_params);
100 100
101 top_level_handler->top_level_widget_->SetFullscreen(full_screen); 101 top_level_handler->top_level_widget_->SetFullscreen(full_screen);
102 top_level_handler->top_level_widget_->Show(); 102 top_level_handler->top_level_widget_->Show();
103 103
104 aura::Window* native_window = 104 aura::Window* native_window =
105 top_level_handler->top_level_widget_->GetNativeView(); 105 top_level_handler->top_level_widget_->GetNativeView();
106 child_window->AddObserver(top_level_handler); 106 child_window->AddObserver(top_level_handler);
107 native_window->AddObserver(top_level_handler); 107 native_window->AddObserver(top_level_handler);
108 top_level_handler->child_window_ = child_window;
109 return native_window; 108 return native_window;
110 } 109 }
111 110
112 // aura::WindowObserver overrides 111 // aura::WindowObserver overrides
113 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { 112 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
114 window->RemoveObserver(this); 113 window->RemoveObserver(this);
115 114
116 // If the widget is being destroyed by the OS then we should not try and 115 // If the widget is being destroyed by the OS then we should not try and
117 // destroy it again. 116 // destroy it again.
118 if (top_level_widget_ && 117 if (top_level_widget_ &&
119 window == top_level_widget_->GetNativeView()) { 118 window == top_level_widget_->GetNativeView()) {
120 top_level_widget_ = NULL; 119 top_level_widget_ = NULL;
121 return; 120 return;
122 } 121 }
123 122
124 if (top_level_widget_) { 123 if (top_level_widget_) {
125 DCHECK(top_level_widget_->GetNativeView()); 124 DCHECK(top_level_widget_->GetNativeView());
126 top_level_widget_->GetNativeView()->RemoveObserver(this); 125 top_level_widget_->GetNativeView()->RemoveObserver(this);
127 // When we receive a notification that the child of the window created 126 // When we receive a notification that the child of the window created
128 // above is being destroyed we go ahead and initiate the destruction of 127 // above is being destroyed we go ahead and initiate the destruction of
129 // the corresponding widget. 128 // the corresponding widget.
130 top_level_widget_->Close(); 129 top_level_widget_->Close();
131 top_level_widget_ = NULL; 130 top_level_widget_ = NULL;
132 } 131 }
133 delete this; 132 delete this;
134 } 133 }
135 134
136 virtual void OnWindowBoundsChanged(aura::Window* window,
137 const gfx::Rect& old_bounds,
138 const gfx::Rect& new_bounds) OVERRIDE {
139 if (top_level_widget_ && window == child_window_)
140 top_level_widget_->SetSize(new_bounds.size());
141 }
142
143 private: 135 private:
144 DesktopNativeWidgetTopLevelHandler() 136 DesktopNativeWidgetTopLevelHandler()
145 : top_level_widget_(NULL), 137 : top_level_widget_(NULL) {}
146 child_window_(NULL) {}
147 138
148 virtual ~DesktopNativeWidgetTopLevelHandler() {} 139 virtual ~DesktopNativeWidgetTopLevelHandler() {}
149 140
150 Widget* top_level_widget_; 141 Widget* top_level_widget_;
151 aura::Window* child_window_;
152 142
153 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetTopLevelHandler); 143 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetTopLevelHandler);
154 }; 144 };
155 145
156 class DesktopNativeWidgetAuraWindowTreeClient : 146 class DesktopNativeWidgetAuraWindowTreeClient :
157 public aura::client::WindowTreeClient { 147 public aura::client::WindowTreeClient {
158 public: 148 public:
159 explicit DesktopNativeWidgetAuraWindowTreeClient( 149 explicit DesktopNativeWidgetAuraWindowTreeClient(
160 aura::Window* root_window) 150 aura::Window* root_window)
161 : root_window_(root_window) { 151 : root_window_(root_window) {
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 input_method_event_filter_->SetInputMethodPropertyInRootWindow( 1116 input_method_event_filter_->SetInputMethodPropertyInRootWindow(
1127 root_window_->window()); 1117 root_window_->window());
1128 root_window_event_filter_->AddHandler(input_method_event_filter_.get()); 1118 root_window_event_filter_->AddHandler(input_method_event_filter_.get());
1129 } 1119 }
1130 1120
1131 void DesktopNativeWidgetAura::UpdateWindowTransparency() { 1121 void DesktopNativeWidgetAura::UpdateWindowTransparency() {
1132 content_window_->SetTransparent(ShouldUseNativeFrame()); 1122 content_window_->SetTransparent(ShouldUseNativeFrame());
1133 } 1123 }
1134 1124
1135 } // namespace views 1125 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | trunk/src/ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698