summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/frame/system_menu_model.cc
blob: 1affc2aa9e52590e3e218cf440a19fb686581367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/frame/system_menu_model.h"

#include <windows.h>

#include <algorithm>

SystemMenuModel::SystemMenuModel(ui::SimpleMenuModel::Delegate* delegate)
    : ui::SimpleMenuModel(delegate) {
}

SystemMenuModel::~SystemMenuModel() {
}

int SystemMenuModel::GetFirstItemIndex(gfx::NativeMenu native_menu) const {
  // We allow insertions before last item (Close).
  return std::max(0, GetMenuItemCount(native_menu) - 1);
}

int SystemMenuModel::FlipIndex(int index) const {
  return GetItemCount() - index - 1;
}