| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/view.h" | 5 #include "ui/views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 if (!GetWidget()) { | 1942 if (!GetWidget()) { |
| 1943 // The view is not yet attached to a widget, defer registration until then. | 1943 // The view is not yet attached to a widget, defer registration until then. |
| 1944 return; | 1944 return; |
| 1945 } | 1945 } |
| 1946 | 1946 |
| 1947 accelerator_focus_manager_ = GetFocusManager(); | 1947 accelerator_focus_manager_ = GetFocusManager(); |
| 1948 if (!accelerator_focus_manager_) { | 1948 if (!accelerator_focus_manager_) { |
| 1949 // Some crash reports seem to show that we may get cases where we have no | 1949 // Some crash reports seem to show that we may get cases where we have no |
| 1950 // focus manager (see bug #1291225). This should never be the case, just | 1950 // focus manager (see bug #1291225). This should never be the case, just |
| 1951 // making sure we don't crash. | 1951 // making sure we don't crash. |
| 1952 | |
| 1953 // TODO(jcampan): This fails for a view under NativeWidgetGtk with | |
| 1954 // TYPE_CHILD. (see http://crbug.com/21335) reenable | |
| 1955 // NOTREACHED assertion and verify accelerators works as | |
| 1956 // expected. | |
| 1957 #if defined(OS_WIN) | |
| 1958 NOTREACHED(); | 1952 NOTREACHED(); |
| 1959 #endif | |
| 1960 return; | 1953 return; |
| 1961 } | 1954 } |
| 1962 for (std::vector<ui::Accelerator>::const_iterator i( | 1955 for (std::vector<ui::Accelerator>::const_iterator i( |
| 1963 accelerators_->begin() + registered_accelerator_count_); | 1956 accelerators_->begin() + registered_accelerator_count_); |
| 1964 i != accelerators_->end(); ++i) { | 1957 i != accelerators_->end(); ++i) { |
| 1965 accelerator_focus_manager_->RegisterAccelerator( | 1958 accelerator_focus_manager_->RegisterAccelerator( |
| 1966 *i, ui::AcceleratorManager::kNormalPriority, this); | 1959 *i, ui::AcceleratorManager::kNormalPriority, this); |
| 1967 } | 1960 } |
| 1968 registered_accelerator_count_ = accelerators_->size(); | 1961 registered_accelerator_count_ = accelerators_->size(); |
| 1969 } | 1962 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 | 2063 |
| 2071 // Message the RootView to do the drag and drop. That way if we're removed | 2064 // Message the RootView to do the drag and drop. That way if we're removed |
| 2072 // the RootView can detect it and avoid calling us back. | 2065 // the RootView can detect it and avoid calling us back. |
| 2073 gfx::Point widget_location(event.location()); | 2066 gfx::Point widget_location(event.location()); |
| 2074 ConvertPointToWidget(this, &widget_location); | 2067 ConvertPointToWidget(this, &widget_location); |
| 2075 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); | 2068 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); |
| 2076 #endif // !defined(OS_MACOSX) | 2069 #endif // !defined(OS_MACOSX) |
| 2077 } | 2070 } |
| 2078 | 2071 |
| 2079 } // namespace views | 2072 } // namespace views |
| OLD | NEW |