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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 410 } |
410 | 411 |
411 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { | 412 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { |
412 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 413 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
413 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 414 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
414 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE | 415 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
415 // is supposed to be set by policy only. Hence there is no user facing UI | 416 // is supposed to be set by policy only. Hence there is no user facing UI |
416 // for this content type and we skip it here. | 417 // for this content type and we skip it here. |
417 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) | 418 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) |
418 continue; | 419 continue; |
| 420 // TODO(koz): Implement fullscreen content settings UI. |
| 421 if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN) |
| 422 continue; |
419 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 423 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
420 } | 424 } |
421 } | 425 } |
422 | 426 |
423 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { | 427 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { |
424 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 428 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
425 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 429 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
426 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 430 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
427 } | 431 } |
428 } | 432 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 792 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
789 } | 793 } |
790 | 794 |
791 HostContentSettingsMap* | 795 HostContentSettingsMap* |
792 ContentSettingsHandler::GetOTRContentSettingsMap() { | 796 ContentSettingsHandler::GetOTRContentSettingsMap() { |
793 Profile* profile = Profile::FromWebUI(web_ui_); | 797 Profile* profile = Profile::FromWebUI(web_ui_); |
794 if (profile->HasOffTheRecordProfile()) | 798 if (profile->HasOffTheRecordProfile()) |
795 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 799 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
796 return NULL; | 800 return NULL; |
797 } | 801 } |
OLD | NEW |