Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Side by Side Diff: views/widget/widget_gtk.cc

Issue 6507028: Remove usages of RootView from View by moving relevant RootView API methods t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <X11/extensions/shape.h> 9 #include <X11/extensions/shape.h>
10 10
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/auto_reset.h" 14 #include "base/auto_reset.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/message_loop.h" 16 #include "base/message_loop.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "ui/base/dragdrop/drag_drop_types.h" 18 #include "ui/base/dragdrop/drag_drop_types.h"
19 #include "ui/base/dragdrop/os_exchange_data.h" 19 #include "ui/base/dragdrop/os_exchange_data.h"
20 #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h" 20 #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h"
21 #include "ui/gfx/path.h" 21 #include "ui/gfx/path.h"
22 #include "views/focus/view_storage.h"
22 #include "views/widget/default_theme_provider.h" 23 #include "views/widget/default_theme_provider.h"
23 #include "views/widget/drop_target_gtk.h" 24 #include "views/widget/drop_target_gtk.h"
24 #include "views/widget/gtk_views_fixed.h" 25 #include "views/widget/gtk_views_fixed.h"
25 #include "views/widget/gtk_views_window.h" 26 #include "views/widget/gtk_views_window.h"
26 #include "views/widget/root_view.h" 27 #include "views/widget/root_view.h"
27 #include "views/widget/tooltip_manager_gtk.h" 28 #include "views/widget/tooltip_manager_gtk.h"
28 #include "views/widget/widget_delegate.h" 29 #include "views/widget/widget_delegate.h"
29 #include "views/widget/widget_utils.h" 30 #include "views/widget/widget_utils.h"
30 #include "views/window/window_gtk.h" 31 #include "views/window/window_gtk.h"
31 32
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 opacity_(255), 245 opacity_(255),
245 drag_data_(NULL), 246 drag_data_(NULL),
246 in_paint_now_(false), 247 in_paint_now_(false),
247 is_active_(false), 248 is_active_(false),
248 transient_to_parent_(false), 249 transient_to_parent_(false),
249 got_initial_focus_in_(false), 250 got_initial_focus_in_(false),
250 has_focus_(false), 251 has_focus_(false),
251 delegate_(NULL), 252 delegate_(NULL),
252 always_on_top_(false), 253 always_on_top_(false),
253 is_double_buffered_(false), 254 is_double_buffered_(false),
254 should_handle_menu_key_release_(false) { 255 should_handle_menu_key_release_(false),
256 dragged_view_(NULL) {
255 static bool installed_message_loop_observer = false; 257 static bool installed_message_loop_observer = false;
256 if (!installed_message_loop_observer) { 258 if (!installed_message_loop_observer) {
257 installed_message_loop_observer = true; 259 installed_message_loop_observer = true;
258 MessageLoopForUI* loop = MessageLoopForUI::current(); 260 MessageLoopForUI* loop = MessageLoopForUI::current();
259 if (loop) 261 if (loop)
260 loop->AddObserver(DropObserver::GetInstance()); 262 loop->AddObserver(DropObserver::GetInstance());
261 } 263 }
262 264
263 if (type_ != TYPE_CHILD) 265 if (type_ != TYPE_CHILD)
264 focus_manager_ = new FocusManager(this); 266 focus_manager_ = new FocusManager(this);
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // dealing with cases where the widget has been unparented. 835 // dealing with cases where the widget has been unparented.
834 return root->GetFocusManager(); 836 return root->GetFocusManager();
835 } 837 }
836 return NULL; 838 return NULL;
837 } 839 }
838 840
839 void WidgetGtk::ViewHierarchyChanged(bool is_add, View *parent, 841 void WidgetGtk::ViewHierarchyChanged(bool is_add, View *parent,
840 View *child) { 842 View *child) {
841 if (drop_target_.get()) 843 if (drop_target_.get())
842 drop_target_->ResetTargetViewIfEquals(child); 844 drop_target_->ResetTargetViewIfEquals(child);
845
846 if (!is_add) {
847 if (child == dragged_view_)
848 dragged_view_ = NULL;
849
850 FocusManager* focus_manager = GetFocusManager();
851 if (focus_manager)
852 focus_manager->ViewRemoved(parent, child);
853 ViewStorage::GetInstance()->ViewRemoved(parent, child);
854 }
843 } 855 }
844 856
845 bool WidgetGtk::ContainsNativeView(gfx::NativeView native_view) { 857 bool WidgetGtk::ContainsNativeView(gfx::NativeView native_view) {
846 // TODO(port) See implementation in WidgetWin::ContainsNativeView. 858 // TODO(port) See implementation in WidgetWin::ContainsNativeView.
847 NOTREACHED() << "WidgetGtk::ContainsNativeView is not implemented."; 859 NOTREACHED() << "WidgetGtk::ContainsNativeView is not implemented.";
848 return false; 860 return false;
849 } 861 }
850 862
863 void WidgetGtk::StartDragForViewFromMouseEvent(
864 View* view,
865 const OSExchangeData& data,
866 int operation) {
867 // NOTE: view may be null.
868 dragged_view_ = view;
869 DoDrag(data, operation);
870 // If the view is removed during the drag operation, drag_view_ is set to
sky 2011/02/17 00:37:46 drag_view_ -> dragged_view_
871 // NULL.
872 if (view && dragged_view_ == view) {
873 dragged_view_ = NULL;
874 view->OnDragDone();
875 }
876 }
877
878 View* WidgetGtk::GetDraggedView() {
879 return dragged_view_;
880 }
881
851 //////////////////////////////////////////////////////////////////////////////// 882 ////////////////////////////////////////////////////////////////////////////////
852 // WidgetGtk, FocusTraversable implementation: 883 // WidgetGtk, FocusTraversable implementation:
853 884
854 FocusSearch* WidgetGtk::GetFocusSearch() { 885 FocusSearch* WidgetGtk::GetFocusSearch() {
855 return root_view_->GetFocusSearch(); 886 return root_view_->GetFocusSearch();
856 } 887 }
857 888
858 FocusTraversable* WidgetGtk::GetFocusTraversableParent() { 889 FocusTraversable* WidgetGtk::GetFocusTraversableParent() {
859 // We are a proxy to the root view, so we should be bypassed when traversing 890 // We are a proxy to the root view, so we should be bypassed when traversing
860 // up and as a result this should not be called. 891 // up and as a result this should not be called.
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 GtkWindow* window = GTK_WINDOW(element->data); 1690 GtkWindow* window = GTK_WINDOW(element->data);
1660 DCHECK(window); 1691 DCHECK(window);
1661 RootView *root_view = FindRootView(window); 1692 RootView *root_view = FindRootView(window);
1662 if (root_view) 1693 if (root_view)
1663 root_view->NotifyLocaleChanged(); 1694 root_view->NotifyLocaleChanged();
1664 } 1695 }
1665 g_list_free(window_list); 1696 g_list_free(window_list);
1666 } 1697 }
1667 1698
1668 } // namespace views 1699 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698