| OLD | NEW | 
|---|
| 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 // Implementation of the geolocation content settings map. Styled on | 5 // Implementation of the geolocation content settings map. Styled on | 
| 6 // HostContentSettingsMap however unlike that class, this one does not hold | 6 // HostContentSettingsMap however unlike that class, this one does not hold | 
| 7 // an additional in-memory copy of the settings as it does not need to support | 7 // an additional in-memory copy of the settings as it does not need to support | 
| 8 // thread safe synchronous access to the settings; all geolocation permissions | 8 // thread safe synchronous access to the settings; all geolocation permissions | 
| 9 // are read and written in the UI thread. (If in future this is no longer the | 9 // are read and written in the UI thread. (If in future this is no longer the | 
| 10 // case, refer to http://codereview.chromium.org/1525018 for a previous version | 10 // case, refer to http://codereview.chromium.org/1525018 for a previous version | 
| 11 // with caching. Note that as we must observe the prefs store for settings | 11 // with caching. Note that as we must observe the prefs store for settings | 
| 12 // changes, e.g. coming from the sync engine, the simplest design would be to | 12 // changes, e.g. coming from the sync engine, the simplest design would be to | 
| 13 // always write-through changes straight to the prefs store, and rely on the | 13 // always write-through changes straight to the prefs store, and rely on the | 
| 14 // notification observer to subsequently update any cached copy). | 14 // notification observer to subsequently update any cached copy). | 
| 15 | 15 | 
| 16 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 16 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 
| 17 | 17 | 
|  | 18 #include <string> | 
|  | 19 | 
| 18 #include "base/string_piece.h" | 20 #include "base/string_piece.h" | 
| 19 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" | 
| 20 #include "chrome/browser/browser_thread.h" | 22 #include "chrome/browser/browser_thread.h" | 
| 21 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" | 
| 22 #include "chrome/browser/prefs/scoped_pref_update.h" | 24 #include "chrome/browser/prefs/scoped_pref_update.h" | 
| 23 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" | 
| 24 #include "chrome/common/notification_service.h" |  | 
| 25 #include "chrome/common/notification_type.h" | 26 #include "chrome/common/notification_type.h" | 
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" | 
| 27 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" | 
| 28 #include "net/base/dns_util.h" | 29 #include "net/base/dns_util.h" | 
| 29 #include "net/base/static_cookie_policy.h" | 30 #include "net/base/static_cookie_policy.h" | 
| 30 | 31 | 
| 31 // static | 32 // static | 
| 32 const ContentSetting | 33 const ContentSetting | 
| 33     GeolocationContentSettingsMap::kDefaultSetting = CONTENT_SETTING_ASK; | 34     GeolocationContentSettingsMap::kDefaultSetting = CONTENT_SETTING_ASK; | 
| 34 | 35 | 
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 181     bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting); | 182     bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting); | 
| 182     DCHECK(found); | 183     DCHECK(found); | 
| 183     GURL target_url(target); | 184     GURL target_url(target); | 
| 184     // An empty URL has a special meaning (wildcard), so only accept invalid | 185     // An empty URL has a special meaning (wildcard), so only accept invalid | 
| 185     // URLs if the original version was empty (avoids treating corrupted prefs | 186     // URLs if the original version was empty (avoids treating corrupted prefs | 
| 186     // as the wildcard entry; see http://crbug.com/39685) | 187     // as the wildcard entry; see http://crbug.com/39685) | 
| 187     if (target_url.is_valid() || target.empty()) | 188     if (target_url.is_valid() || target.empty()) | 
| 188       (*one_origin_settings)[target_url] = IntToContentSetting(setting); | 189       (*one_origin_settings)[target_url] = IntToContentSetting(setting); | 
| 189   } | 190   } | 
| 190 } | 191 } | 
| OLD | NEW | 
|---|