| OLD | NEW |
| 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 Loading... |
| 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 | |
| 147 if (parent) { | 140 if (parent) { |
| 148 parent->AddChild(window_); | 141 parent->AddChild(window_); |
| 149 } else { | 142 } else { |
| 150 aura::client::ParentWindowWithContext( | 143 aura::client::ParentWindowWithContext( |
| 151 window_, context->GetRootWindow(), window_bounds); | 144 window_, context->GetRootWindow(), window_bounds); |
| 152 } | 145 } |
| 153 | 146 |
| 154 // Wait to set the bounds until we have a parent. That way we can know our | 147 // Wait to set the bounds until we have a parent. That way we can know our |
| 155 // true state/bounds (the LayoutManager may enforce a particular | 148 // true state/bounds (the LayoutManager may enforce a particular |
| 156 // state/bounds). | 149 // state/bounds). |
| (...skipping 10 matching lines...) Expand all Loading... |
| 167 tooltip_manager_.reset(new views::TooltipManagerAura(GetWidget())); | 160 tooltip_manager_.reset(new views::TooltipManagerAura(GetWidget())); |
| 168 | 161 |
| 169 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); | 162 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); |
| 170 if (params.type != Widget::InitParams::TYPE_TOOLTIP && | 163 if (params.type != Widget::InitParams::TYPE_TOOLTIP && |
| 171 params.type != Widget::InitParams::TYPE_POPUP) { | 164 params.type != Widget::InitParams::TYPE_POPUP) { |
| 172 aura::client::SetDragDropDelegate(window_, this); | 165 aura::client::SetDragDropDelegate(window_, this); |
| 173 } | 166 } |
| 174 | 167 |
| 175 aura::client::SetActivationDelegate(window_, this); | 168 aura::client::SetActivationDelegate(window_, this); |
| 176 | 169 |
| 170 window_->SetProperty(aura::client::kCanMaximizeKey, |
| 171 GetWidget()->widget_delegate()->CanMaximize()); |
| 172 window_->SetProperty(aura::client::kCanResizeKey, |
| 173 GetWidget()->widget_delegate()->CanResize()); |
| 174 |
| 177 window_reorderer_.reset(new WindowReorderer(window_, | 175 window_reorderer_.reset(new WindowReorderer(window_, |
| 178 GetWidget()->GetRootView())); | 176 GetWidget()->GetRootView())); |
| 179 } | 177 } |
| 180 | 178 |
| 181 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { | 179 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { |
| 182 return NULL; | 180 return NULL; |
| 183 } | 181 } |
| 184 | 182 |
| 185 bool NativeWidgetAura::ShouldUseNativeFrame() const { | 183 bool NativeWidgetAura::ShouldUseNativeFrame() const { |
| 186 // There is only one frame type for aura. | 184 // There is only one frame type for aura. |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); | 1134 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); |
| 1137 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); | 1135 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); |
| 1138 return gfx::FontList(gfx::Font(caption_font)); | 1136 return gfx::FontList(gfx::Font(caption_font)); |
| 1139 #else | 1137 #else |
| 1140 return gfx::FontList(); | 1138 return gfx::FontList(); |
| 1141 #endif | 1139 #endif |
| 1142 } | 1140 } |
| 1143 | 1141 |
| 1144 } // namespace internal | 1142 } // namespace internal |
| 1145 } // namespace views | 1143 } // namespace views |
| OLD | NEW |