| 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/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/google/google_util.h" | 16 #include "chrome/browser/google/google_util.h" |
| 17 #include "chrome/browser/infobars/infobar.h" | 17 #include "chrome/browser/infobars/infobar.h" |
| 18 #include "chrome/browser/infobars/infobar_tab_helper.h" | 18 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 19 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 21 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 22 #include "chrome/browser/tab_contents/tab_util.h" | 22 #include "chrome/browser/tab_contents/tab_util.h" |
| 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "chrome/common/chrome_view_type.h" |
| 25 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/browser/navigation_details.h" | 29 #include "content/public/browser/navigation_details.h" |
| 29 #include "content/public/browser/navigation_entry.h" | 30 #include "content/public/browser/navigation_entry.h" |
| 30 #include "content/public/browser/notification_details.h" | 31 #include "content/public/browser/notification_details.h" |
| 31 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
| 32 #include "content/public/browser/notification_source.h" | 33 #include "content/public/browser/notification_source.h" |
| 33 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
| 34 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, | 618 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, |
| 618 requesting_frame, callback, true); | 619 requesting_frame, callback, true); |
| 619 return; | 620 return; |
| 620 } | 621 } |
| 621 } | 622 } |
| 622 } | 623 } |
| 623 | 624 |
| 624 WebContents* web_contents = | 625 WebContents* web_contents = |
| 625 tab_util::GetWebContentsByID(render_process_id, render_view_id); | 626 tab_util::GetWebContentsByID(render_process_id, render_view_id); |
| 626 if (!web_contents || web_contents->GetViewType() != | 627 if (!web_contents || web_contents->GetViewType() != |
| 627 content::VIEW_TYPE_WEB_CONTENTS) { | 628 chrome::VIEW_TYPE_TAB_CONTENTS) { |
| 628 // The tab may have gone away, or the request may not be from a tab at all. | 629 // The tab may have gone away, or the request may not be from a tab at all. |
| 629 // TODO(mpcomplete): the request could be from a background page or | 630 // TODO(mpcomplete): the request could be from a background page or |
| 630 // extension popup (tab_contents will have a different ViewType). But why do | 631 // extension popup (tab_contents will have a different ViewType). But why do |
| 631 // we care? Shouldn't we still put an infobar up in the current tab? | 632 // we care? Shouldn't we still put an infobar up in the current tab? |
| 632 LOG(WARNING) << "Attempt to use geolocation tabless renderer: " | 633 LOG(WARNING) << "Attempt to use geolocation tabless renderer: " |
| 633 << render_process_id << "," << render_view_id << "," | 634 << render_process_id << "," << render_view_id << "," |
| 634 << bridge_id << " (can't prompt user without a visible tab)"; | 635 << bridge_id << " (can't prompt user without a visible tab)"; |
| 635 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, | 636 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, |
| 636 requesting_frame, callback, false); | 637 requesting_frame, callback, false); |
| 637 return; | 638 return; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 BrowserThread::UI, FROM_HERE, | 704 BrowserThread::UI, FROM_HERE, |
| 704 base::Bind( | 705 base::Bind( |
| 705 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, | 706 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, |
| 706 this, render_process_id, render_view_id, bridge_id)); | 707 this, render_process_id, render_view_id, bridge_id)); |
| 707 return; | 708 return; |
| 708 } | 709 } |
| 709 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 710 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 710 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, | 711 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, |
| 711 render_view_id, bridge_id); | 712 render_view_id, bridge_id); |
| 712 } | 713 } |
| OLD | NEW |