| 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/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 if (profile && profile->GetExtensionEventRouter()) { | 61 if (profile && profile->GetExtensionEventRouter()) { |
| 62 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 62 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 63 extension_id, extension_event_names::kOnTerminalProcessOutput, | 63 extension_id, extension_event_names::kOnTerminalProcessOutput, |
| 64 args_json, NULL, GURL()); | 64 args_json, NULL, GURL()); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace | 68 } // namespace |
| 69 | 69 |
| 70 TerminalPrivateFunction::TerminalPrivateFunction() { | 70 TerminalPrivateFunction::TerminalPrivateFunction() {} |
| 71 } | |
| 72 | 71 |
| 73 TerminalPrivateFunction::~TerminalPrivateFunction() { | 72 TerminalPrivateFunction::~TerminalPrivateFunction() {} |
| 74 } | |
| 75 | 73 |
| 76 bool TerminalPrivateFunction::RunImpl() { | 74 bool TerminalPrivateFunction::RunImpl() { |
| 77 return RunTerminalFunction(); | 75 return RunTerminalFunction(); |
| 78 } | 76 } |
| 79 | 77 |
| 80 OpenTerminalProcessFunction::OpenTerminalProcessFunction() : command_(NULL) { | 78 OpenTerminalProcessFunction::OpenTerminalProcessFunction() : command_(NULL) {} |
| 81 } | |
| 82 | 79 |
| 83 OpenTerminalProcessFunction::~OpenTerminalProcessFunction() { | 80 OpenTerminalProcessFunction::~OpenTerminalProcessFunction() {} |
| 84 } | |
| 85 | 81 |
| 86 bool OpenTerminalProcessFunction::RunTerminalFunction() { | 82 bool OpenTerminalProcessFunction::RunTerminalFunction() { |
| 87 if (args_->GetSize() != 1) | 83 if (args_->GetSize() != 1) |
| 88 return false; | 84 return false; |
| 89 | 85 |
| 90 std::string name; | 86 std::string name; |
| 91 if (!args_->GetString(0, &name)) | 87 if (!args_->GetString(0, &name)) |
| 92 return false; | 88 return false; |
| 93 | 89 |
| 94 command_ = GetProcessCommandForName(name); | 90 command_ = GetProcessCommandForName(name); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 207 |
| 212 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 208 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 213 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, | 209 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, |
| 214 success)); | 210 success)); |
| 215 } | 211 } |
| 216 | 212 |
| 217 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { | 213 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { |
| 218 result_.reset(new base::FundamentalValue(success)); | 214 result_.reset(new base::FundamentalValue(success)); |
| 219 SendResponse(true); | 215 SendResponse(true); |
| 220 } | 216 } |
| OLD | NEW |