OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/geolocation/geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "components/content_settings/core/common/permission_request_id.h" | 10 #include "components/content_settings/core/common/permission_request_id.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 bool user_gesture, | 29 bool user_gesture, |
30 const BrowserPermissionCallback& callback) { | 30 const BrowserPermissionCallback& callback) { |
31 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 31 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
32 | 32 |
33 bool permission_set; | 33 bool permission_set; |
34 bool new_permission; | 34 bool new_permission; |
35 if (extensions_context_.RequestPermission( | 35 if (extensions_context_.RequestPermission( |
36 web_contents, id, id.bridge_id(), requesting_frame_origin, user_gesture, | 36 web_contents, id, id.bridge_id(), requesting_frame_origin, user_gesture, |
37 callback, &permission_set, &new_permission)) { | 37 callback, &permission_set, &new_permission)) { |
38 if (permission_set) { | 38 if (permission_set) { |
| 39 ContentSetting content_setting = |
| 40 new_permission ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
39 NotifyPermissionSet(id, | 41 NotifyPermissionSet(id, |
40 requesting_frame_origin, | 42 requesting_frame_origin, |
41 web_contents->GetLastCommittedURL().GetOrigin(), | 43 web_contents->GetLastCommittedURL().GetOrigin(), |
42 callback, | 44 callback, |
43 true, | 45 true, |
44 new_permission); | 46 content_setting); |
45 } | 47 } |
46 return; | 48 return; |
47 } | 49 } |
48 | 50 |
49 PermissionContextBase::RequestPermission(web_contents, id, | 51 PermissionContextBase::RequestPermission(web_contents, id, |
50 requesting_frame_origin, | 52 requesting_frame_origin, |
51 user_gesture, | 53 user_gesture, |
52 callback); | 54 callback); |
53 } | 55 } |
54 | 56 |
(...skipping 17 matching lines...) Expand all Loading... |
72 id.render_view_id()); | 74 id.render_view_id()); |
73 if (content_settings) | 75 if (content_settings) |
74 content_settings->OnGeolocationPermissionSet( | 76 content_settings->OnGeolocationPermissionSet( |
75 requesting_frame.GetOrigin(), allowed); | 77 requesting_frame.GetOrigin(), allowed); |
76 | 78 |
77 if (allowed) { | 79 if (allowed) { |
78 content::GeolocationProvider::GetInstance() | 80 content::GeolocationProvider::GetInstance() |
79 ->UserDidOptIntoLocationServices(); | 81 ->UserDidOptIntoLocationServices(); |
80 } | 82 } |
81 } | 83 } |
OLD | NEW |