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 "chrome/browser/ui/views/frame/system_menu_model.h" | 5 #include "chrome/browser/ui/views/frame/system_menu_model.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 SystemMenuModel::SystemMenuModel(ui::SimpleMenuModel::Delegate* delegate) | 11 SystemMenuModel::SystemMenuModel(ui::SimpleMenuModel::Delegate* delegate) |
12 : ui::SimpleMenuModel(delegate) { | 12 : ui::SimpleMenuModel(delegate) { |
13 } | 13 } |
14 | 14 |
15 SystemMenuModel::~SystemMenuModel() { | 15 SystemMenuModel::~SystemMenuModel() { |
16 } | 16 } |
17 | 17 |
18 int SystemMenuModel::GetFirstItemIndex(gfx::NativeMenu native_menu) const { | 18 int SystemMenuModel::GetFirstItemIndex(gfx::NativeMenu native_menu) const { |
19 // We allow insertions before last item (Close). | 19 // We allow insertions before last item (Close). |
20 return std::max(0, GetMenuItemCount(native_menu) - 1); | 20 return std::max(0, GetMenuItemCount(native_menu) - 1); |
21 } | 21 } |
22 | |
23 int SystemMenuModel::FlipIndex(int index) const { | |
24 return GetItemCount() - index - 1; | |
25 } | |
OLD | NEW |