Chromium Code Reviews| 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/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 "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #include "content/public/browser/browser_ppapi_host.h" | 9 #include "content/public/browser/browser_ppapi_host.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 int render_frame_id, | 34 int render_frame_id, |
| 35 ppapi::host::ReplyMessageContext reply) { | 35 ppapi::host::ReplyMessageContext reply) { |
| 36 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 36 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 37 reply.params.set_result(0); | 37 reply.params.set_result(0); |
| 38 | 38 |
| 39 content::RenderFrameHost* render_frame_host = | 39 content::RenderFrameHost* render_frame_host = |
| 40 content::RenderFrameHost::FromID(render_process_id, render_frame_id); | 40 content::RenderFrameHost::FromID(render_process_id, render_frame_id); |
| 41 if (!render_frame_host) | 41 if (!render_frame_host) |
| 42 return reply; // RFH destroyed while task was pending. | 42 return reply; // RFH destroyed while task was pending. |
| 43 | 43 |
| 44 // crbug.com/381398, crbug.com/413906 for !USE_ATHENA | 44 #if defined(USE_ASH) |
| 45 #if defined(USE_ASH) && !defined(USE_ATHENA) | |
| 46 base::string16 title; | 45 base::string16 title; |
| 47 base::string16 message; | 46 base::string16 message; |
| 48 | 47 |
| 49 switch (permission) { | 48 switch (permission) { |
| 50 case PP_TALKPERMISSION_SCREENCAST: | 49 case PP_TALKPERMISSION_SCREENCAST: |
| 51 title = l10n_util::GetStringUTF16(IDS_GTALK_SCREEN_SHARE_DIALOG_TITLE); | 50 title = l10n_util::GetStringUTF16(IDS_GTALK_SCREEN_SHARE_DIALOG_TITLE); |
| 52 message = | 51 message = |
| 53 l10n_util::GetStringUTF16(IDS_GTALK_SCREEN_SHARE_DIALOG_MESSAGE); | 52 l10n_util::GetStringUTF16(IDS_GTALK_SCREEN_SHARE_DIALOG_MESSAGE); |
| 54 break; | 53 break; |
| 55 case PP_TALKPERMISSION_REMOTING: | 54 case PP_TALKPERMISSION_REMOTING: |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 74 reply.params.set_result(static_cast<int32_t>( | 73 reply.params.set_result(static_cast<int32_t>( |
| 75 chrome::ShowMessageBox( | 74 chrome::ShowMessageBox( |
| 76 parent, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION) == | 75 parent, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION) == |
| 77 chrome::MESSAGE_BOX_RESULT_YES)); | 76 chrome::MESSAGE_BOX_RESULT_YES)); |
| 78 #else | 77 #else |
| 79 NOTIMPLEMENTED(); | 78 NOTIMPLEMENTED(); |
| 80 #endif | 79 #endif |
| 81 return reply; | 80 return reply; |
| 82 } | 81 } |
| 83 | 82 |
| 84 #if defined(USE_ASH) && defined(OS_CHROMEOS) && !defined(USE_ATHENA) | 83 #if defined(OS_CHROMEOS) |
|
sky
2015/01/15 16:28:34
What about the USE_ASH here and the next two?
pkotwicz
2015/01/15 16:44:10
Am I missing something? Is it possible to compile
| |
| 85 void OnTerminateRemotingEventOnUIThread(const base::Closure& stop_callback) { | 84 void OnTerminateRemotingEventOnUIThread(const base::Closure& stop_callback) { |
| 86 content::BrowserThread::PostTask( | 85 content::BrowserThread::PostTask( |
| 87 content::BrowserThread::IO, FROM_HERE, stop_callback); | 86 content::BrowserThread::IO, FROM_HERE, stop_callback); |
| 88 } | 87 } |
| 89 #endif // defined(USE_ASH) && defined(OS_CHROMEOS) | 88 #endif // defined(USE_ASH) && defined(OS_CHROMEOS) |
| 90 | 89 |
| 91 ppapi::host::ReplyMessageContext StartRemotingOnUIThread( | 90 ppapi::host::ReplyMessageContext StartRemotingOnUIThread( |
| 92 const base::Closure& stop_callback, | 91 const base::Closure& stop_callback, |
| 93 int render_process_id, | 92 int render_process_id, |
| 94 int render_frame_id, | 93 int render_frame_id, |
| 95 ppapi::host::ReplyMessageContext reply) { | 94 ppapi::host::ReplyMessageContext reply) { |
| 96 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 97 content::RenderFrameHost* render_frame_host = | 96 content::RenderFrameHost* render_frame_host = |
| 98 content::RenderFrameHost::FromID(render_process_id, render_frame_id); | 97 content::RenderFrameHost::FromID(render_process_id, render_frame_id); |
| 99 if (!render_frame_host) { | 98 if (!render_frame_host) { |
| 100 reply.params.set_result(PP_ERROR_FAILED); | 99 reply.params.set_result(PP_ERROR_FAILED); |
| 101 return reply; // RFH destroyed while task was pending. | 100 return reply; // RFH destroyed while task was pending. |
| 102 } | 101 } |
| 103 | 102 |
| 104 #if defined(USE_ASH) && defined(OS_CHROMEOS) && !defined(USE_ATHENA) | 103 #if defined(OS_CHROMEOS) |
| 105 base::Closure stop_callback_ui_thread = | 104 base::Closure stop_callback_ui_thread = |
| 106 base::Bind(&OnTerminateRemotingEventOnUIThread, stop_callback); | 105 base::Bind(&OnTerminateRemotingEventOnUIThread, stop_callback); |
| 107 | 106 |
| 108 ash::Shell::GetInstance()->system_tray_notifier()->NotifyScreenShareStart( | 107 ash::Shell::GetInstance()->system_tray_notifier()->NotifyScreenShareStart( |
| 109 stop_callback_ui_thread, base::string16()); | 108 stop_callback_ui_thread, base::string16()); |
| 110 reply.params.set_result(PP_OK); | 109 reply.params.set_result(PP_OK); |
| 111 #else | 110 #else |
| 112 NOTIMPLEMENTED(); | 111 NOTIMPLEMENTED(); |
| 113 reply.params.set_result(PP_ERROR_NOTSUPPORTED); | 112 reply.params.set_result(PP_ERROR_NOTSUPPORTED); |
| 114 #endif | 113 #endif |
| 115 return reply; | 114 return reply; |
| 116 } | 115 } |
| 117 | 116 |
| 118 void StopRemotingOnUIThread() { | 117 void StopRemotingOnUIThread() { |
| 119 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 118 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 120 #if defined(USE_ASH) && defined(OS_CHROMEOS) && !defined(USE_ATHENA) | 119 #if defined(OS_CHROMEOS) |
| 121 if (ash::Shell::GetInstance()) { | 120 if (ash::Shell::GetInstance()) { |
| 122 ash::Shell::GetInstance()->system_tray_notifier()->NotifyScreenShareStop(); | 121 ash::Shell::GetInstance()->system_tray_notifier()->NotifyScreenShareStop(); |
| 123 } | 122 } |
| 124 #else | 123 #else |
| 125 NOTIMPLEMENTED(); | 124 NOTIMPLEMENTED(); |
| 126 #endif | 125 #endif |
| 127 } | 126 } |
| 128 | 127 |
| 129 ppapi::host::ReplyMessageContext StopRemotingOnUIThreadWithResult( | 128 ppapi::host::ReplyMessageContext StopRemotingOnUIThreadWithResult( |
| 130 ppapi::host::ReplyMessageContext reply) { | 129 ppapi::host::ReplyMessageContext reply) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 } | 248 } |
| 250 | 249 |
| 251 void PepperTalkHost::OnStopRemotingCompleted( | 250 void PepperTalkHost::OnStopRemotingCompleted( |
| 252 ppapi::host::ReplyMessageContext reply) { | 251 ppapi::host::ReplyMessageContext reply) { |
| 253 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 252 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 254 remoting_started_ = false; | 253 remoting_started_ = false; |
| 255 host()->SendReply(reply, PpapiPluginMsg_Talk_StopRemotingReply()); | 254 host()->SendReply(reply, PpapiPluginMsg_Talk_StopRemotingReply()); |
| 256 } | 255 } |
| 257 | 256 |
| 258 } // namespace chrome | 257 } // namespace chrome |
| OLD | NEW |