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/view.h" | 5 #include "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 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 // TODO(jcampan): This fails for a view under NativeWidgetGtk with | 1963 // TODO(jcampan): This fails for a view under NativeWidgetGtk with |
1964 // TYPE_CHILD. (see http://crbug.com/21335) reenable | 1964 // TYPE_CHILD. (see http://crbug.com/21335) reenable |
1965 // NOTREACHED assertion and verify accelerators works as | 1965 // NOTREACHED assertion and verify accelerators works as |
1966 // expected. | 1966 // expected. |
1967 #if defined(OS_WIN) | 1967 #if defined(OS_WIN) |
1968 NOTREACHED(); | 1968 NOTREACHED(); |
1969 #endif | 1969 #endif |
1970 return; | 1970 return; |
1971 } | 1971 } |
1972 // Only register accelerators if we are visible. | 1972 // Only register accelerators if we are visible. |
1973 if (!IsVisibleInRootView()) | 1973 if (!IsVisibleInRootView() || !GetWidget()->IsVisible()) |
1974 return; | 1974 return; |
1975 for (std::vector<Accelerator>::const_iterator i( | 1975 for (std::vector<Accelerator>::const_iterator i( |
1976 accelerators_->begin() + registered_accelerator_count_); | 1976 accelerators_->begin() + registered_accelerator_count_); |
1977 i != accelerators_->end(); ++i) { | 1977 i != accelerators_->end(); ++i) { |
1978 accelerator_focus_manager_->RegisterAccelerator(*i, this); | 1978 accelerator_focus_manager_->RegisterAccelerator(*i, this); |
1979 } | 1979 } |
1980 registered_accelerator_count_ = accelerators_->size(); | 1980 registered_accelerator_count_ = accelerators_->size(); |
1981 } | 1981 } |
1982 | 1982 |
1983 void View::UnregisterAccelerators(bool leave_data_intact) { | 1983 void View::UnregisterAccelerators(bool leave_data_intact) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2078 | 2078 |
2079 OSExchangeData data; | 2079 OSExchangeData data; |
2080 WriteDragData(press_pt, &data); | 2080 WriteDragData(press_pt, &data); |
2081 | 2081 |
2082 // Message the RootView to do the drag and drop. That way if we're removed | 2082 // Message the RootView to do the drag and drop. That way if we're removed |
2083 // the RootView can detect it and avoid calling us back. | 2083 // the RootView can detect it and avoid calling us back. |
2084 GetWidget()->RunShellDrag(this, data, drag_operations); | 2084 GetWidget()->RunShellDrag(this, data, drag_operations); |
2085 } | 2085 } |
2086 | 2086 |
2087 } // namespace views | 2087 } // namespace views |
OLD | NEW |