Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chrome_geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/worker_pool.h" | |
| 13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 14 #include "chrome/browser/content_settings/permission_request_id.h" | 15 #include "chrome/browser/content_settings/permission_request_id.h" |
| 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 16 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/extension_system.h" | 18 #include "chrome/browser/extensions/extension_system.h" |
| 18 #include "chrome/browser/extensions/suggest_permission_util.h" | 19 #include "chrome/browser/extensions/suggest_permission_util.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/tab_contents/tab_util.h" | 21 #include "chrome/browser/tab_contents/tab_util.h" |
| 21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 break; | 136 break; |
| 136 default: | 137 default: |
| 137 // setting == ask. Prompt the user. | 138 // setting == ask. Prompt the user. |
| 138 QueueController()->CreateInfoBarRequest( | 139 QueueController()->CreateInfoBarRequest( |
| 139 id, requesting_frame, embedder, base::Bind( | 140 id, requesting_frame, embedder, base::Bind( |
| 140 &ChromeGeolocationPermissionContext::NotifyPermissionSet, | 141 &ChromeGeolocationPermissionContext::NotifyPermissionSet, |
| 141 base::Unretained(this), id, requesting_frame, callback)); | 142 base::Unretained(this), id, requesting_frame, callback)); |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 | 145 |
| 146 void ChromeGeolocationPermissionContext::CreateInfoBarRequest( | |
| 147 const PermissionRequestID& id, | |
| 148 const GURL& requesting_frame, | |
| 149 const GURL& embedder, | |
| 150 base::Callback<void(bool)> callback) { | |
| 151 QueueController()->CreateInfoBarRequest( | |
|
bulach
2013/09/12 09:18:29
nit: wrong indent
acleung1
2013/09/17 00:08:45
Done.
| |
| 152 id, requesting_frame, embedder, base::Bind( | |
| 153 &ChromeGeolocationPermissionContext::NotifyPermissionSet, | |
| 154 base::Unretained(this), id, requesting_frame, callback)); | |
| 155 } | |
| 156 | |
| 145 void ChromeGeolocationPermissionContext::ShutdownOnUIThread() { | 157 void ChromeGeolocationPermissionContext::ShutdownOnUIThread() { |
| 146 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 158 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 147 permission_queue_controller_.reset(); | 159 permission_queue_controller_.reset(); |
| 148 shutting_down_ = true; | 160 shutting_down_ = true; |
| 149 } | 161 } |
| 150 | 162 |
| 151 void ChromeGeolocationPermissionContext::PermissionDecided( | 163 void ChromeGeolocationPermissionContext::PermissionDecided( |
| 152 const PermissionRequestID& id, | 164 const PermissionRequestID& id, |
| 153 const GURL& requesting_frame, | 165 const GURL& requesting_frame, |
| 154 const GURL& embedder, | 166 const GURL& embedder, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 base::Bind( | 212 base::Bind( |
| 201 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, | 213 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, |
| 202 this, id)); | 214 this, id)); |
| 203 return; | 215 return; |
| 204 } | 216 } |
| 205 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 217 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 206 if (shutting_down_) | 218 if (shutting_down_) |
| 207 return; | 219 return; |
| 208 QueueController()->CancelInfoBarRequest(id); | 220 QueueController()->CancelInfoBarRequest(id); |
| 209 } | 221 } |
| OLD | NEW |