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

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

Issue 140023: Reverting 18872. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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
« no previous file with comments | « views/widget/accelerator_handler.cc ('k') | views/widget/widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/root_view.h" 5 #include "views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/drag_drop_types.h" 9 #include "app/drag_drop_types.h"
10 #include "app/gfx/canvas.h" 10 #include "app/gfx/canvas.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 void Run() { 41 void Run() {
42 if (root_view_) 42 if (root_view_)
43 root_view_->PaintNow(); 43 root_view_->PaintNow();
44 } 44 }
45 private: 45 private:
46 // The target root view. 46 // The target root view.
47 RootView* root_view_; 47 RootView* root_view_;
48 48
49 DISALLOW_COPY_AND_ASSIGN(PaintTask); 49 DISALLOW_EVIL_CONSTRUCTORS(PaintTask);
50 }; 50 };
51 51
52 const char RootView::kViewClassName[] = "views/RootView"; 52 const char RootView::kViewClassName[] = "views/RootView";
53 53
54 ///////////////////////////////////////////////////////////////////////////// 54 /////////////////////////////////////////////////////////////////////////////
55 // 55 //
56 // RootView - constructors, destructors, initialization 56 // RootView - constructors, destructors, initialization
57 // 57 //
58 ///////////////////////////////////////////////////////////////////////////// 58 /////////////////////////////////////////////////////////////////////////////
59 59
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 FocusView(NULL); 255 FocusView(NULL);
256 } 256 }
257 257
258 if (child == drag_view_) 258 if (child == drag_view_)
259 drag_view_ = NULL; 259 drag_view_ = NULL;
260 260
261 if (default_keyboard_handler_ == child) { 261 if (default_keyboard_handler_ == child) {
262 default_keyboard_handler_ = NULL; 262 default_keyboard_handler_ = NULL;
263 } 263 }
264 264
265 FocusManager* focus_manager = widget_->GetFocusManager(); 265 // For a given widget hierarchy, focus is tracked by a FocusManager attached
266 // An unparanted RootView does not have a FocusManager. 266 // to our nearest enclosing Window. <-- Important Assumption!
267 if (focus_manager) 267 // We may not have access to our window if this function is called as a
268 // result of teardown during the deletion of the RootView and its hierarchy,
269 // so we don't bother notifying the FocusManager in that case because it
270 // will have already been destroyed (the Widget that contains us is
271 // NCDESTROY'ed which in turn destroys the focus manager _before_ the
272 // RootView is deleted.)
273 #if defined(OS_WIN)
274 Window* window = GetWindow();
275 if (window) {
276 FocusManager* focus_manager =
277 FocusManager::GetFocusManager(window->GetNativeWindow());
268 focus_manager->ViewRemoved(parent, child); 278 focus_manager->ViewRemoved(parent, child);
279 }
269 ViewStorage::GetSharedInstance()->ViewRemoved(parent, child); 280 ViewStorage::GetSharedInstance()->ViewRemoved(parent, child);
281 #endif
270 } 282 }
271 } 283 }
272 284
273 void RootView::SetFocusOnMousePressed(bool f) { 285 void RootView::SetFocusOnMousePressed(bool f) {
274 focus_on_mouse_pressed_ = f; 286 focus_on_mouse_pressed_ = f;
275 } 287 }
276 288
277 bool RootView::OnMousePressed(const MouseEvent& e) { 289 bool RootView::OnMousePressed(const MouseEvent& e) {
278 // This function does not normally handle non-client messages except for 290 // This function does not normally handle non-client messages except for
279 // non-client double-clicks. Actually, all double-clicks are special as the 291 // non-client double-clicks. Actually, all double-clicks are special as the
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 void RootView::OnWidgetDestroyed() { 514 void RootView::OnWidgetDestroyed() {
503 #if defined(OS_WIN) 515 #if defined(OS_WIN)
504 if (drop_target_.get()) { 516 if (drop_target_.get()) {
505 RevokeDragDrop(GetWidget()->GetNativeView()); 517 RevokeDragDrop(GetWidget()->GetNativeView());
506 drop_target_ = NULL; 518 drop_target_ = NULL;
507 } 519 }
508 #else 520 #else
509 // TODO(port): Port RootViewDropTarget and this goes away. 521 // TODO(port): Port RootViewDropTarget and this goes away.
510 NOTIMPLEMENTED(); 522 NOTIMPLEMENTED();
511 #endif 523 #endif
524 widget_ = NULL;
512 } 525 }
513 526
514 void RootView::ProcessMouseDragCanceled() { 527 void RootView::ProcessMouseDragCanceled() {
515 if (mouse_pressed_handler_) { 528 if (mouse_pressed_handler_) {
516 // Synthesize a release event. 529 // Synthesize a release event.
517 MouseEvent release_event(Event::ET_MOUSE_RELEASED, last_mouse_event_x_, 530 MouseEvent release_event(Event::ET_MOUSE_RELEASED, last_mouse_event_x_,
518 last_mouse_event_y_, last_mouse_event_flags_); 531 last_mouse_event_y_, last_mouse_event_flags_);
519 OnMouseReleased(release_event, true); 532 OnMouseReleased(release_event, true);
520 } 533 }
521 } 534 }
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 previous_cursor_ = NULL; 952 previous_cursor_ = NULL;
940 } 953 }
941 #elif defined(OS_LINUX) 954 #elif defined(OS_LINUX)
942 gdk_window_set_cursor(GetWidget()->GetNativeView()->window, cursor); 955 gdk_window_set_cursor(GetWidget()->GetNativeView()->window, cursor);
943 if (cursor) 956 if (cursor)
944 gdk_cursor_destroy(cursor); 957 gdk_cursor_destroy(cursor);
945 #endif 958 #endif
946 } 959 }
947 960
948 } // namespace views 961 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/accelerator_handler.cc ('k') | views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698