Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: chrome/browser/ui/website_settings/permission_menu_model.cc

Issue 10887027: (GTK only) Replace checkboxes with menus and add support for managed settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang build Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/website_settings/permission_menu_model.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/website_settings/permission_menu_model.h"
6
7 #include "grit/generated_resources.h"
8 #include "ui/base/l10n/l10n_util.h"
9
10 PermissionMenuModel::PermissionMenuModel(
11 Delegate* delegate,
12 ContentSettingsType type,
13 ContentSetting default_setting,
14 ContentSetting current_setting)
15 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
16 delegate_(delegate) {
17 string16 label;
18 switch (default_setting) {
19 case CONTENT_SETTING_ALLOW:
20 label = l10n_util::GetStringUTF16(
21 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ALLOW);
22 break;
23 case CONTENT_SETTING_BLOCK:
24 label = l10n_util::GetStringUTF16(
25 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_BLOCK);
26 break;
27 case CONTENT_SETTING_ASK:
28 label = l10n_util::GetStringUTF16(
29 IDS_WEBSITE_SETTINGS_MENU_ITEM_DEFAULT_ASK);
30 break;
31 default:
32 break;
33 }
34 AddCheckItem(COMMAND_SET_TO_DEFAULT, label);
35
36 label = l10n_util::GetStringUTF16(
37 IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW);
38 AddCheckItem(COMMAND_SET_TO_ALLOW, label);
39
40 if (type != CONTENT_SETTINGS_TYPE_FULLSCREEN) {
41 label = l10n_util::GetStringUTF16(
42 IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK);
43 AddCheckItem(COMMAND_SET_TO_BLOCK, label);
44 }
45 }
46
47 bool PermissionMenuModel::IsCommandIdChecked(int command_id) const {
48 if (delegate_)
49 return delegate_->IsCommandIdChecked(command_id);
50 return false;
51 }
52
53 bool PermissionMenuModel::IsCommandIdEnabled(int command_id) const {
54 return true;
55 }
56
57 bool PermissionMenuModel::GetAcceleratorForCommandId(
58 int command_id,
59 ui::Accelerator* accelerator) {
60 // Accelerators are not supported.
61 return false;
62 }
63
64 void PermissionMenuModel::ExecuteCommand(int command_id) {
65 if (delegate_)
66 delegate_->ExecuteCommand(command_id);
67 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/permission_menu_model.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698