Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / bubble_combobox.mm
blobb093fcccded631f96a2f1e003c9273261ec0fe9a
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 "base/strings/sys_string_conversions.h"
8 #include "ui/base/models/combobox_model.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