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/native_widget_aura.cc

Issue 251733004: Set kCanMaximizeKey/kCanResizeKey before adding to parent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete delegate Created 6 years, 7 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 | ui/views/widget/native_widget_aura_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/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (parent && window_bounds == gfx::Rect()) { 130 if (parent && window_bounds == gfx::Rect()) {
131 // If a parent is specified but no bounds are given, 131 // If a parent is specified but no bounds are given,
132 // use the origin of the parent's display so that the widget 132 // use the origin of the parent's display so that the widget
133 // will be added to the same display as the parent. 133 // will be added to the same display as the parent.
134 gfx::Rect bounds = gfx::Screen::GetScreenFor(parent)-> 134 gfx::Rect bounds = gfx::Screen::GetScreenFor(parent)->
135 GetDisplayNearestWindow(parent).bounds(); 135 GetDisplayNearestWindow(parent).bounds();
136 window_bounds.set_origin(bounds.origin()); 136 window_bounds.set_origin(bounds.origin());
137 } 137 }
138 } 138 }
139 139
140 // Set properties before addeing to the parent so that its layout manager
141 // sees the correct values.
142 window_->SetProperty(aura::client::kCanMaximizeKey,
143 GetWidget()->widget_delegate()->CanMaximize());
144 window_->SetProperty(aura::client::kCanResizeKey,
145 GetWidget()->widget_delegate()->CanResize());
146
140 if (parent) { 147 if (parent) {
141 parent->AddChild(window_); 148 parent->AddChild(window_);
142 } else { 149 } else {
143 aura::client::ParentWindowWithContext( 150 aura::client::ParentWindowWithContext(
144 window_, context->GetRootWindow(), window_bounds); 151 window_, context->GetRootWindow(), window_bounds);
145 } 152 }
146 153
147 // Wait to set the bounds until we have a parent. That way we can know our 154 // Wait to set the bounds until we have a parent. That way we can know our
148 // true state/bounds (the LayoutManager may enforce a particular 155 // true state/bounds (the LayoutManager may enforce a particular
149 // state/bounds). 156 // state/bounds).
(...skipping 10 matching lines...) Expand all
160 tooltip_manager_.reset(new views::TooltipManagerAura(GetWidget())); 167 tooltip_manager_.reset(new views::TooltipManagerAura(GetWidget()));
161 168
162 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); 169 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView()));
163 if (params.type != Widget::InitParams::TYPE_TOOLTIP && 170 if (params.type != Widget::InitParams::TYPE_TOOLTIP &&
164 params.type != Widget::InitParams::TYPE_POPUP) { 171 params.type != Widget::InitParams::TYPE_POPUP) {
165 aura::client::SetDragDropDelegate(window_, this); 172 aura::client::SetDragDropDelegate(window_, this);
166 } 173 }
167 174
168 aura::client::SetActivationDelegate(window_, this); 175 aura::client::SetActivationDelegate(window_, this);
169 176
170 window_->SetProperty(aura::client::kCanMaximizeKey,
171 GetWidget()->widget_delegate()->CanMaximize());
172 window_->SetProperty(aura::client::kCanResizeKey,
173 GetWidget()->widget_delegate()->CanResize());
174
175 window_reorderer_.reset(new WindowReorderer(window_, 177 window_reorderer_.reset(new WindowReorderer(window_,
176 GetWidget()->GetRootView())); 178 GetWidget()->GetRootView()));
177 } 179 }
178 180
179 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { 181 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() {
180 return NULL; 182 return NULL;
181 } 183 }
182 184
183 bool NativeWidgetAura::ShouldUseNativeFrame() const { 185 bool NativeWidgetAura::ShouldUseNativeFrame() const {
184 // There is only one frame type for aura. 186 // There is only one frame type for aura.
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1136 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1135 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1137 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1136 return gfx::FontList(gfx::Font(caption_font)); 1138 return gfx::FontList(gfx::Font(caption_font));
1137 #else 1139 #else
1138 return gfx::FontList(); 1140 return gfx::FontList();
1139 #endif 1141 #endif
1140 } 1142 }
1141 1143
1142 } // namespace internal 1144 } // namespace internal
1143 } // namespace views 1145 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/native_widget_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698