| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/page_info/page_info_ui.h" | 5 #include "chrome/browser/ui/page_info/page_info_ui.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 9 #include "chrome/browser/permissions/permission_manager.h" | 9 #include "chrome/browser/permissions/permission_manager.h" |
| 10 #include "chrome/browser/permissions/permission_result.h" | 10 #include "chrome/browser/permissions/permission_result.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 base::string16 PageInfoUI::PermissionTypeToUIString(ContentSettingsType type) { | 242 base::string16 PageInfoUI::PermissionTypeToUIString(ContentSettingsType type) { |
| 243 for (const PermissionsUIInfo& info : kPermissionsUIInfo) { | 243 for (const PermissionsUIInfo& info : kPermissionsUIInfo) { |
| 244 if (info.type == type) | 244 if (info.type == type) |
| 245 return l10n_util::GetStringUTF16(info.string_id); | 245 return l10n_util::GetStringUTF16(info.string_id); |
| 246 } | 246 } |
| 247 NOTREACHED(); | 247 NOTREACHED(); |
| 248 return base::string16(); | 248 return base::string16(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 // static | 251 // static |
| 252 base::string16 PageInfoUI::PermissionValueToUIString(ContentSetting value) { | |
| 253 switch (value) { | |
| 254 case CONTENT_SETTING_ALLOW: | |
| 255 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_ALLOW); | |
| 256 case CONTENT_SETTING_BLOCK: | |
| 257 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_BLOCK); | |
| 258 case CONTENT_SETTING_ASK: | |
| 259 return l10n_util::GetStringUTF16(IDS_PAGE_INFO_PERMISSION_ASK); | |
| 260 default: | |
| 261 NOTREACHED(); | |
| 262 return base::string16(); | |
| 263 } | |
| 264 } | |
| 265 | |
| 266 // static | |
| 267 base::string16 PageInfoUI::PermissionActionToUIString( | 252 base::string16 PageInfoUI::PermissionActionToUIString( |
| 268 Profile* profile, | 253 Profile* profile, |
| 269 ContentSettingsType type, | 254 ContentSettingsType type, |
| 270 ContentSetting setting, | 255 ContentSetting setting, |
| 271 ContentSetting default_setting, | 256 ContentSetting default_setting, |
| 272 content_settings::SettingSource source) { | 257 content_settings::SettingSource source) { |
| 273 ContentSetting effective_setting = | 258 ContentSetting effective_setting = |
| 274 GetEffectiveSetting(profile, type, setting, default_setting); | 259 GetEffectiveSetting(profile, type, setting, default_setting); |
| 275 const int* button_text_ids = NULL; | 260 const int* button_text_ids = NULL; |
| 276 switch (source) { | 261 switch (source) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 } | 426 } |
| 442 return resource_id; | 427 return resource_id; |
| 443 } | 428 } |
| 444 | 429 |
| 445 // static | 430 // static |
| 446 const gfx::Image& PageInfoUI::GetConnectionIcon( | 431 const gfx::Image& PageInfoUI::GetConnectionIcon( |
| 447 PageInfo::SiteConnectionStatus status) { | 432 PageInfo::SiteConnectionStatus status) { |
| 448 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 433 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 449 return rb.GetNativeImageNamed(GetConnectionIconID(status)); | 434 return rb.GetNativeImageNamed(GetConnectionIconID(status)); |
| 450 } | 435 } |
| OLD | NEW |