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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 // A default implementation of WidgetDelegate, used by Widget when no | 68 // A default implementation of WidgetDelegate, used by Widget when no |
69 // WidgetDelegate is supplied. | 69 // WidgetDelegate is supplied. |
70 class DefaultWidgetDelegate : public WidgetDelegate { | 70 class DefaultWidgetDelegate : public WidgetDelegate { |
71 public: | 71 public: |
72 explicit DefaultWidgetDelegate(Widget* widget) : widget_(widget) { | 72 explicit DefaultWidgetDelegate(Widget* widget) : widget_(widget) { |
73 } | 73 } |
74 virtual ~DefaultWidgetDelegate() {} | 74 ~DefaultWidgetDelegate() override {} |
75 | 75 |
76 // Overridden from WidgetDelegate: | 76 // Overridden from WidgetDelegate: |
77 virtual void DeleteDelegate() override { | 77 void DeleteDelegate() override { delete this; } |
78 delete this; | 78 Widget* GetWidget() override { return widget_; } |
79 } | 79 const Widget* GetWidget() const override { return widget_; } |
80 virtual Widget* GetWidget() override { | 80 bool ShouldAdvanceFocusToTopLevelWidget() const override { |
81 return widget_; | |
82 } | |
83 virtual const Widget* GetWidget() const override { | |
84 return widget_; | |
85 } | |
86 virtual bool ShouldAdvanceFocusToTopLevelWidget() const override { | |
87 // In most situations where a Widget is used without a delegate the Widget | 81 // In most situations where a Widget is used without a delegate the Widget |
88 // is used as a container, so that we want focus to advance to the top-level | 82 // is used as a container, so that we want focus to advance to the top-level |
89 // widget. A good example of this is the find bar. | 83 // widget. A good example of this is the find bar. |
90 return true; | 84 return true; |
91 } | 85 } |
92 | 86 |
93 private: | 87 private: |
94 Widget* widget_; | 88 Widget* widget_; |
95 | 89 |
96 DISALLOW_COPY_AND_ASSIGN(DefaultWidgetDelegate); | 90 DISALLOW_COPY_AND_ASSIGN(DefaultWidgetDelegate); |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1504 |
1511 //////////////////////////////////////////////////////////////////////////////// | 1505 //////////////////////////////////////////////////////////////////////////////// |
1512 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1506 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1513 | 1507 |
1514 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1508 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1515 return this; | 1509 return this; |
1516 } | 1510 } |
1517 | 1511 |
1518 } // namespace internal | 1512 } // namespace internal |
1519 } // namespace views | 1513 } // namespace views |
OLD | NEW |