1 // Copyright 2013 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 #include "chrome/browser/ui/gtk/password_menu_model.h"
7 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
8 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h"
9 #include "grit/generated_resources.h"
10 #include "ui/base/l10n/l10n_util.h"
12 PasswordMenuModel::PasswordMenuModel(
13 ContentSettingBubbleModel* bubble_model,
14 ContentSettingBubbleGtk* bubble_contents)
15 : ui::SimpleMenuModel(this),
16 media_bubble_model_(bubble_model),
17 media_bubble_contents_(bubble_contents) {
18 AddItem(COMMAND_ID_NOPE,
19 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_DROP_DOWN));
20 AddItem(COMMAND_ID_NEVER_FOR_THIS_SITE,
21 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BLACKLIST_DROP_DOWN));
24 PasswordMenuModel::~PasswordMenuModel() {}
26 bool PasswordMenuModel::IsCommandIdChecked(int command_id) const {
30 bool PasswordMenuModel::IsCommandIdEnabled(int command_id) const {
34 bool PasswordMenuModel::GetAcceleratorForCommandId(
36 ui::Accelerator* accelerator) {
40 void PasswordMenuModel::ExecuteCommand(int command_id,
42 switch (static_cast<CommandID>(command_id)) {
44 media_bubble_model_->OnDoneClicked();
45 media_bubble_contents_->Close();
47 case COMMAND_ID_NEVER_FOR_THIS_SITE: {
48 media_bubble_model_->OnCancelClicked();
49 media_bubble_contents_->Close();