| OLD | NEW | 
|---|
| 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/controls/native_control_win.h" | 5 #include "views/controls/native_control_win.h" | 
| 6 | 6 | 
| 7 #include <windowsx.h> | 7 #include <windowsx.h> | 
| 8 | 8 | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "ui/base/l10n/l10n_util_win.h" | 10 #include "ui/base/l10n/l10n_util_win.h" | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 95     Layout(); | 95     Layout(); | 
| 96   } | 96   } | 
| 97 } | 97 } | 
| 98 | 98 | 
| 99 void NativeControlWin::Focus() { | 99 void NativeControlWin::Focus() { | 
| 100   DCHECK(native_view()); | 100   DCHECK(native_view()); | 
| 101   SetFocus(native_view()); | 101   SetFocus(native_view()); | 
| 102 | 102 | 
| 103   // Since we are being wrapped by a view, accessibility should receive | 103   // Since we are being wrapped by a view, accessibility should receive | 
| 104   // the super class as the focused view. | 104   // the super class as the focused view. | 
| 105   View* parent_view = GetParent(); | 105   View* parent_view = parent(); | 
| 106 | 106 | 
| 107   // Due to some controls not behaving as expected without having | 107   // Due to some controls not behaving as expected without having | 
| 108   // a native win32 control, we don't always send a native (MSAA) | 108   // a native win32 control, we don't always send a native (MSAA) | 
| 109   // focus notification. | 109   // focus notification. | 
| 110   bool send_native_event = | 110   bool send_native_event = | 
| 111       parent_view->GetClassName() != views::Combobox::kViewClassName && | 111       parent_view->GetClassName() != views::Combobox::kViewClassName && | 
| 112       parent_view->HasFocus(); | 112       parent_view->HasFocus(); | 
| 113 | 113 | 
| 114   // Send the accessibility focus notification. | 114   // Send the accessibility focus notification. | 
| 115   parent_view->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, | 115   parent_view->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 177 | 177 | 
| 178 LRESULT NativeControlWin::GetControlColor(UINT message, HDC dc, HWND sender) { | 178 LRESULT NativeControlWin::GetControlColor(UINT message, HDC dc, HWND sender) { | 
| 179   View *ancestor = this; | 179   View *ancestor = this; | 
| 180   while (ancestor) { | 180   while (ancestor) { | 
| 181     const Background* background = ancestor->background(); | 181     const Background* background = ancestor->background(); | 
| 182     if (background) { | 182     if (background) { | 
| 183       HBRUSH brush = background->GetNativeControlBrush(); | 183       HBRUSH brush = background->GetNativeControlBrush(); | 
| 184       if (brush) | 184       if (brush) | 
| 185         return reinterpret_cast<LRESULT>(brush); | 185         return reinterpret_cast<LRESULT>(brush); | 
| 186     } | 186     } | 
| 187     ancestor = ancestor->GetParent(); | 187     ancestor = ancestor->parent(); | 
| 188   } | 188   } | 
| 189 | 189 | 
| 190   // COLOR_BTNFACE is the default for dialog box backgrounds. | 190   // COLOR_BTNFACE is the default for dialog box backgrounds. | 
| 191   return reinterpret_cast<LRESULT>(GetSysColorBrush(COLOR_BTNFACE)); | 191   return reinterpret_cast<LRESULT>(GetSysColorBrush(COLOR_BTNFACE)); | 
| 192 } | 192 } | 
| 193 | 193 | 
| 194 // static | 194 // static | 
| 195 LRESULT NativeControlWin::NativeControlWndProc(HWND window, | 195 LRESULT NativeControlWin::NativeControlWndProc(HWND window, | 
| 196                                                UINT message, | 196                                                UINT message, | 
| 197                                                WPARAM w_param, | 197                                                WPARAM w_param, | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 214   } else if (message == WM_DESTROY) { | 214   } else if (message == WM_DESTROY) { | 
| 215     native_control->props_.reset(); | 215     native_control->props_.reset(); | 
| 216     ui::SetWindowProc(window, native_control->original_wndproc_); | 216     ui::SetWindowProc(window, native_control->original_wndproc_); | 
| 217   } | 217   } | 
| 218 | 218 | 
| 219   return CallWindowProc(native_control->original_wndproc_, window, message, | 219   return CallWindowProc(native_control->original_wndproc_, window, message, | 
| 220                         w_param, l_param); | 220                         w_param, l_param); | 
| 221 } | 221 } | 
| 222 | 222 | 
| 223 }  // namespace views | 223 }  // namespace views | 
| OLD | NEW | 
|---|