| 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/extensions/api/terminal/terminal_private_api.h" | 5 #include "chrome/browser/extensions/api/terminal/terminal_private_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/process_proxy/process_proxy_registry.h" | 10 #include "chrome/browser/chromeos/process_proxy/process_proxy_registry.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 205 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 206 base::Bind(&CloseTerminalProcessFunction::RespondOnUIThread, this, | 206 base::Bind(&CloseTerminalProcessFunction::RespondOnUIThread, this, |
| 207 success)); | 207 success)); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void CloseTerminalProcessFunction::RespondOnUIThread(bool success) { | 210 void CloseTerminalProcessFunction::RespondOnUIThread(bool success) { |
| 211 result_.reset(new base::FundamentalValue(success)); | 211 result_.reset(new base::FundamentalValue(success)); |
| 212 SendResponse(true); | 212 SendResponse(true); |
| 213 } | 213 } |
| 214 |
| 215 bool OnTerminalResizeFunction::RunTerminalFunction() { |
| 216 if (args_->GetSize() != 3) |
| 217 return false; |
| 218 |
| 219 pid_t pid; |
| 220 if (!args_->GetInteger(0, &pid)) |
| 221 return false; |
| 222 |
| 223 int width; |
| 224 if (!args_->GetInteger(1, &width)) |
| 225 return false; |
| 226 |
| 227 int height; |
| 228 if (!args_->GetInteger(2, &height)) |
| 229 return false; |
| 230 |
| 231 // Registry lives on the FILE thread. |
| 232 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, |
| 233 base::Bind(&OnTerminalResizeFunction::OnResizeOnFileThread, this, pid, |
| 234 width, height)); |
| 235 |
| 236 return true; |
| 237 } |
| 238 |
| 239 void OnTerminalResizeFunction::OnResizeOnFileThread(pid_t pid, |
| 240 int width, int height) { |
| 241 bool success = ProcessProxyRegistry::Get()->OnTerminalResize(pid, |
| 242 width, height); |
| 243 |
| 244 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 245 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, |
| 246 success)); |
| 247 } |
| 248 |
| 249 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { |
| 250 result_.reset(new base::FundamentalValue(success)); |
| 251 SendResponse(true); |
| 252 } |
| OLD | NEW |