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

Side by Side Diff: chrome/browser/geolocation/geolocation_content_settings_map.cc

Issue 6597044: Revert 76228 - Move core pieces of geolocation from chrome to content.This is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 // 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> 18 #include <string>
19 19
20 #include "base/string_piece.h" 20 #include "base/string_piece.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "chrome/browser/browser_thread.h"
22 #include "chrome/browser/content_settings/content_settings_details.h" 23 #include "chrome/browser/content_settings/content_settings_details.h"
23 #include "chrome/browser/content_settings/content_settings_pattern.h" 24 #include "chrome/browser/content_settings/content_settings_pattern.h"
24 #include "chrome/browser/prefs/pref_service.h" 25 #include "chrome/browser/prefs/pref_service.h"
25 #include "chrome/browser/prefs/scoped_pref_update.h" 26 #include "chrome/browser/prefs/scoped_pref_update.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/common/notification_service.h" 28 #include "chrome/common/notification_service.h"
28 #include "chrome/common/notification_source.h" 29 #include "chrome/common/notification_source.h"
29 #include "chrome/common/notification_type.h" 30 #include "chrome/common/notification_type.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
32 #include "content/browser/browser_thread.h"
33 #include "net/base/dns_util.h" 33 #include "net/base/dns_util.h"
34 #include "net/base/static_cookie_policy.h" 34 #include "net/base/static_cookie_policy.h"
35 35
36 // static 36 // static
37 const ContentSetting 37 const ContentSetting
38 GeolocationContentSettingsMap::kDefaultSetting = CONTENT_SETTING_ASK; 38 GeolocationContentSettingsMap::kDefaultSetting = CONTENT_SETTING_ASK;
39 39
40 GeolocationContentSettingsMap::GeolocationContentSettingsMap(Profile* profile) 40 GeolocationContentSettingsMap::GeolocationContentSettingsMap(Profile* profile)
41 : profile_(profile) { 41 : profile_(profile) {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting); 248 bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting);
249 DCHECK(found); 249 DCHECK(found);
250 GURL target_url(target); 250 GURL target_url(target);
251 // An empty URL has a special meaning (wildcard), so only accept invalid 251 // An empty URL has a special meaning (wildcard), so only accept invalid
252 // URLs if the original version was empty (avoids treating corrupted prefs 252 // URLs if the original version was empty (avoids treating corrupted prefs
253 // as the wildcard entry; see http://crbug.com/39685) 253 // as the wildcard entry; see http://crbug.com/39685)
254 if (target_url.is_valid() || target.empty()) 254 if (target_url.is_valid() || target.empty())
255 (*one_origin_settings)[target_url] = IntToContentSetting(setting); 255 (*one_origin_settings)[target_url] = IntToContentSetting(setting);
256 } 256 }
257 } 257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698