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

Side by Side Diff: components/content_settings/core/browser/content_settings_pref.cc

Issue 1442083002: Stop inheriting push notification permissions from regular to incognito (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/content_settings/core/browser/content_settings_pref.h" 5 #include "components/content_settings/core/browser/content_settings_pref.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 bool ContentSettingsPref::TryLockForTesting() const { 239 bool ContentSettingsPref::TryLockForTesting() const {
240 if (!lock_.Try()) 240 if (!lock_.Try())
241 return false; 241 return false;
242 lock_.Release(); 242 lock_.Release();
243 return true; 243 return true;
244 } 244 }
245 245
246 void ContentSettingsPref::ReadContentSettingsFromPref() { 246 void ContentSettingsPref::ReadContentSettingsFromPref() {
247 // Unlike other permissions, the Notifications and Push Messaging permissions
248 // aren't inherited from regular to incognito. Their value_map_ is left empty.
msramek 2015/11/16 12:40:45 Even if we currently don't have plans to do this f
Peter Beverloo 2015/11/16 17:14:32 +1, although I think we may as well do it as part
raymes 2015/11/17 00:16:00 Oops, sorry I missed this CL. Yes, it would be bet
msramek 2015/11/17 10:37:55 Just FYI, if you need to need to merge it or have
johnme 2015/11/26 17:31:54 Done - I added WebsiteSettingsInfo::IncognitoBehav
raymes 2015/11/30 00:28:46 I think it would be better to either patch the def
johnme 2015/11/30 14:56:58 I've moved the new logic to a helper function in H
249 if (is_incognito_ && (content_type_ == CONTENT_SETTINGS_TYPE_NOTIFICATIONS ||
250 content_type_ == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING))
251 return;
252
247 // |DictionaryPrefUpdate| sends out notifications when destructed. This 253 // |DictionaryPrefUpdate| sends out notifications when destructed. This
248 // construction order ensures |AutoLock| gets destroyed first and |lock_| is 254 // construction order ensures |AutoLock| gets destroyed first and |lock_| is
249 // not held when the notifications are sent. Also, |auto_reset| must be still 255 // not held when the notifications are sent. Also, |auto_reset| must be still
250 // valid when the notifications are sent, so that |Observe| skips the 256 // valid when the notifications are sent, so that |Observe| skips the
251 // notification. 257 // notification.
252 base::AutoReset<bool> auto_reset(&updating_preferences_, true); 258 base::AutoReset<bool> auto_reset(&updating_preferences_, true);
253 DictionaryPrefUpdate update(prefs_, pref_name_); 259 DictionaryPrefUpdate update(prefs_, pref_name_);
254 base::AutoLock auto_lock(lock_); 260 base::AutoLock auto_lock(lock_);
255 261
256 const base::DictionaryValue* all_settings_dictionary = 262 const base::DictionaryValue* all_settings_dictionary =
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 509
504 void ContentSettingsPref::AssertLockNotHeld() const { 510 void ContentSettingsPref::AssertLockNotHeld() const {
505 #if !defined(NDEBUG) 511 #if !defined(NDEBUG)
506 // |Lock::Acquire()| will assert if the lock is held by this thread. 512 // |Lock::Acquire()| will assert if the lock is held by this thread.
507 lock_.Acquire(); 513 lock_.Acquire();
508 lock_.Release(); 514 lock_.Release();
509 #endif 515 #endif
510 } 516 }
511 517
512 } // namespace content_settings 518 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698