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" | |
9 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/sys_info.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" | 11 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
12 #include "chrome/browser/extensions/event_router.h" | 12 #include "chrome/browser/extensions/event_router.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/extensions/extension_system.h" | 14 #include "chrome/browser/extensions/extension_system.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/common/extensions/api/terminal_private.h" | 16 #include "chrome/common/extensions/api/terminal_private.h" |
17 #include "chromeos/process_proxy/process_proxy_registry.h" | 17 #include "chromeos/process_proxy/process_proxy_registry.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 | 19 |
20 namespace terminal_private = extensions::api::terminal_private; | 20 namespace terminal_private = extensions::api::terminal_private; |
21 namespace OnTerminalResize = | 21 namespace OnTerminalResize = |
22 extensions::api::terminal_private::OnTerminalResize; | 22 extensions::api::terminal_private::OnTerminalResize; |
23 namespace OpenTerminalProcess = | 23 namespace OpenTerminalProcess = |
24 extensions::api::terminal_private::OpenTerminalProcess; | 24 extensions::api::terminal_private::OpenTerminalProcess; |
25 namespace SendInput = extensions::api::terminal_private::SendInput; | 25 namespace SendInput = extensions::api::terminal_private::SendInput; |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 const char kCroshName[] = "crosh"; | 29 const char kCroshName[] = "crosh"; |
30 const char kCroshCommand[] = "/usr/bin/crosh"; | 30 const char kCroshCommand[] = "/usr/bin/crosh"; |
31 // We make stubbed crosh just echo back input. | 31 // We make stubbed crosh just echo back input. |
32 const char kStubbedCroshCommand[] = "cat"; | 32 const char kStubbedCroshCommand[] = "cat"; |
33 | 33 |
34 const char* GetCroshPath() { | 34 const char* GetCroshPath() { |
35 if (base::chromeos::IsRunningOnChromeOS()) | 35 if (base::SysInfo::IsRunningOnChromeOS()) |
36 return kCroshCommand; | 36 return kCroshCommand; |
37 else | 37 else |
38 return kStubbedCroshCommand; | 38 return kStubbedCroshCommand; |
39 } | 39 } |
40 | 40 |
41 const char* GetProcessCommandForName(const std::string& name) { | 41 const char* GetProcessCommandForName(const std::string& name) { |
42 if (name == kCroshName) | 42 if (name == kCroshName) |
43 return GetCroshPath(); | 43 return GetCroshPath(); |
44 else | 44 else |
45 return NULL; | 45 return NULL; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 base::Bind(&TerminalPrivateOnTerminalResizeFunction::RespondOnUIThread, | 214 base::Bind(&TerminalPrivateOnTerminalResizeFunction::RespondOnUIThread, |
215 this, success)); | 215 this, success)); |
216 } | 216 } |
217 | 217 |
218 void TerminalPrivateOnTerminalResizeFunction::RespondOnUIThread(bool success) { | 218 void TerminalPrivateOnTerminalResizeFunction::RespondOnUIThread(bool success) { |
219 SetResult(new base::FundamentalValue(success)); | 219 SetResult(new base::FundamentalValue(success)); |
220 SendResponse(true); | 220 SendResponse(true); |
221 } | 221 } |
222 | 222 |
223 } // namespace extensions | 223 } // namespace extensions |
OLD | NEW |