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