OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/views/extensions/extension_shelf.h" | 5 #include "chrome/browser/views/extensions/extension_shelf.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 int count = model_->count(); | 974 int count = model_->count(); |
975 if (count == 0) | 975 if (count == 0) |
976 return NULL; | 976 return NULL; |
977 | 977 |
978 if (x < 0) | 978 if (x < 0) |
979 return NULL; | 979 return NULL; |
980 | 980 |
981 for (int i = 0; i < count; ++i) { | 981 for (int i = 0; i < count; ++i) { |
982 Toolstrip* toolstrip = ToolstripAtIndex(i); | 982 Toolstrip* toolstrip = ToolstripAtIndex(i); |
983 View* view = toolstrip->GetShelfView(); | 983 View* view = toolstrip->GetShelfView(); |
984 if (x > (view->x() + view->width() + kToolstripPadding)) | 984 int x_mirrored = view->GetRootView()->MirroredXCoordinateInsideView(x); |
| 985 if (x_mirrored > view->x() + view->width() + kToolstripPadding) |
985 continue; | 986 continue; |
986 return toolstrip; | 987 return toolstrip; |
987 } | 988 } |
988 | 989 |
989 return NULL; | 990 return NULL; |
990 } | 991 } |
991 | 992 |
992 ExtensionShelf::Toolstrip* ExtensionShelf::ToolstripAtIndex(int index) { | 993 ExtensionShelf::Toolstrip* ExtensionShelf::ToolstripAtIndex(int index) { |
993 return static_cast<Toolstrip*>(model_->ToolstripAt(index).data); | 994 return static_cast<Toolstrip*>(model_->ToolstripAt(index).data); |
994 } | 995 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 | 1077 |
1077 bool ExtensionShelf::IsAlwaysShown() { | 1078 bool ExtensionShelf::IsAlwaysShown() { |
1078 Profile* profile = browser_->profile(); | 1079 Profile* profile = browser_->profile(); |
1079 return profile->GetPrefs()->GetBoolean(prefs::kShowExtensionShelf); | 1080 return profile->GetPrefs()->GetBoolean(prefs::kShowExtensionShelf); |
1080 } | 1081 } |
1081 | 1082 |
1082 bool ExtensionShelf::OnNewTabPage() { | 1083 bool ExtensionShelf::OnNewTabPage() { |
1083 return (browser_ && browser_->GetSelectedTabContents() && | 1084 return (browser_ && browser_->GetSelectedTabContents() && |
1084 browser_->GetSelectedTabContents()->IsExtensionShelfAlwaysVisible()); | 1085 browser_->GetSelectedTabContents()->IsExtensionShelfAlwaysVisible()); |
1085 } | 1086 } |
OLD | NEW |