| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/widget/widget_gtk.h" | 5 #include "views/widget/widget_gtk.h" |
| 6 | 6 |
| 7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
| 8 #include "app/gfx/path.h" | 8 #include "app/gfx/path.h" |
| 9 #include "app/os_exchange_data.h" | 9 #include "app/os_exchange_data.h" |
| 10 #include "app/os_exchange_data_provider_gtk.h" | 10 #include "app/os_exchange_data_provider_gtk.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 MessageLoopForUI* loop = MessageLoopForUI::current(); | 105 MessageLoopForUI* loop = MessageLoopForUI::current(); |
| 106 if (loop) | 106 if (loop) |
| 107 loop->AddObserver(DropObserver::Get()); | 107 loop->AddObserver(DropObserver::Get()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (type_ != TYPE_CHILD) | 110 if (type_ != TYPE_CHILD) |
| 111 focus_manager_.reset(new FocusManager(this)); | 111 focus_manager_.reset(new FocusManager(this)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 WidgetGtk::~WidgetGtk() { | 114 WidgetGtk::~WidgetGtk() { |
| 115 DCHECK(delete_on_destroy_ || widget_ == NULL); |
| 115 if (type_ != TYPE_CHILD) | 116 if (type_ != TYPE_CHILD) |
| 116 ActiveWindowWatcherX::RemoveObserver(this); | 117 ActiveWindowWatcherX::RemoveObserver(this); |
| 117 MessageLoopForUI::current()->RemoveObserver(this); | 118 MessageLoopForUI::current()->RemoveObserver(this); |
| 118 } | 119 } |
| 119 | 120 |
| 120 GtkWindow* WidgetGtk::GetTransientParent() const { | 121 GtkWindow* WidgetGtk::GetTransientParent() const { |
| 121 return (type_ != TYPE_CHILD && widget_) ? | 122 return (type_ != TYPE_CHILD && widget_) ? |
| 122 gtk_window_get_transient_for(GTK_WINDOW(widget_)) : NULL; | 123 gtk_window_get_transient_for(GTK_WINDOW(widget_)) : NULL; |
| 123 } | 124 } |
| 124 | 125 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 Hide(); | 438 Hide(); |
| 438 if (close_widget_factory_.empty()) { | 439 if (close_widget_factory_.empty()) { |
| 439 // And we delay the close just in case we're on the stack. | 440 // And we delay the close just in case we're on the stack. |
| 440 MessageLoop::current()->PostTask(FROM_HERE, | 441 MessageLoop::current()->PostTask(FROM_HERE, |
| 441 close_widget_factory_.NewRunnableMethod( | 442 close_widget_factory_.NewRunnableMethod( |
| 442 &WidgetGtk::CloseNow)); | 443 &WidgetGtk::CloseNow)); |
| 443 } | 444 } |
| 444 } | 445 } |
| 445 | 446 |
| 446 void WidgetGtk::CloseNow() { | 447 void WidgetGtk::CloseNow() { |
| 447 if (widget_) | 448 if (widget_) { |
| 448 gtk_widget_destroy(widget_); | 449 gtk_widget_destroy(widget_); |
| 450 widget_ = NULL; |
| 451 } |
| 449 } | 452 } |
| 450 | 453 |
| 451 void WidgetGtk::Show() { | 454 void WidgetGtk::Show() { |
| 452 if (widget_) | 455 if (widget_) |
| 453 gtk_widget_show(widget_); | 456 gtk_widget_show(widget_); |
| 454 } | 457 } |
| 455 | 458 |
| 456 void WidgetGtk::Hide() { | 459 void WidgetGtk::Hide() { |
| 457 if (widget_) | 460 if (widget_) |
| 458 gtk_widget_hide(widget_); | 461 gtk_widget_hide(widget_); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1315 |
| 1313 // static | 1316 // static |
| 1314 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1317 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
| 1315 gpointer raw_widget = g_object_get_data(G_OBJECT(native_window), kWidgetKey); | 1318 gpointer raw_widget = g_object_get_data(G_OBJECT(native_window), kWidgetKey); |
| 1316 if (raw_widget) | 1319 if (raw_widget) |
| 1317 return reinterpret_cast<Widget*>(raw_widget); | 1320 return reinterpret_cast<Widget*>(raw_widget); |
| 1318 return NULL; | 1321 return NULL; |
| 1319 } | 1322 } |
| 1320 | 1323 |
| 1321 } // namespace views | 1324 } // namespace views |
| OLD | NEW |