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

Side by Side Diff: chrome/browser/host_content_settings_map.cc

Issue 1084005: Add GeolocationContentSettingsMap, a geolocation-specific variant of HostCont... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/host_content_settings_map.h" 5 #include "chrome/browser/host_content_settings_map.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/pref_service.h" 9 #include "chrome/browser/pref_service.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 ContentSettings* settings) { 345 ContentSettings* settings) {
346 for (DictionaryValue::key_iterator i(dictionary->begin_keys()); 346 for (DictionaryValue::key_iterator i(dictionary->begin_keys());
347 i != dictionary->end_keys(); ++i) { 347 i != dictionary->end_keys(); ++i) {
348 std::wstring content_type(*i); 348 std::wstring content_type(*i);
349 int setting = CONTENT_SETTING_DEFAULT; 349 int setting = CONTENT_SETTING_DEFAULT;
350 bool found = dictionary->GetIntegerWithoutPathExpansion(content_type, 350 bool found = dictionary->GetIntegerWithoutPathExpansion(content_type,
351 &setting); 351 &setting);
352 DCHECK(found); 352 DCHECK(found);
353 for (size_t type = 0; type < arraysize(kTypeNames); ++type) { 353 for (size_t type = 0; type < arraysize(kTypeNames); ++type) {
354 if (std::wstring(kTypeNames[type]) == content_type) { 354 if (std::wstring(kTypeNames[type]) == content_type) {
355 settings->settings[type] = static_cast<ContentSetting>(setting); 355 settings->settings[type] = IntToContentSetting(setting);
356 break; 356 break;
357 } 357 }
358 } 358 }
359 } 359 }
360 } 360 }
361 361
362 void HostContentSettingsMap::ForceDefaultsToBeExplicit() { 362 void HostContentSettingsMap::ForceDefaultsToBeExplicit() {
363 DCHECK_EQ(arraysize(kDefaultSettings), 363 DCHECK_EQ(arraysize(kDefaultSettings),
364 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES)); 364 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES));
365 365
(...skipping 11 matching lines...) Expand all
377 return true; 377 return true;
378 } 378 }
379 379
380 void HostContentSettingsMap::NotifyObservers(const std::string& host) { 380 void HostContentSettingsMap::NotifyObservers(const std::string& host) {
381 ContentSettingsDetails details(host); 381 ContentSettingsDetails details(host);
382 NotificationService::current()->Notify( 382 NotificationService::current()->Notify(
383 NotificationType::CONTENT_SETTINGS_CHANGED, 383 NotificationType::CONTENT_SETTINGS_CHANGED,
384 Source<HostContentSettingsMap>(this), 384 Source<HostContentSettingsMap>(this),
385 Details<ContentSettingsDetails>(&details)); 385 Details<ContentSettingsDetails>(&details));
386 } 386 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698