OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { | 56 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { |
57 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, | 57 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, |
58 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, | 58 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, |
59 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, | 59 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, |
60 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, | 60 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, |
61 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, | 61 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, |
62 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, | 62 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, |
63 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, | 63 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, |
64 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, | 64 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, |
65 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, | 65 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, |
| 66 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, |
66 }; | 67 }; |
67 COMPILE_ASSERT(arraysize(kContentSettingsTypeGroupNames) == | 68 COMPILE_ASSERT(arraysize(kContentSettingsTypeGroupNames) == |
68 CONTENT_SETTINGS_NUM_TYPES, | 69 CONTENT_SETTINGS_NUM_TYPES, |
69 MISSING_CONTENT_SETTINGS_TYPE); | 70 MISSING_CONTENT_SETTINGS_TYPE); |
70 | 71 |
71 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { | 72 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { |
72 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { | 73 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { |
73 if (name == kContentSettingsTypeGroupNames[i].name) | 74 if (name == kContentSettingsTypeGroupNames[i].name) |
74 return kContentSettingsTypeGroupNames[i].type; | 75 return kContentSettingsTypeGroupNames[i].type; |
75 } | 76 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 403 } |
403 | 404 |
404 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { | 405 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { |
405 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 406 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
406 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 407 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
407 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE | 408 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
408 // is supposed to be set by policy only. Hence there is no user facing UI | 409 // is supposed to be set by policy only. Hence there is no user facing UI |
409 // for this content type and we skip it here. | 410 // for this content type and we skip it here. |
410 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) | 411 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) |
411 continue; | 412 continue; |
| 413 // TODO(koz): Implement fullscreen content settings UI. |
| 414 if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN) |
| 415 continue; |
412 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 416 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
413 } | 417 } |
414 } | 418 } |
415 | 419 |
416 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { | 420 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { |
417 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 421 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
418 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 422 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
419 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 423 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
420 } | 424 } |
421 } | 425 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 785 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
782 } | 786 } |
783 | 787 |
784 HostContentSettingsMap* | 788 HostContentSettingsMap* |
785 ContentSettingsHandler::GetOTRContentSettingsMap() { | 789 ContentSettingsHandler::GetOTRContentSettingsMap() { |
786 Profile* profile = Profile::FromWebUI(web_ui_); | 790 Profile* profile = Profile::FromWebUI(web_ui_); |
787 if (profile->HasOffTheRecordProfile()) | 791 if (profile->HasOffTheRecordProfile()) |
788 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 792 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
789 return NULL; | 793 return NULL; |
790 } | 794 } |
OLD | NEW |