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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 { "notifications_header", IDS_NOTIFICATIONS_HEADER }, | 256 { "notifications_header", IDS_NOTIFICATIONS_HEADER }, |
257 { "notifications_allow", IDS_NOTIFICATIONS_ALLOW_RADIO }, | 257 { "notifications_allow", IDS_NOTIFICATIONS_ALLOW_RADIO }, |
258 { "notifications_ask", IDS_NOTIFICATIONS_ASK_RADIO }, | 258 { "notifications_ask", IDS_NOTIFICATIONS_ASK_RADIO }, |
259 { "notifications_block", IDS_NOTIFICATIONS_BLOCK_RADIO }, | 259 { "notifications_block", IDS_NOTIFICATIONS_BLOCK_RADIO }, |
260 // Intents filter. | 260 // Intents filter. |
261 { "intentsTabLabel", IDS_INTENTS_TAB_LABEL }, | 261 { "intentsTabLabel", IDS_INTENTS_TAB_LABEL }, |
262 { "intentsAllow", IDS_INTENTS_ALLOW_RADIO }, | 262 { "intentsAllow", IDS_INTENTS_ALLOW_RADIO }, |
263 { "intentsAsk", IDS_INTENTS_ASK_RADIO }, | 263 { "intentsAsk", IDS_INTENTS_ASK_RADIO }, |
264 { "intentsBlock", IDS_INTENTS_BLOCK_RADIO }, | 264 { "intentsBlock", IDS_INTENTS_BLOCK_RADIO }, |
265 { "intents_header", IDS_INTENTS_HEADER }, | 265 { "intents_header", IDS_INTENTS_HEADER }, |
266 // Fullscreen filter. | |
267 { "fullscreen_tab_label", IDS_FULLSCREEN_TAB_LABEL }, | |
268 { "fullscreen_header", IDS_FULLSCREEN_HEADER }, | |
266 }; | 269 }; |
267 | 270 |
268 RegisterStrings(localized_strings, resources, arraysize(resources)); | 271 RegisterStrings(localized_strings, resources, arraysize(resources)); |
269 RegisterTitle(localized_strings, "contentSettingsPage", | 272 RegisterTitle(localized_strings, "contentSettingsPage", |
270 IDS_CONTENT_SETTINGS_TITLE); | 273 IDS_CONTENT_SETTINGS_TITLE); |
271 localized_strings->SetBoolean("enable_click_to_play", | 274 localized_strings->SetBoolean("enable_click_to_play", |
272 CommandLine::ForCurrentProcess()->HasSwitch( | 275 CommandLine::ForCurrentProcess()->HasSwitch( |
273 switches::kEnableClickToPlay)); | 276 switches::kEnableClickToPlay)); |
274 localized_strings->SetBoolean("enable_web_intents", | 277 localized_strings->SetBoolean("enable_web_intents", |
275 CommandLine::ForCurrentProcess()->HasSwitch( | 278 CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 } | 409 } |
407 | 410 |
408 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { | 411 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { |
409 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 412 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
410 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 413 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
411 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE | 414 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
412 // is supposed to be set by policy only. Hence there is no user facing UI | 415 // is supposed to be set by policy only. Hence there is no user facing UI |
413 // for this content type and we skip it here. | 416 // for this content type and we skip it here. |
414 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) | 417 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) |
415 continue; | 418 continue; |
416 // TODO(koz): Implement fullscreen content settings UI. | |
417 if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN) | |
418 continue; | |
419 // TODO(scheib): Mouse lock content settings UI. http://crbug.com/97768 | 419 // TODO(scheib): Mouse lock content settings UI. http://crbug.com/97768 |
420 if (type == CONTENT_SETTINGS_TYPE_MOUSELOCK) | 420 if (type == CONTENT_SETTINGS_TYPE_MOUSELOCK) |
421 continue; | 421 continue; |
422 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 422 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
423 } | 423 } |
424 } | 424 } |
425 | 425 |
426 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { | 426 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { |
427 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 427 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
428 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 428 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 << "supported by the content settings UI"; | 582 << "supported by the content settings UI"; |
583 } | 583 } |
584 } | 584 } |
585 | 585 |
586 StringValue type_string(ContentSettingsTypeToGroupName(type)); | 586 StringValue type_string(ContentSettingsTypeToGroupName(type)); |
587 web_ui_->CallJavascriptFunction("ContentSettings.setExceptions", type_string, | 587 web_ui_->CallJavascriptFunction("ContentSettings.setExceptions", type_string, |
588 exceptions); | 588 exceptions); |
589 | 589 |
590 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); | 590 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); |
591 | 591 |
592 // Fullscreen doesn't have enable / disable functionality. | |
Evan Stade
2011/11/18 00:13:58
what is enable disable functionality?
| |
593 if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN) { | |
594 return; | |
595 } | |
596 | |
592 // The default may also have changed (we won't get a separate notification). | 597 // The default may also have changed (we won't get a separate notification). |
593 // If it hasn't changed, this call will be harmless. | 598 // If it hasn't changed, this call will be harmless. |
594 UpdateSettingDefaultFromModel(type); | 599 UpdateSettingDefaultFromModel(type); |
595 } | 600 } |
596 | 601 |
597 void ContentSettingsHandler::UpdateExceptionsViewFromOTRHostContentSettingsMap( | 602 void ContentSettingsHandler::UpdateExceptionsViewFromOTRHostContentSettingsMap( |
598 ContentSettingsType type) { | 603 ContentSettingsType type) { |
599 const HostContentSettingsMap* otr_settings_map = GetOTRContentSettingsMap(); | 604 const HostContentSettingsMap* otr_settings_map = GetOTRContentSettingsMap(); |
600 if (!otr_settings_map) | 605 if (!otr_settings_map) |
601 return; | 606 return; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
806 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 811 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
807 } | 812 } |
808 | 813 |
809 HostContentSettingsMap* | 814 HostContentSettingsMap* |
810 ContentSettingsHandler::GetOTRContentSettingsMap() { | 815 ContentSettingsHandler::GetOTRContentSettingsMap() { |
811 Profile* profile = Profile::FromWebUI(web_ui_); | 816 Profile* profile = Profile::FromWebUI(web_ui_); |
812 if (profile->HasOffTheRecordProfile()) | 817 if (profile->HasOffTheRecordProfile()) |
813 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 818 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
814 return NULL; | 819 return NULL; |
815 } | 820 } |
OLD | NEW |