Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: chrome/browser/ui/webui/settings/site_settings_handler.cc

Issue 2509163004: [MD settings] content category policy (Closed)
Patch Set: enum Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 CHECK(args->Get(0, &callback_id)); 390 CHECK(args->Get(0, &callback_id));
391 std::string type; 391 std::string type;
392 CHECK(args->GetString(1, &type)); 392 CHECK(args->GetString(1, &type));
393 393
394 ContentSettingsType content_type = 394 ContentSettingsType content_type =
395 static_cast<ContentSettingsType>(static_cast<int>( 395 static_cast<ContentSettingsType>(static_cast<int>(
396 site_settings::ContentSettingsTypeFromGroupName(type))); 396 site_settings::ContentSettingsTypeFromGroupName(type)));
397 HostContentSettingsMap* map = 397 HostContentSettingsMap* map =
398 HostContentSettingsMapFactory::GetForProfile(profile_); 398 HostContentSettingsMapFactory::GetForProfile(profile_);
399 399
400 std::string setting = content_settings::ContentSettingToString( 400 std::unique_ptr<base::DictionaryValue> category(new base::DictionaryValue);
Dan Beam 2016/11/17 22:33:38 nit: can we just do stack construction instead? i
dschuyler 2016/11/18 02:11:56 Done.
401 map->GetDefaultContentSetting(content_type, nullptr)); 401 site_settings::GetContentCategorySetting(map, content_type, category.get());
402 ResolveJavascriptCallback(*callback_id, base::StringValue(setting)); 402 ResolveJavascriptCallback(*callback_id, *category.get());
tommycli 2016/11/18 00:09:26 I think you will have to update the unit test here
dschuyler 2016/11/18 02:11:56 Thanks Tommy. Done.
403 } 403 }
404 404
405 void SiteSettingsHandler::HandleGetExceptionList(const base::ListValue* args) { 405 void SiteSettingsHandler::HandleGetExceptionList(const base::ListValue* args) {
406 AllowJavascript(); 406 AllowJavascript();
407 407
408 CHECK_EQ(2U, args->GetSize()); 408 CHECK_EQ(2U, args->GetSize());
409 const base::Value* callback_id; 409 const base::Value* callback_id;
410 CHECK(args->Get(0, &callback_id)); 410 CHECK(args->Get(0, &callback_id));
411 std::string type; 411 std::string type;
412 CHECK(args->GetString(1, &type)); 412 CHECK(args->GetString(1, &type));
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 origin = content::kUnreachableWebDataURL; 688 origin = content::kUnreachableWebDataURL;
689 } 689 }
690 690
691 content::HostZoomMap* host_zoom_map; 691 content::HostZoomMap* host_zoom_map;
692 host_zoom_map = content::HostZoomMap::GetDefaultForBrowserContext(profile_); 692 host_zoom_map = content::HostZoomMap::GetDefaultForBrowserContext(profile_);
693 double default_level = host_zoom_map->GetDefaultZoomLevel(); 693 double default_level = host_zoom_map->GetDefaultZoomLevel();
694 host_zoom_map->SetZoomLevelForHost(origin, default_level); 694 host_zoom_map->SetZoomLevelForHost(origin, default_level);
695 } 695 }
696 696
697 } // namespace settings 697 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698