Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: content/browser/renderer_host/media/midi_dispatcher_host.cc

Issue 335993002: Convert MIDI permission requests to use WebContents in preparation for switching the code to using … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/midi_dispatcher_host.cc
diff --git a/content/browser/renderer_host/media/midi_dispatcher_host.cc b/content/browser/renderer_host/media/midi_dispatcher_host.cc
deleted file mode 100644
index 0f760b6792885a04a66f33ec19cdf1af780b2dca..0000000000000000000000000000000000000000
--- a/content/browser/renderer_host/media/midi_dispatcher_host.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/browser/renderer_host/media/midi_dispatcher_host.h"
-
-#include "base/bind.h"
-#include "content/browser/child_process_security_policy_impl.h"
-#include "content/browser/renderer_host/render_view_host_impl.h"
-#include "content/common/media/midi_messages.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/browser_thread.h"
-#include "url/gurl.h"
-
-namespace content {
-
-MidiDispatcherHost::MidiDispatcherHost(int render_process_id,
- BrowserContext* browser_context)
- : BrowserMessageFilter(MidiMsgStart),
- render_process_id_(render_process_id),
- browser_context_(browser_context) {
-}
-
-MidiDispatcherHost::~MidiDispatcherHost() {
-}
-
-bool MidiDispatcherHost::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(MidiDispatcherHost, message)
- IPC_MESSAGE_HANDLER(MidiHostMsg_RequestSysExPermission,
- OnRequestSysExPermission)
- IPC_MESSAGE_HANDLER(MidiHostMsg_CancelSysExPermissionRequest,
- OnCancelSysExPermissionRequest)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void MidiDispatcherHost::OverrideThreadForMessage(
- const IPC::Message& message, BrowserThread::ID* thread) {
- if (IPC_MESSAGE_CLASS(message) == MidiMsgStart)
- *thread = BrowserThread::UI;
-}
-
-void MidiDispatcherHost::OnRequestSysExPermission(int render_view_id,
- int bridge_id,
- const GURL& origin,
- bool user_gesture) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- browser_context_->RequestMidiSysExPermission(
- render_process_id_,
- render_view_id,
- bridge_id,
- origin,
- user_gesture,
- base::Bind(&MidiDispatcherHost::WasSysExPermissionGranted,
- base::Unretained(this),
- render_view_id,
- bridge_id));
-}
-
-void MidiDispatcherHost::OnCancelSysExPermissionRequest(
- int render_view_id,
- int bridge_id,
- const GURL& requesting_frame) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" << render_view_id
- << ":" << bridge_id;
- browser_context_->CancelMidiSysExPermissionRequest(
- render_process_id_, render_view_id, bridge_id, requesting_frame);
-}
-void MidiDispatcherHost::WasSysExPermissionGranted(int render_view_id,
- int bridge_id,
- bool is_allowed) {
- if (is_allowed)
- ChildProcessSecurityPolicyImpl::GetInstance()->GrantSendMidiSysExMessage(
- render_process_id_);
- Send(new MidiMsg_SysExPermissionApproved(
- render_view_id, bridge_id, is_allowed));
-}
-
-} // namespace content
« no previous file with comments | « content/browser/renderer_host/media/midi_dispatcher_host.h ('k') | content/browser/renderer_host/media/midi_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698