| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 173 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 174 base::Bind(&CloseTerminalProcessFunction::RespondOnUIThread, this, | 174 base::Bind(&CloseTerminalProcessFunction::RespondOnUIThread, this, |
| 175 success)); | 175 success)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void CloseTerminalProcessFunction::RespondOnUIThread(bool success) { | 178 void CloseTerminalProcessFunction::RespondOnUIThread(bool success) { |
| 179 result_.reset(new base::FundamentalValue(success)); | 179 result_.reset(new base::FundamentalValue(success)); |
| 180 SendResponse(true); | 180 SendResponse(true); |
| 181 } | 181 } |
| 182 |
| 183 bool OnTerminalResizeFunction::RunTerminalFunction() { |
| 184 if (args_->GetSize() != 3) |
| 185 return false; |
| 186 |
| 187 pid_t pid; |
| 188 if (!args_->GetInteger(0, &pid)) |
| 189 return false; |
| 190 |
| 191 int width; |
| 192 if (!args_->GetInteger(1, &width)) |
| 193 return false; |
| 194 |
| 195 int height; |
| 196 if (!args_->GetInteger(2, &height)) |
| 197 return false; |
| 198 |
| 199 // Registry lives on the FILE thread. |
| 200 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, |
| 201 base::Bind(&OnTerminalResizeFunction::OnResizeOnFileThread, this, pid, |
| 202 width, height)); |
| 203 |
| 204 return true; |
| 205 } |
| 206 |
| 207 void OnTerminalResizeFunction::OnResizeOnFileThread(pid_t pid, |
| 208 int width, int height) { |
| 209 bool success = ProcessProxyRegistry::Get()->OnTerminalResize(pid, |
| 210 width, height); |
| 211 |
| 212 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 213 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, |
| 214 success)); |
| 215 } |
| 216 |
| 217 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { |
| 218 result_.reset(new base::FundamentalValue(success)); |
| 219 SendResponse(true); |
| 220 } |
| OLD | NEW |