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

Side by Side Diff: chrome/browser/renderer_host/pepper/pepper_talk_host.cc

Issue 16271005: Implement pepper interface and plumbing for HRD's UI on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor feedback related changes. Created 7 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 unified diff | Download patch
OLDNEW
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/renderer_host/pepper/pepper_talk_host.h" 5 #include "chrome/browser/renderer_host/pepper/pepper_talk_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/public/browser/browser_ppapi_host.h" 8 #include "content/public/browser/browser_ppapi_host.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
11 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
12 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
13 #include "ppapi/host/dispatch_host_message.h"
13 #include "ppapi/host/host_message_context.h" 14 #include "ppapi/host/host_message_context.h"
14 #include "ppapi/host/ppapi_host.h" 15 #include "ppapi/host/ppapi_host.h"
15 #include "ppapi/proxy/ppapi_messages.h" 16 #include "ppapi/proxy/ppapi_messages.h"
16 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
17 18
18 #if defined(USE_ASH) 19 #if defined(USE_ASH)
19 #include "ash/shell.h" 20 #include "ash/shell.h"
20 #include "ash/shell_window_ids.h" 21 #include "ash/shell_window_ids.h"
21 #include "chrome/browser/ui/simple_message_box.h" 22 #include "chrome/browser/ui/simple_message_box.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 weak_factory_(this), 69 weak_factory_(this),
69 browser_ppapi_host_(host) { 70 browser_ppapi_host_(host) {
70 } 71 }
71 72
72 PepperTalkHost::~PepperTalkHost() { 73 PepperTalkHost::~PepperTalkHost() {
73 } 74 }
74 75
75 int32_t PepperTalkHost::OnResourceMessageReceived( 76 int32_t PepperTalkHost::OnResourceMessageReceived(
76 const IPC::Message& msg, 77 const IPC::Message& msg,
77 ppapi::host::HostMessageContext* context) { 78 ppapi::host::HostMessageContext* context) {
78 // We only have one message with no parameters. 79 IPC_BEGIN_MESSAGE_MAP(PepperTalkHost, msg)
79 if (msg.type() != PpapiHostMsg_Talk_GetPermission::ID) 80 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Talk_RequestPermission,
80 return 0; 81 OnRequestPermission)
82 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Talk_StartRemoting,
83 OnStartRemoting)
84 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Talk_StopRemoting,
85 OnStopRemoting)
86 IPC_END_MESSAGE_MAP()
87 return PP_ERROR_FAILED;
88 }
89
90 int32_t PepperTalkHost::OnRequestPermission(
91 ppapi::host::HostMessageContext* context,
92 PP_TalkPermission permission) {
93 // TODO(dcaiafa): Implement support for other permission types.
94 if (permission != PP_TALKPERMISSION_SCREENCAST)
95 return PP_ERROR_BADARGUMENT;
81 96
82 int render_process_id = 0; 97 int render_process_id = 0;
83 int render_view_id = 0; 98 int render_view_id = 0;
84 browser_ppapi_host_->GetRenderViewIDsForInstance( 99 browser_ppapi_host_->GetRenderViewIDsForInstance(
85 pp_instance(), &render_process_id, &render_view_id); 100 pp_instance(), &render_process_id, &render_view_id);
86 101
87 content::BrowserThread::PostTaskAndReplyWithResult( 102 content::BrowserThread::PostTaskAndReplyWithResult(
88 content::BrowserThread::UI, FROM_HERE, 103 content::BrowserThread::UI, FROM_HERE,
89 base::Bind(&GetPermissionOnUIThread, render_process_id, render_view_id, 104 base::Bind(&GetPermissionOnUIThread, render_process_id, render_view_id,
90 context->MakeReplyMessageContext()), 105 context->MakeReplyMessageContext()),
91 base::Bind(&PepperTalkHost::GotTalkPermission, 106 base::Bind(&PepperTalkHost::GotTalkPermission,
92 weak_factory_.GetWeakPtr())); 107 weak_factory_.GetWeakPtr()));
93 return PP_OK_COMPLETIONPENDING; 108 return PP_OK_COMPLETIONPENDING;
94 } 109 }
95 110
96 void PepperTalkHost::GotTalkPermission( 111 void PepperTalkHost::GotTalkPermission(
97 ppapi::host::ReplyMessageContext reply) { 112 ppapi::host::ReplyMessageContext reply) {
98 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 113 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
99 host()->SendReply(reply, PpapiPluginMsg_Talk_GetPermissionReply()); 114 host()->SendReply(reply, PpapiPluginMsg_Talk_RequestPermissionReply());
115 }
116
117 int32_t PepperTalkHost::OnStartRemoting(
118 ppapi::host::HostMessageContext* context) {
119 // TODO(dcaiafa): Implement StartRemoting
120 NOTIMPLEMENTED();
Cris Neckar 2013/06/06 17:44:08 Please request another IPC audit once these are im
dcaiafa 2013/06/06 18:23:32 Done.
121 return PP_ERROR_FAILED;
122 }
123
124 int32_t PepperTalkHost::OnStopRemoting(
125 ppapi::host::HostMessageContext* context) {
126 // TODO(dcaiafa): Implement StopRemoting
127 NOTIMPLEMENTED();
Cris Neckar 2013/06/06 17:44:08 Ditto
dcaiafa 2013/06/06 18:23:32 Done.
128 return PP_ERROR_FAILED;
100 } 129 }
101 130
102 } // namespace chrome 131 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698