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/widget/widget_impl.h" | 5 #include "views/widget/widget_impl.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "views/focus/focus_manager.h" | 9 #include "views/focus/focus_manager.h" |
10 #include "views/focus/view_storage.h" | |
10 #include "views/view.h" | 11 #include "views/view.h" |
11 #include "views/widget/native_widget.h" | 12 #include "views/widget/native_widget.h" |
12 #include "views/widget/root_view.h" | 13 #include "views/widget/root_view.h" |
13 | 14 |
14 namespace views { | 15 namespace views { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 // TODO(beng): move to platform file | 19 // TODO(beng): move to platform file |
19 int GetHorizontalDragThreshold() { | 20 int GetHorizontalDragThreshold() { |
(...skipping 26 matching lines...) Expand all Loading... | |
46 // WidgetImpl, public: | 47 // WidgetImpl, public: |
47 | 48 |
48 WidgetImpl::WidgetImpl(View* contents_view) | 49 WidgetImpl::WidgetImpl(View* contents_view) |
49 : ALLOW_THIS_IN_INITIALIZER_LIST( | 50 : ALLOW_THIS_IN_INITIALIZER_LIST( |
50 native_widget_(NativeWidget::CreateNativeWidget(this))), | 51 native_widget_(NativeWidget::CreateNativeWidget(this))), |
51 ALLOW_THIS_IN_INITIALIZER_LIST(root_view_(new RootView(this))), | 52 ALLOW_THIS_IN_INITIALIZER_LIST(root_view_(new RootView(this))), |
52 contents_view_(contents_view), | 53 contents_view_(contents_view), |
53 is_mouse_button_pressed_(false), | 54 is_mouse_button_pressed_(false), |
54 last_mouse_event_was_move_(false), | 55 last_mouse_event_was_move_(false), |
55 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)), | 56 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)), |
56 delete_on_destroy_(true) { | 57 delete_on_destroy_(true), |
58 dragged_view_(NULL) { | |
57 } | 59 } |
58 | 60 |
59 WidgetImpl::~WidgetImpl() { | 61 WidgetImpl::~WidgetImpl() { |
60 } | 62 } |
61 | 63 |
62 void WidgetImpl::InitWithNativeViewParent(gfx::NativeView parent, | 64 void WidgetImpl::InitWithNativeViewParent(gfx::NativeView parent, |
63 const gfx::Rect& bounds) { | 65 const gfx::Rect& bounds) { |
64 native_widget_->InitWithNativeViewParent(parent, bounds); | 66 native_widget_->InitWithNativeViewParent(parent, bounds); |
65 } | 67 } |
66 | 68 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 void* WidgetImpl::GetNativeWindowProperty(const char* name) { | 360 void* WidgetImpl::GetNativeWindowProperty(const char* name) { |
359 return native_widget_->GetNativeWindowProperty(name); | 361 return native_widget_->GetNativeWindowProperty(name); |
360 } | 362 } |
361 | 363 |
362 ThemeProvider* WidgetImpl::GetDefaultThemeProvider() const { | 364 ThemeProvider* WidgetImpl::GetDefaultThemeProvider() const { |
363 NOTIMPLEMENTED(); | 365 NOTIMPLEMENTED(); |
364 return NULL; | 366 return NULL; |
365 } | 367 } |
366 | 368 |
367 void WidgetImpl::ViewHierarchyChanged(bool is_add, View* parent, View* child) { | 369 void WidgetImpl::ViewHierarchyChanged(bool is_add, View* parent, View* child) { |
368 NOTIMPLEMENTED(); | 370 if (!is_add) { |
371 FocusManager* focus_manager = GetFocusManager(); | |
372 if (focus_manager) | |
373 focus_manager->ViewRemoved(parent, child); | |
374 ViewStorage::GetInstance()->ViewRemoved(parent, child); | |
sky
2011/02/17 00:37:46
Don't you need the:
if (child == dragged_view_)
| |
375 } | |
369 } | 376 } |
370 | 377 |
371 bool WidgetImpl::ContainsNativeView(gfx::NativeView native_view) { | 378 bool WidgetImpl::ContainsNativeView(gfx::NativeView native_view) { |
372 NOTIMPLEMENTED(); | 379 NOTIMPLEMENTED(); |
373 return false; | 380 return false; |
374 } | 381 } |
375 | 382 |
383 void WidgetImpl::StartDragForViewFromMouseEvent( | |
384 View* view, | |
385 const OSExchangeData& data, | |
386 int operation) { | |
387 // NOTE: view may be NULL. | |
388 dragged_view_ = view; | |
389 native_widget_->RunShellDrag(data, operation); | |
390 | |
391 // If the view is removed during the drag operation, drag_view_ is set to | |
392 // NULL. | |
393 if (view && dragged_view_ == view) { | |
394 dragged_view_ = NULL; | |
395 view->OnDragDone(); | |
396 } | |
397 } | |
398 | |
399 View* WidgetImpl::GetDraggedView() { | |
400 return dragged_view_; | |
401 } | |
402 | |
376 //////////////////////////////////////////////////////////////////////////////// | 403 //////////////////////////////////////////////////////////////////////////////// |
377 // WidgetImpl, private: | 404 // WidgetImpl, private: |
378 | 405 |
379 void WidgetImpl::CloseNow() { | 406 void WidgetImpl::CloseNow() { |
380 native_widget_->Close(); | 407 native_widget_->Close(); |
381 } | 408 } |
382 | 409 |
383 #if !defined(OS_WIN) | 410 #if !defined(OS_WIN) |
384 | 411 |
385 //////////////////////////////////////////////////////////////////////////////// | 412 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 20 matching lines...) Expand all Loading... | |
406 // static | 433 // static |
407 NativeWidget* NativeWidget::GetTopLevelNativeWidget( | 434 NativeWidget* NativeWidget::GetTopLevelNativeWidget( |
408 gfx::NativeView native_view) { | 435 gfx::NativeView native_view) { |
409 return NULL; | 436 return NULL; |
410 } | 437 } |
411 | 438 |
412 #endif // !defined(OS_WIN) | 439 #endif // !defined(OS_WIN) |
413 | 440 |
414 } // namespace views | 441 } // namespace views |
415 | 442 |
OLD | NEW |