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 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 // TODO(jcampan): This fails for a view under NativeWidgetGtk with | 1941 // TODO(jcampan): This fails for a view under NativeWidgetGtk with |
1942 // TYPE_CHILD. (see http://crbug.com/21335) reenable | 1942 // TYPE_CHILD. (see http://crbug.com/21335) reenable |
1943 // NOTREACHED assertion and verify accelerators works as | 1943 // NOTREACHED assertion and verify accelerators works as |
1944 // expected. | 1944 // expected. |
1945 #if defined(OS_WIN) | 1945 #if defined(OS_WIN) |
1946 NOTREACHED(); | 1946 NOTREACHED(); |
1947 #endif | 1947 #endif |
1948 return; | 1948 return; |
1949 } | 1949 } |
1950 // Only register accelerators if we are visible. | 1950 // Only register accelerators if we are visible. |
1951 if (!IsVisibleInRootView()) | 1951 if (!IsVisibleInRootView() || !GetWidget()->IsVisible()) |
1952 return; | 1952 return; |
1953 for (std::vector<Accelerator>::const_iterator i( | 1953 for (std::vector<Accelerator>::const_iterator i( |
1954 accelerators_->begin() + registered_accelerator_count_); | 1954 accelerators_->begin() + registered_accelerator_count_); |
1955 i != accelerators_->end(); ++i) { | 1955 i != accelerators_->end(); ++i) { |
1956 accelerator_focus_manager_->RegisterAccelerator(*i, this); | 1956 accelerator_focus_manager_->RegisterAccelerator(*i, this); |
1957 } | 1957 } |
1958 registered_accelerator_count_ = accelerators_->size(); | 1958 registered_accelerator_count_ = accelerators_->size(); |
1959 } | 1959 } |
1960 | 1960 |
1961 void View::UnregisterAccelerators(bool leave_data_intact) { | 1961 void View::UnregisterAccelerators(bool leave_data_intact) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 | 2056 |
2057 OSExchangeData data; | 2057 OSExchangeData data; |
2058 WriteDragData(press_pt, &data); | 2058 WriteDragData(press_pt, &data); |
2059 | 2059 |
2060 // Message the RootView to do the drag and drop. That way if we're removed | 2060 // Message the RootView to do the drag and drop. That way if we're removed |
2061 // the RootView can detect it and avoid calling us back. | 2061 // the RootView can detect it and avoid calling us back. |
2062 GetWidget()->RunShellDrag(this, data, drag_operations); | 2062 GetWidget()->RunShellDrag(this, data, drag_operations); |
2063 } | 2063 } |
2064 | 2064 |
2065 } // namespace views | 2065 } // namespace views |
OLD | NEW |