| 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/webui/options2/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options2/content_settings_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, | 333 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, |
| 334 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, | 334 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, |
| 335 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, | 335 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, |
| 336 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, | 336 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, |
| 337 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, | 337 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, |
| 338 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, | 338 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, |
| 339 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, | 339 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, |
| 340 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, | 340 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, |
| 341 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, | 341 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, |
| 342 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, "mixed-script"}, | 342 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, "mixed-script"}, |
| 343 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, | |
| 344 {EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC, "pepper-flash-cameramic"}, | 343 {EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC, "pepper-flash-cameramic"}, |
| 345 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, | 344 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, |
| 346 }; | 345 }; |
| 347 | 346 |
| 348 ContentSettingsHandler::ContentSettingsHandler() { | 347 ContentSettingsHandler::ContentSettingsHandler() { |
| 349 } | 348 } |
| 350 | 349 |
| 351 ContentSettingsHandler::~ContentSettingsHandler() { | 350 ContentSettingsHandler::~ContentSettingsHandler() { |
| 352 } | 351 } |
| 353 | 352 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 } | 650 } |
| 652 | 651 |
| 653 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { | 652 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { |
| 654 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 653 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
| 655 type < EX_CONTENT_SETTINGS_NUM_TYPES; ++type) { | 654 type < EX_CONTENT_SETTINGS_NUM_TYPES; ++type) { |
| 656 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE | 655 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
| 657 // is supposed to be set by policy only. Hence there is no user facing UI | 656 // is supposed to be set by policy only. Hence there is no user facing UI |
| 658 // for this content type and we skip it here. | 657 // for this content type and we skip it here. |
| 659 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) | 658 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) |
| 660 continue; | 659 continue; |
| 661 // The RPH settings are retrieved separately. | |
| 662 if (type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) | |
| 663 continue; | |
| 664 UpdateExceptionsViewFromModel(ExContentSettingsType(type)); | 660 UpdateExceptionsViewFromModel(ExContentSettingsType(type)); |
| 665 } | 661 } |
| 666 } | 662 } |
| 667 | 663 |
| 668 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { | 664 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { |
| 669 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 665 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
| 670 type < EX_CONTENT_SETTINGS_NUM_TYPES; ++type) { | 666 type < EX_CONTENT_SETTINGS_NUM_TYPES; ++type) { |
| 671 UpdateOTRExceptionsViewFromModel(ExContentSettingsType(type)); | 667 UpdateOTRExceptionsViewFromModel(ExContentSettingsType(type)); |
| 672 } | 668 } |
| 673 } | 669 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 684 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: | 680 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: |
| 685 UpdateFlashCameraMicExceptionsView(); | 681 UpdateFlashCameraMicExceptionsView(); |
| 686 break; | 682 break; |
| 687 case CONTENT_SETTINGS_TYPE_INTENTS: | 683 case CONTENT_SETTINGS_TYPE_INTENTS: |
| 688 // Don't update intents settings at this point. | 684 // Don't update intents settings at this point. |
| 689 // Turn on when enable_web_intents_tag is enabled. | 685 // Turn on when enable_web_intents_tag is enabled. |
| 690 break; | 686 break; |
| 691 case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT: | 687 case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT: |
| 692 // We don't yet support exceptions for mixed scripting. | 688 // We don't yet support exceptions for mixed scripting. |
| 693 break; | 689 break; |
| 694 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: | |
| 695 break; | |
| 696 case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS: | |
| 697 break; | |
| 698 default: | 690 default: |
| 699 UpdateExceptionsViewFromHostContentSettingsMap( | 691 UpdateExceptionsViewFromHostContentSettingsMap( |
| 700 type.ToContentSettingsType()); | 692 type.ToContentSettingsType()); |
| 701 break; | 693 break; |
| 702 } | 694 } |
| 703 } | 695 } |
| 704 | 696 |
| 705 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel( | 697 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel( |
| 706 const ExContentSettingsType& type) { | 698 const ExContentSettingsType& type) { |
| 707 switch (type) { | 699 switch (type) { |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { | 1324 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { |
| 1333 if (type == kExContentSettingsTypeGroupNames[i].type) | 1325 if (type == kExContentSettingsTypeGroupNames[i].type) |
| 1334 return kExContentSettingsTypeGroupNames[i].name; | 1326 return kExContentSettingsTypeGroupNames[i].name; |
| 1335 } | 1327 } |
| 1336 | 1328 |
| 1337 NOTREACHED(); | 1329 NOTREACHED(); |
| 1338 return std::string(); | 1330 return std::string(); |
| 1339 } | 1331 } |
| 1340 | 1332 |
| 1341 } // namespace options2 | 1333 } // namespace options2 |
| OLD | NEW |