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 "base/string_piece.h" | 18 #include "base/string_piece.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/chrome_thread.h" | 20 #include "chrome/browser/chrome_thread.h" |
21 #include "chrome/browser/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/prefs/scoped_pref_update.h" |
22 #include "chrome/browser/profile.h" | 23 #include "chrome/browser/profile.h" |
23 #include "chrome/browser/scoped_pref_update.h" | |
24 #include "chrome/common/notification_service.h" | 24 #include "chrome/common/notification_service.h" |
25 #include "chrome/common/notification_type.h" | 25 #include "chrome/common/notification_type.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
28 #include "net/base/dns_util.h" | 28 #include "net/base/dns_util.h" |
29 #include "net/base/static_cookie_policy.h" | 29 #include "net/base/static_cookie_policy.h" |
30 | 30 |
31 // static | 31 // static |
32 const ContentSetting | 32 const ContentSetting |
33 GeolocationContentSettingsMap::kDefaultSetting = CONTENT_SETTING_ASK; | 33 GeolocationContentSettingsMap::kDefaultSetting = CONTENT_SETTING_ASK; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting); | 181 bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting); |
182 DCHECK(found); | 182 DCHECK(found); |
183 GURL target_url(target); | 183 GURL target_url(target); |
184 // An empty URL has a special meaning (wildcard), so only accept invalid | 184 // An empty URL has a special meaning (wildcard), so only accept invalid |
185 // URLs if the original version was empty (avoids treating corrupted prefs | 185 // URLs if the original version was empty (avoids treating corrupted prefs |
186 // as the wildcard entry; see http://crbug.com/39685) | 186 // as the wildcard entry; see http://crbug.com/39685) |
187 if (target_url.is_valid() || target.empty()) | 187 if (target_url.is_valid() || target.empty()) |
188 (*one_origin_settings)[target_url] = IntToContentSetting(setting); | 188 (*one_origin_settings)[target_url] = IntToContentSetting(setting); |
189 } | 189 } |
190 } | 190 } |
OLD | NEW |