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/content_settings/content_settings_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 int type, | 556 int type, |
557 const NotificationSource& source, | 557 const NotificationSource& source, |
558 const NotificationDetails& details) { | 558 const NotificationDetails& details) { |
559 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 559 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
560 | 560 |
561 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 561 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
562 DCHECK_EQ(prefs_, Source<PrefService>(source).ptr()); | 562 DCHECK_EQ(prefs_, Source<PrefService>(source).ptr()); |
563 if (updating_preferences_) | 563 if (updating_preferences_) |
564 return; | 564 return; |
565 | 565 |
566 AutoReset<bool> auto_reset(&updating_preferences_, true); | 566 if (!is_incognito_) { |
567 std::string* name = Details<std::string>(details).ptr(); | 567 AutoReset<bool> auto_reset(&updating_preferences_, true); |
568 if (*name == prefs::kContentSettingsPatternPairs) { | 568 std::string* name = Details<std::string>(details).ptr(); |
569 SyncObsoletePatternPref(); | 569 if (*name == prefs::kContentSettingsPatternPairs) { |
570 SyncObsoleteGeolocationPref(); | 570 SyncObsoletePatternPref(); |
571 } else if (*name == prefs::kContentSettingsPatterns) { | 571 SyncObsoleteGeolocationPref(); |
572 MigrateObsoleteContentSettingsPatternPref(); | 572 } else if (*name == prefs::kContentSettingsPatterns) { |
573 } else if (*name == prefs::kGeolocationContentSettings) { | 573 MigrateObsoleteContentSettingsPatternPref(); |
574 MigrateObsoleteGeolocationPref(); | 574 } else if (*name == prefs::kGeolocationContentSettings) { |
575 } else { | 575 MigrateObsoleteGeolocationPref(); |
576 NOTREACHED() << "Unexpected preference observed"; | 576 } else { |
577 return; | 577 NOTREACHED() << "Unexpected preference observed"; |
| 578 return; |
| 579 } |
578 } | 580 } |
579 ReadContentSettingsFromPref(true); | 581 ReadContentSettingsFromPref(true); |
580 | 582 |
581 NotifyObservers(ContentSettingsPattern(), | 583 NotifyObservers(ContentSettingsPattern(), |
582 ContentSettingsPattern(), | 584 ContentSettingsPattern(), |
583 CONTENT_SETTINGS_TYPE_DEFAULT, | 585 CONTENT_SETTINGS_TYPE_DEFAULT, |
584 std::string()); | 586 std::string()); |
585 } else { | 587 } else { |
586 NOTREACHED() << "Unexpected notification"; | 588 NOTREACHED() << "Unexpected notification"; |
587 } | 589 } |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value); | 1233 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value); |
1232 | 1234 |
1233 UpdateObsoleteGeolocationPref(pattern_pair.first, | 1235 UpdateObsoleteGeolocationPref(pattern_pair.first, |
1234 pattern_pair.second, | 1236 pattern_pair.second, |
1235 ContentSetting(setting_value)); | 1237 ContentSetting(setting_value)); |
1236 } | 1238 } |
1237 } | 1239 } |
1238 } | 1240 } |
1239 | 1241 |
1240 } // namespace content_settings | 1242 } // namespace content_settings |
OLD | NEW |