OLD | NEW |
1 // Copyright (c) 2009 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_win.h" | 5 #include "views/widget/widget_win.h" |
6 | 6 |
7 #include "app/l10n_util_win.h" | 7 #include "app/l10n_util_win.h" |
8 #include "app/system_monitor.h" | 8 #include "app/system_monitor.h" |
9 #include "app/win_util.h" | 9 #include "app/win_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/win_util.h" | 11 #include "base/win_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 active_mouse_tracking_flags_(0), | 50 active_mouse_tracking_flags_(0), |
51 has_capture_(false), | 51 has_capture_(false), |
52 use_layered_buffer_(true), | 52 use_layered_buffer_(true), |
53 layered_alpha_(255), | 53 layered_alpha_(255), |
54 delete_on_destroy_(true), | 54 delete_on_destroy_(true), |
55 can_update_layered_window_(true), | 55 can_update_layered_window_(true), |
56 last_mouse_event_was_move_(false), | 56 last_mouse_event_was_move_(false), |
57 is_mouse_down_(false), | 57 is_mouse_down_(false), |
58 is_window_(false), | 58 is_window_(false), |
59 restore_focus_when_enabled_(false), | 59 restore_focus_when_enabled_(false), |
60 delegate_(NULL) { | 60 delegate_(NULL), |
| 61 accessibility_view_events_index_(-1), |
| 62 accessibility_view_events_(kMaxAccessibilityViewEvents) { |
61 } | 63 } |
62 | 64 |
63 WidgetWin::~WidgetWin() { | 65 WidgetWin::~WidgetWin() { |
64 } | 66 } |
65 | 67 |
66 // static | 68 // static |
67 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { | 69 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { |
68 // TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is | 70 // TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is |
69 // associated with a WidgetWin (it might be a pure | 71 // associated with a WidgetWin (it might be a pure |
70 // WindowImpl). | 72 // WindowImpl). |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 use_layered_buffer_ = use_layered_buffer; | 107 use_layered_buffer_ = use_layered_buffer; |
106 if (!hwnd()) | 108 if (!hwnd()) |
107 return; | 109 return; |
108 | 110 |
109 if (use_layered_buffer_) | 111 if (use_layered_buffer_) |
110 LayoutRootView(); | 112 LayoutRootView(); |
111 else | 113 else |
112 contents_.reset(NULL); | 114 contents_.reset(NULL); |
113 } | 115 } |
114 | 116 |
| 117 View* WidgetWin::GetAccessibilityViewEventAt(int id) { |
| 118 // Convert from MSAA child id. |
| 119 id = -(id + 1); |
| 120 DCHECK(id >= 0 && id < kMaxAccessibilityViewEvents); |
| 121 return accessibility_view_events_[id]; |
| 122 } |
| 123 |
| 124 int WidgetWin::AddAccessibilityViewEvent(View* view) { |
| 125 accessibility_view_events_index_ = |
| 126 (accessibility_view_events_index_ + 1) % kMaxAccessibilityViewEvents; |
| 127 accessibility_view_events_[accessibility_view_events_index_] = view; |
| 128 |
| 129 // Convert to MSAA child id. |
| 130 return -(accessibility_view_events_index_ + 1); |
| 131 } |
| 132 |
| 133 void WidgetWin::ClearAccessibilityViewEvent(View* view) { |
| 134 for (std::vector<View*>::iterator it = accessibility_view_events_.begin(); |
| 135 it != accessibility_view_events_.end(); |
| 136 ++it) { |
| 137 if (*it == view) |
| 138 *it = NULL; |
| 139 } |
| 140 } |
| 141 |
115 /////////////////////////////////////////////////////////////////////////////// | 142 /////////////////////////////////////////////////////////////////////////////// |
116 // Widget implementation: | 143 // Widget implementation: |
117 | 144 |
118 void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) { | 145 void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) { |
119 // Force creation of the RootView; otherwise, we may get a WM_SIZE after the | 146 // Force creation of the RootView; otherwise, we may get a WM_SIZE after the |
120 // window is created and before the root view is set up. | 147 // window is created and before the root view is set up. |
121 GetRootView(); | 148 GetRootView(); |
122 | 149 |
123 // Create the window. | 150 // Create the window. |
124 WindowImpl::Init(parent, bounds); | 151 WindowImpl::Init(parent, bounds); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // dealing with cases where the widget has been unparented. | 448 // dealing with cases where the widget has been unparented. |
422 return widget->GetFocusManager(); | 449 return widget->GetFocusManager(); |
423 } | 450 } |
424 return NULL; | 451 return NULL; |
425 } | 452 } |
426 | 453 |
427 void WidgetWin::ViewHierarchyChanged(bool is_add, View *parent, | 454 void WidgetWin::ViewHierarchyChanged(bool is_add, View *parent, |
428 View *child) { | 455 View *child) { |
429 if (drop_target_.get()) | 456 if (drop_target_.get()) |
430 drop_target_->ResetTargetViewIfEquals(child); | 457 drop_target_->ResetTargetViewIfEquals(child); |
| 458 |
| 459 if (!is_add) |
| 460 ClearAccessibilityViewEvent(child); |
431 } | 461 } |
432 | 462 |
433 | 463 |
434 bool WidgetWin::ContainsNativeView(gfx::NativeView native_view) { | 464 bool WidgetWin::ContainsNativeView(gfx::NativeView native_view) { |
435 if (hwnd() == native_view) | 465 if (hwnd() == native_view) |
436 return true; | 466 return true; |
437 | 467 |
438 // Traverse the set of parents of the given view to determine if native_view | 468 // Traverse the set of parents of the given view to determine if native_view |
439 // is a descendant of this window. | 469 // is a descendant of this window. |
440 HWND parent_window = ::GetParent(native_view); | 470 HWND parent_window = ::GetParent(native_view); |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1366 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
1337 return Widget::GetWidgetFromNativeView(native_window); | 1367 return Widget::GetWidgetFromNativeView(native_window); |
1338 } | 1368 } |
1339 | 1369 |
1340 // static | 1370 // static |
1341 void Widget::NotifyLocaleChanged() { | 1371 void Widget::NotifyLocaleChanged() { |
1342 NOTIMPLEMENTED(); | 1372 NOTIMPLEMENTED(); |
1343 } | 1373 } |
1344 | 1374 |
1345 } // namespace views | 1375 } // namespace views |
OLD | NEW |