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 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
6 | 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
7 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
9 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_thread.h" | 13 #include "chrome/browser/browser_thread.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 15 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
13 #include "chrome/browser/geolocation/geolocation_provider.h" | 16 #include "chrome/browser/geolocation/geolocation_provider.h" |
14 #include "chrome/browser/google/google_util.h" | 17 #include "chrome/browser/google/google_util.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/renderer_host/render_process_host.h" | 20 #include "chrome/browser/renderer_host/render_process_host.h" |
18 #include "chrome/browser/renderer_host/render_view_host.h" | 21 #include "chrome/browser/renderer_host/render_view_host.h" |
19 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" | 22 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" |
20 #include "chrome/browser/tab_contents/infobar_delegate.h" | 23 #include "chrome/browser/tab_contents/infobar_delegate.h" |
21 #include "chrome/browser/tab_contents/tab_contents.h" | 24 #include "chrome/browser/tab_contents/tab_contents.h" |
22 #include "chrome/browser/tab_contents/tab_util.h" | 25 #include "chrome/browser/tab_contents/tab_util.h" |
23 #include "chrome/browser/ui/browser.h" | |
24 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
25 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
27 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
28 #include "grit/locale_settings.h" | 30 #include "grit/locale_settings.h" |
29 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
30 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
31 | 33 |
32 namespace { | 34 namespace { |
33 | 35 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 414 |
413 ContentSetting content_setting = | 415 ContentSetting content_setting = |
414 profile_->GetGeolocationContentSettingsMap()->GetContentSetting( | 416 profile_->GetGeolocationContentSettingsMap()->GetContentSetting( |
415 requesting_frame, embedder); | 417 requesting_frame, embedder); |
416 if (content_setting == CONTENT_SETTING_BLOCK) { | 418 if (content_setting == CONTENT_SETTING_BLOCK) { |
417 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, | 419 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, |
418 requesting_frame, false); | 420 requesting_frame, false); |
419 } else if (content_setting == CONTENT_SETTING_ALLOW) { | 421 } else if (content_setting == CONTENT_SETTING_ALLOW) { |
420 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, | 422 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, |
421 requesting_frame, true); | 423 requesting_frame, true); |
422 } else { // setting == ask. Prompt the user. | 424 } else { // setting == ask. Prompt the user. |
423 geolocation_infobar_queue_controller_->CreateInfoBarRequest( | 425 geolocation_infobar_queue_controller_->CreateInfoBarRequest( |
424 render_process_id, render_view_id, bridge_id, requesting_frame, | 426 render_process_id, render_view_id, bridge_id, requesting_frame, |
425 embedder); | 427 embedder); |
426 } | 428 } |
427 } | 429 } |
428 | 430 |
429 void GeolocationPermissionContext::CancelGeolocationPermissionRequest( | 431 void GeolocationPermissionContext::CancelGeolocationPermissionRequest( |
430 int render_process_id, int render_view_id, int bridge_id, | 432 int render_process_id, int render_view_id, int bridge_id, |
431 const GURL& requesting_frame) { | 433 const GURL& requesting_frame) { |
432 CancelPendingInfoBarRequest(render_process_id, render_view_id, bridge_id); | 434 CancelPendingInfoBarRequest(render_process_id, render_view_id, bridge_id); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 BrowserThread::UI, FROM_HERE, | 477 BrowserThread::UI, FROM_HERE, |
476 NewRunnableMethod(this, | 478 NewRunnableMethod(this, |
477 &GeolocationPermissionContext::CancelPendingInfoBarRequest, | 479 &GeolocationPermissionContext::CancelPendingInfoBarRequest, |
478 render_process_id, render_view_id, bridge_id)); | 480 render_process_id, render_view_id, bridge_id)); |
479 return; | 481 return; |
480 } | 482 } |
481 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 483 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
482 geolocation_infobar_queue_controller_->CancelInfoBarRequest( | 484 geolocation_infobar_queue_controller_->CancelInfoBarRequest( |
483 render_process_id, render_view_id, bridge_id); | 485 render_process_id, render_view_id, bridge_id); |
484 } | 486 } |
OLD | NEW |