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