OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.preferences.website; | 5 package org.chromium.chrome.browser.preferences.website; |
6 | 6 |
7 import org.chromium.chrome.R; | 7 import org.chromium.chrome.R; |
8 import org.chromium.chrome.browser.ContentSettingsType; | 8 import org.chromium.chrome.browser.ContentSettingsType; |
9 | 9 |
10 /** | 10 /** |
11 * A class with utility functions that get the appropriate string and icon resou rces for the | 11 * A class with utility functions that get the appropriate string and icon resou rces for the |
12 * Android UI that allows managing content settings. | 12 * Android UI that allows managing content settings. |
13 */ | 13 */ |
14 public class ContentSettingsResources { | 14 public class ContentSettingsResources { |
15 /** | 15 /** |
16 * Returns the resource id of the icon for a content type. | 16 * Returns the resource id of the icon for a content type. |
17 */ | 17 */ |
18 public static int getIcon(int contentType) { | 18 public static int getIcon(int contentType) { |
19 switch (contentType) { | 19 switch (contentType) { |
20 case ContentSettingsType.CONTENT_SETTINGS_TYPE_COOKIES: | 20 case ContentSettingsType.CONTENT_SETTINGS_TYPE_COOKIES: |
21 return R.drawable.permission_cookie; | 21 return R.drawable.permission_cookie; |
22 case ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN: | 22 case ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN: |
23 return R.drawable.permission_fullscreen; | 23 return R.drawable.permission_fullscreen; |
24 case ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOLOCATION: | 24 case ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOLOCATION: |
25 return R.drawable.permission_location; | 25 return R.drawable.permission_location; |
26 case ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT: | 26 case ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT: |
27 return R.drawable.permission_javascript; | 27 return R.drawable.permission_javascript; |
28 case ContentSettingsType.CONTENT_SETTINGS_TYPE_KEYGEN: | |
29 return R.drawable.permission_javascript; | |
28 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | 30 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: |
29 return R.drawable.permission_camera; | 31 return R.drawable.permission_camera; |
30 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | 32 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: |
31 return R.drawable.permission_mic; | 33 return R.drawable.permission_mic; |
32 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 34 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
33 return R.drawable.permission_midi; | 35 return R.drawable.permission_midi; |
34 case ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 36 case ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
35 return R.drawable.permission_push_notification; | 37 return R.drawable.permission_push_notification; |
36 case ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS: | 38 case ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS: |
37 return R.drawable.permission_popups; | 39 return R.drawable.permission_popups; |
(...skipping 11 matching lines...) Expand all Loading... | |
49 public static int getTitle(int contentType) { | 51 public static int getTitle(int contentType) { |
50 switch (contentType) { | 52 switch (contentType) { |
51 case ContentSettingsType.CONTENT_SETTINGS_TYPE_COOKIES: | 53 case ContentSettingsType.CONTENT_SETTINGS_TYPE_COOKIES: |
52 return R.string.cookies_title; | 54 return R.string.cookies_title; |
53 case ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN: | 55 case ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN: |
54 return R.string.website_settings_fullscreen; | 56 return R.string.website_settings_fullscreen; |
55 case ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOLOCATION: | 57 case ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOLOCATION: |
56 return R.string.website_settings_device_location; | 58 return R.string.website_settings_device_location; |
57 case ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT: | 59 case ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT: |
58 return R.string.javascript_permission_title; | 60 return R.string.javascript_permission_title; |
61 case ContentSettingsType.CONTENT_SETTINGS_TYPE_KEYGEN: | |
62 return R.string.keygen_permission_title; | |
Finnur
2015/11/11 10:25:45
This is not required by MIDI, so it should not be
svaldez
2015/11/19 17:50:25
Done.
| |
59 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | 63 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: |
60 return R.string.website_settings_use_camera; | 64 return R.string.website_settings_use_camera; |
61 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | 65 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: |
62 return R.string.website_settings_use_mic; | 66 return R.string.website_settings_use_mic; |
63 case ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 67 case ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
64 return R.string.push_notifications_permission_title; | 68 return R.string.push_notifications_permission_title; |
65 case ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS: | 69 case ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS: |
66 return R.string.popup_permission_title; | 70 return R.string.popup_permission_title; |
67 case ContentSettingsType.CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENT IFIER: | 71 case ContentSettingsType.CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENT IFIER: |
68 return org.chromium.chrome.R.string.protected_content; | 72 return org.chromium.chrome.R.string.protected_content; |
69 default: | 73 default: |
70 return 0; | 74 return 0; |
71 } | 75 } |
72 } | 76 } |
73 | 77 |
74 /** | 78 /** |
75 * Returns the resource id of the title explanation, shown on the Website De tails page for | 79 * Returns the resource id of the title explanation, shown on the Website De tails page for |
76 * a content type. | 80 * a content type. |
77 */ | 81 */ |
78 public static int getExplanation(int contentType) { | 82 public static int getExplanation(int contentType) { |
79 switch (contentType) { | 83 switch (contentType) { |
80 case ContentSettingsType.CONTENT_SETTINGS_TYPE_COOKIES: | 84 case ContentSettingsType.CONTENT_SETTINGS_TYPE_COOKIES: |
81 return R.string.cookies_title; | 85 return R.string.cookies_title; |
82 case ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN: | 86 case ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN: |
83 return R.string.fullscreen_permission_title; | 87 return R.string.fullscreen_permission_title; |
84 case ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOLOCATION: | 88 case ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOLOCATION: |
85 return R.string.geolocation_permission_title; | 89 return R.string.geolocation_permission_title; |
86 case ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT: | 90 case ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT: |
87 return R.string.javascript_permission_title; | 91 return R.string.javascript_permission_title; |
92 case ContentSettingsType.CONTENT_SETTINGS_TYPE_KEYGEN: | |
93 return R.string.keygen_permission_title; | |
88 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | 94 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: |
89 return R.string.camera_permission_title; | 95 return R.string.camera_permission_title; |
90 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | 96 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: |
91 return R.string.mic_permission_title; | 97 return R.string.mic_permission_title; |
92 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 98 case ContentSettingsType.CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
93 return R.string.midi_sysex_permission_title; | 99 return R.string.midi_sysex_permission_title; |
94 case ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 100 case ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
95 return R.string.push_notifications_permission_title; | 101 return R.string.push_notifications_permission_title; |
96 case ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS: | 102 case ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS: |
97 return R.string.popup_permission_title; | 103 return R.string.popup_permission_title; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 } | 236 } |
231 | 237 |
232 /** | 238 /** |
233 * Returns the summary for Cookie content settings when it is allowed | 239 * Returns the summary for Cookie content settings when it is allowed |
234 * except for those from third party sources. | 240 * except for those from third party sources. |
235 */ | 241 */ |
236 public static int getCookieAllowedExceptThirdPartySummary() { | 242 public static int getCookieAllowedExceptThirdPartySummary() { |
237 return R.string.website_settings_category_allowed_except_third_party; | 243 return R.string.website_settings_category_allowed_except_third_party; |
238 } | 244 } |
239 } | 245 } |
OLD | NEW |