OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef NDEBUG | 8 #ifndef NDEBUG |
9 #include <iostream> | 9 #include <iostream> |
10 #endif | 10 #endif |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 return; | 988 return; |
989 } | 989 } |
990 | 990 |
991 RootView* root_view = GetRootView(); | 991 RootView* root_view = GetRootView(); |
992 if (!root_view) { | 992 if (!root_view) { |
993 // We are not yet part of a view hierarchy, we'll register ourselves once | 993 // We are not yet part of a view hierarchy, we'll register ourselves once |
994 // added to one. | 994 // added to one. |
995 return; | 995 return; |
996 } | 996 } |
997 | 997 |
998 // TODO(port): Fix this once we have a FocusManger for Linux. | |
999 #if defined(OS_WIN) | |
1000 FocusManager* focus_manager = GetFocusManager(); | 998 FocusManager* focus_manager = GetFocusManager(); |
1001 if (!focus_manager) { | 999 if (!focus_manager) { |
1002 // Some crash reports seem to show that we may get cases where we have no | 1000 // Some crash reports seem to show that we may get cases where we have no |
1003 // focus manager (see bug #1291225). This should never be the case, just | 1001 // focus manager (see bug #1291225). This should never be the case, just |
1004 // making sure we don't crash. | 1002 // making sure we don't crash. |
1005 NOTREACHED(); | 1003 NOTREACHED(); |
1006 return; | 1004 return; |
1007 } | 1005 } |
1008 std::vector<Accelerator>::const_iterator iter; | 1006 std::vector<Accelerator>::const_iterator iter; |
1009 for (iter = accelerators_->begin() + registered_accelerator_count_; | 1007 for (iter = accelerators_->begin() + registered_accelerator_count_; |
1010 iter != accelerators_->end(); ++iter) { | 1008 iter != accelerators_->end(); ++iter) { |
1011 focus_manager->RegisterAccelerator(*iter, this); | 1009 focus_manager->RegisterAccelerator(*iter, this); |
1012 } | 1010 } |
1013 registered_accelerator_count_ = accelerators_->size(); | 1011 registered_accelerator_count_ = accelerators_->size(); |
1014 #endif | |
1015 } | 1012 } |
1016 | 1013 |
1017 void View::UnregisterAccelerators() { | 1014 void View::UnregisterAccelerators() { |
1018 if (!accelerators_.get()) | 1015 if (!accelerators_.get()) |
1019 return; | 1016 return; |
1020 | 1017 |
1021 RootView* root_view = GetRootView(); | 1018 RootView* root_view = GetRootView(); |
1022 if (root_view) { | 1019 if (root_view) { |
1023 // TODO(port): Fix this once we have a FocusManger for Linux. | 1020 // TODO(port): Fix this once we have a FocusManger for Linux. |
1024 #if defined(OS_WIN) | 1021 #if defined(OS_WIN) |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 start_x = start_y = 0; | 1394 start_x = start_y = 0; |
1398 } | 1395 } |
1399 | 1396 |
1400 void View::DragInfo::PossibleDrag(int x, int y) { | 1397 void View::DragInfo::PossibleDrag(int x, int y) { |
1401 possible_drag = true; | 1398 possible_drag = true; |
1402 start_x = x; | 1399 start_x = x; |
1403 start_y = y; | 1400 start_y = y; |
1404 } | 1401 } |
1405 | 1402 |
1406 } // namespace | 1403 } // namespace |
OLD | NEW |