OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/media/chrome_midi_permission_context.h" | 5 #include "chrome/browser/media/chrome_midi_permission_context.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/browser/content_settings/permission_queue_controller.h" | 9 #include "chrome/browser/content_settings/permission_queue_controller.h" |
10 #include "chrome/browser/content_settings/permission_request_id.h" | 10 #include "chrome/browser/content_settings/permission_request_id.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 content::WebContents* web_contents = | 46 content::WebContents* web_contents = |
47 tab_util::GetWebContentsByID(render_process_id, render_view_id); | 47 tab_util::GetWebContentsByID(render_process_id, render_view_id); |
48 | 48 |
49 // The page doesn't exist any more. | 49 // The page doesn't exist any more. |
50 if (!web_contents) | 50 if (!web_contents) |
51 return; | 51 return; |
52 | 52 |
53 const PermissionRequestID id(render_process_id, render_view_id, bridge_id); | 53 const PermissionRequestID id(render_process_id, render_view_id, bridge_id); |
54 | 54 |
55 GURL embedder = web_contents->GetURL(); | 55 GURL embedder = web_contents->GetURL(); |
56 if (!requesting_frame.is_valid() || !embedder.is_valid()) { | 56 // |requesting_frame| can be empty and invalid when the frame is a local |
| 57 // file. Here local files should be granted to show an infobar. |
| 58 // Any user's action will not be stored to content settings data base. |
| 59 if ((!requesting_frame.is_valid() && !requesting_frame.is_empty()) || |
| 60 !embedder.is_valid()) { |
57 LOG(WARNING) << "Attempt to use MIDI sysex from an invalid URL: " | 61 LOG(WARNING) << "Attempt to use MIDI sysex from an invalid URL: " |
58 << requesting_frame << "," << embedder | 62 << requesting_frame << "," << embedder |
59 << " (Web MIDI is not supported in popups)"; | 63 << " (Web MIDI is not supported in popups)"; |
60 PermissionDecided(id, requesting_frame, embedder, callback, false); | 64 PermissionDecided(id, requesting_frame, embedder, callback, false); |
61 return; | 65 return; |
62 } | 66 } |
63 | 67 |
64 DecidePermission(id, requesting_frame, embedder, callback); | 68 DecidePermission(id, requesting_frame, embedder, callback); |
65 } | 69 } |
66 | 70 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return permission_queue_controller_.get(); | 144 return permission_queue_controller_.get(); |
141 } | 145 } |
142 | 146 |
143 void ChromeMIDIPermissionContext::CancelPendingInfoBarRequest( | 147 void ChromeMIDIPermissionContext::CancelPendingInfoBarRequest( |
144 const PermissionRequestID& id) { | 148 const PermissionRequestID& id) { |
145 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 149 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
146 if (shutting_down_) | 150 if (shutting_down_) |
147 return; | 151 return; |
148 GetQueueController()->CancelInfoBarRequest(id); | 152 GetQueueController()->CancelInfoBarRequest(id); |
149 } | 153 } |
OLD | NEW |