Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / bubble_combobox.mm
blobea4ad147903843834f39d8e832da4b55d735a52d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "chrome/browser/ui/cocoa/bubble_combobox.h"
7 #include "ui/base/models/combobox_model.h"
8 #include "base/strings/sys_string_conversions.h"
10 @implementation BubbleCombobox
12 - (id)initWithFrame:(NSRect)frame
13           pullsDown:(BOOL)pullsDown
14               model:(ui::ComboboxModel*)model {
15   if ((self = [super initWithFrame:frame pullsDown:pullsDown])) {
16     [self setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
17     [self setBordered:YES];
18     [[self cell] setControlSize:NSSmallControlSize];
20     for (int i = 0; i < model->GetItemCount(); ++i) {
21       if (model->IsItemSeparatorAt(i))
22         [[self menu] addItem:[NSMenuItem separatorItem]];
23       else
24         [self addItemWithTitle:base::SysUTF16ToNSString(model->GetItemAt(i))];
25     }
27     [self selectItemAtIndex:model->GetDefaultIndex()];
28   }
29   return self;
32 @end