| 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/widget.h" | 5 #include "ui/views/widget/widget.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // static | 299 // static |
| 300 gfx::Size Widget::GetLocalizedContentsSize(int col_resource_id, | 300 gfx::Size Widget::GetLocalizedContentsSize(int col_resource_id, |
| 301 int row_resource_id) { | 301 int row_resource_id) { |
| 302 return gfx::Size(GetLocalizedContentsWidth(col_resource_id), | 302 return gfx::Size(GetLocalizedContentsWidth(col_resource_id), |
| 303 GetLocalizedContentsHeight(row_resource_id)); | 303 GetLocalizedContentsHeight(row_resource_id)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 // static | 306 // static |
| 307 bool Widget::RequiresNonClientView(InitParams::Type type) { | 307 bool Widget::RequiresNonClientView(InitParams::Type type) { |
| 308 return type == InitParams::TYPE_WINDOW || | 308 return type == InitParams::TYPE_WINDOW || |
| 309 type == InitParams::TYPE_DRAG_BROWSER || |
| 309 type == InitParams::TYPE_PANEL || | 310 type == InitParams::TYPE_PANEL || |
| 310 type == InitParams::TYPE_BUBBLE; | 311 type == InitParams::TYPE_BUBBLE; |
| 311 } | 312 } |
| 312 | 313 |
| 313 void Widget::Init(const InitParams& in_params) { | 314 void Widget::Init(const InitParams& in_params) { |
| 314 TRACE_EVENT0("views", "Widget::Init"); | 315 TRACE_EVENT0("views", "Widget::Init"); |
| 315 InitParams params = in_params; | 316 InitParams params = in_params; |
| 316 | 317 |
| 317 params.child |= (params.type == InitParams::TYPE_CONTROL); | 318 params.child |= (params.type == InitParams::TYPE_CONTROL); |
| 318 is_top_level_ = !params.child; | 319 is_top_level_ = !params.child; |
| 319 | 320 |
| 320 if (params.opacity == views::Widget::InitParams::INFER_OPACITY && | 321 if (params.opacity == views::Widget::InitParams::INFER_OPACITY && |
| 321 params.type != views::Widget::InitParams::TYPE_WINDOW && | 322 params.type != views::Widget::InitParams::TYPE_WINDOW && |
| 323 params.type != views::Widget::InitParams::TYPE_DRAG_BROWSER && |
| 322 params.type != views::Widget::InitParams::TYPE_PANEL) | 324 params.type != views::Widget::InitParams::TYPE_PANEL) |
| 323 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; | 325 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; |
| 324 | 326 |
| 325 if (ViewsDelegate::GetInstance()) | 327 if (ViewsDelegate::GetInstance()) |
| 326 ViewsDelegate::GetInstance()->OnBeforeWidgetInit(¶ms, this); | 328 ViewsDelegate::GetInstance()->OnBeforeWidgetInit(¶ms, this); |
| 327 | 329 |
| 328 if (params.opacity == views::Widget::InitParams::INFER_OPACITY) | 330 if (params.opacity == views::Widget::InitParams::INFER_OPACITY) |
| 329 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; | 331 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; |
| 330 | 332 |
| 331 bool can_activate = false; | 333 bool can_activate = false; |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 | 1485 |
| 1484 //////////////////////////////////////////////////////////////////////////////// | 1486 //////////////////////////////////////////////////////////////////////////////// |
| 1485 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1487 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1486 | 1488 |
| 1487 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1489 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1488 return this; | 1490 return this; |
| 1489 } | 1491 } |
| 1490 | 1492 |
| 1491 } // namespace internal | 1493 } // namespace internal |
| 1492 } // namespace views | 1494 } // namespace views |
| OLD | NEW |