Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/native_control_gtk.h" | 5 #include "views/controls/native_control_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/base/accessibility/accessibility_types.h" | 10 #include "ui/base/accessibility/accessibility_types.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 if (!is_add && child == this && native_view()) { | 165 if (!is_add && child == this && native_view()) { |
| 166 Detach(); | 166 Detach(); |
| 167 } else if (is_add && GetWidget() && !native_view()) { | 167 } else if (is_add && GetWidget() && !native_view()) { |
| 168 // Create the widget when we're added to a valid Widget. Many | 168 // Create the widget when we're added to a valid Widget. Many |
| 169 // controls need a parent widget to function properly. | 169 // controls need a parent widget to function properly. |
| 170 CreateNativeControl(); | 170 CreateNativeControl(); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 void NativeControlGtk::VisibilityChanged(View* starting_from, bool is_visible) { | 174 void NativeControlGtk::VisibilityChanged(View* starting_from, bool is_visible) { |
| 175 if (starting_from != this) | |
| 176 return; | |
|
oshima
2011/10/10 08:10:09
I first thought this isn't correct (because you ne
| |
| 175 if (!is_visible) { | 177 if (!is_visible) { |
| 176 if (native_view()) { | 178 if (native_view()) { |
| 177 // We destroy the child widget when we become invisible because of the | 179 // We destroy the child widget when we become invisible because of the |
| 178 // performance cost of maintaining widgets that aren't currently needed. | 180 // performance cost of maintaining widgets that aren't currently needed. |
| 179 Detach(); | 181 Detach(); |
| 180 // Make sure that Detach destroyed the widget. | 182 // Make sure that Detach destroyed the widget. |
| 181 DCHECK(!native_view()); | 183 DCHECK(!native_view()); |
| 182 } | 184 } |
| 183 } else if (!native_view()) { | 185 } else if (!native_view()) { |
| 184 if (GetWidget()) | 186 if (GetWidget()) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 // options page is only based on views. | 244 // options page is only based on views. |
| 243 // NOTREACHED(); | 245 // NOTREACHED(); |
| 244 NOTIMPLEMENTED(); | 246 NOTIMPLEMENTED(); |
| 245 return false; | 247 return false; |
| 246 } | 248 } |
| 247 focus_manager->SetFocusedView(control->focus_view()); | 249 focus_manager->SetFocusedView(control->focus_view()); |
| 248 return false; | 250 return false; |
| 249 } | 251 } |
| 250 | 252 |
| 251 } // namespace views | 253 } // namespace views |
| OLD | NEW |