- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / gtk / password_menu_model.cc
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.
4
5 #include "chrome/browser/ui/gtk/password_menu_model.h"
6
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"
11
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));
22 }
23
24 PasswordMenuModel::~PasswordMenuModel() {}
25
26 bool PasswordMenuModel::IsCommandIdChecked(int command_id) const {
27   return false;
28 }
29
30 bool PasswordMenuModel::IsCommandIdEnabled(int command_id) const {
31   return true;
32 }
33
34 bool PasswordMenuModel::GetAcceleratorForCommandId(
35     int command_id,
36     ui::Accelerator* accelerator) {
37   return false;
38 }
39
40 void PasswordMenuModel::ExecuteCommand(int command_id,
41                                        int event_flags) {
42   switch (static_cast<CommandID>(command_id)) {
43     case COMMAND_ID_NOPE:
44       media_bubble_model_->OnDoneClicked();
45       media_bubble_contents_->Close();
46       break;
47     case COMMAND_ID_NEVER_FOR_THIS_SITE: {
48       media_bubble_model_->OnCancelClicked();
49       media_bubble_contents_->Close();
50       break;
51     }
52   }
53 }