| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/settings/site_settings_handler.h" | 5 #include "chrome/browser/ui/webui/settings/site_settings_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 const base::Value* callback_id; | 325 const base::Value* callback_id; |
| 326 CHECK(args->Get(0, &callback_id)); | 326 CHECK(args->Get(0, &callback_id)); |
| 327 std::string type; | 327 std::string type; |
| 328 CHECK(args->GetString(1, &type)); | 328 CHECK(args->GetString(1, &type)); |
| 329 | 329 |
| 330 ContentSettingsType content_type = | 330 ContentSettingsType content_type = |
| 331 static_cast<ContentSettingsType>(static_cast<int>( | 331 static_cast<ContentSettingsType>(static_cast<int>( |
| 332 site_settings::ContentSettingsTypeFromGroupName(type))); | 332 site_settings::ContentSettingsTypeFromGroupName(type))); |
| 333 HostContentSettingsMap* map = | 333 HostContentSettingsMap* map = |
| 334 HostContentSettingsMapFactory::GetForProfile(profile_); | 334 HostContentSettingsMapFactory::GetForProfile(profile_); |
| 335 ContentSetting setting = map->GetDefaultContentSetting(content_type, nullptr); | |
| 336 | 335 |
| 337 // FullScreen is Allow vs. Ask. | 336 std::string setting = content_settings::ContentSettingToString( |
| 338 bool enabled; | 337 map->GetDefaultContentSetting(content_type, nullptr)); |
| 339 if (content_type == CONTENT_SETTINGS_TYPE_FULLSCREEN) | 338 ResolveJavascriptCallback(*callback_id, base::StringValue(setting)); |
| 340 enabled = setting != CONTENT_SETTING_ASK; | |
| 341 else | |
| 342 enabled = setting != CONTENT_SETTING_BLOCK; | |
| 343 | |
| 344 ResolveJavascriptCallback(*callback_id, base::FundamentalValue(enabled)); | |
| 345 } | 339 } |
| 346 | 340 |
| 347 void SiteSettingsHandler::HandleGetExceptionList(const base::ListValue* args) { | 341 void SiteSettingsHandler::HandleGetExceptionList(const base::ListValue* args) { |
| 348 AllowJavascript(); | 342 AllowJavascript(); |
| 349 | 343 |
| 350 CHECK_EQ(2U, args->GetSize()); | 344 CHECK_EQ(2U, args->GetSize()); |
| 351 const base::Value* callback_id; | 345 const base::Value* callback_id; |
| 352 CHECK(args->Get(0, &callback_id)); | 346 CHECK(args->Get(0, &callback_id)); |
| 353 std::string type; | 347 std::string type; |
| 354 CHECK(args->GetString(1, &type)); | 348 CHECK(args->GetString(1, &type)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 std::string pattern_string; | 422 std::string pattern_string; |
| 429 CHECK(args->GetString(1, &pattern_string)); | 423 CHECK(args->GetString(1, &pattern_string)); |
| 430 | 424 |
| 431 ContentSettingsPattern pattern = | 425 ContentSettingsPattern pattern = |
| 432 ContentSettingsPattern::FromString(pattern_string); | 426 ContentSettingsPattern::FromString(pattern_string); |
| 433 ResolveJavascriptCallback( | 427 ResolveJavascriptCallback( |
| 434 *callback_id, base::FundamentalValue(pattern.IsValid())); | 428 *callback_id, base::FundamentalValue(pattern.IsValid())); |
| 435 } | 429 } |
| 436 | 430 |
| 437 } // namespace settings | 431 } // namespace settings |
| OLD | NEW |