| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 // A default implementation of WidgetDelegate, used by Widget when no | 69 // A default implementation of WidgetDelegate, used by Widget when no |
| 70 // WidgetDelegate is supplied. | 70 // WidgetDelegate is supplied. |
| 71 class DefaultWidgetDelegate : public WidgetDelegate { | 71 class DefaultWidgetDelegate : public WidgetDelegate { |
| 72 public: | 72 public: |
| 73 DefaultWidgetDelegate(Widget* widget, const Widget::InitParams& params) | 73 DefaultWidgetDelegate(Widget* widget, const Widget::InitParams& params) |
| 74 : widget_(widget), | 74 : widget_(widget), |
| 75 can_activate_(!params.child && | 75 can_activate_(!params.child && |
| 76 params.type != Widget::InitParams::TYPE_POPUP) { | 76 params.type != Widget::InitParams::TYPE_POPUP && |
| 77 params.type != Widget::InitParams::TYPE_DRAG) { |
| 77 } | 78 } |
| 78 virtual ~DefaultWidgetDelegate() {} | 79 virtual ~DefaultWidgetDelegate() {} |
| 79 | 80 |
| 80 // Overridden from WidgetDelegate: | 81 // Overridden from WidgetDelegate: |
| 81 virtual void DeleteDelegate() OVERRIDE { | 82 virtual void DeleteDelegate() OVERRIDE { |
| 82 delete this; | 83 delete this; |
| 83 } | 84 } |
| 84 virtual Widget* GetWidget() OVERRIDE { | 85 virtual Widget* GetWidget() OVERRIDE { |
| 85 return widget_; | 86 return widget_; |
| 86 } | 87 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 135 |
| 135 Widget::InitParams::InitParams(Type type) | 136 Widget::InitParams::InitParams(Type type) |
| 136 : type(type), | 137 : type(type), |
| 137 delegate(NULL), | 138 delegate(NULL), |
| 138 child(type == TYPE_CONTROL), | 139 child(type == TYPE_CONTROL), |
| 139 opacity(((type == TYPE_WINDOW || type == TYPE_PANEL) && | 140 opacity(((type == TYPE_WINDOW || type == TYPE_PANEL) && |
| 140 ViewsDelegate::views_delegate && | 141 ViewsDelegate::views_delegate && |
| 141 ViewsDelegate::views_delegate->UseTransparentWindows()) ? | 142 ViewsDelegate::views_delegate->UseTransparentWindows()) ? |
| 142 TRANSLUCENT_WINDOW : INFER_OPACITY), | 143 TRANSLUCENT_WINDOW : INFER_OPACITY), |
| 143 accept_events(true), | 144 accept_events(true), |
| 144 can_activate(type != TYPE_POPUP && type != TYPE_MENU), | 145 can_activate(type != TYPE_POPUP && type != TYPE_MENU && |
| 145 keep_on_top(type == TYPE_MENU), | 146 type != TYPE_DRAG), |
| 147 keep_on_top(type == TYPE_MENU || type == TYPE_DRAG), |
| 146 ownership(NATIVE_WIDGET_OWNS_WIDGET), | 148 ownership(NATIVE_WIDGET_OWNS_WIDGET), |
| 147 mirror_origin_in_rtl(false), | 149 mirror_origin_in_rtl(false), |
| 148 has_dropshadow(false), | 150 has_dropshadow(false), |
| 149 remove_standard_frame(false), | 151 remove_standard_frame(false), |
| 150 use_system_default_icon(false), | 152 use_system_default_icon(false), |
| 151 show_state(ui::SHOW_STATE_DEFAULT), | 153 show_state(ui::SHOW_STATE_DEFAULT), |
| 152 double_buffer(false), | 154 double_buffer(false), |
| 153 parent(NULL), | 155 parent(NULL), |
| 154 native_widget(NULL), | 156 native_widget(NULL), |
| 155 desktop_root_window_host(NULL), | 157 desktop_root_window_host(NULL), |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 | 1429 |
| 1428 //////////////////////////////////////////////////////////////////////////////// | 1430 //////////////////////////////////////////////////////////////////////////////// |
| 1429 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1431 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1430 | 1432 |
| 1431 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1433 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1432 return this; | 1434 return this; |
| 1433 } | 1435 } |
| 1434 | 1436 |
| 1435 } // namespace internal | 1437 } // namespace internal |
| 1436 } // namespace views | 1438 } // namespace views |
| OLD | NEW |