| 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/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/process_proxy/process_proxy_registry.h" | 11 #include "chrome/browser/chromeos/process_proxy/process_proxy_registry.h" |
| 11 #include "chrome/browser/chromeos/system/runtime_environment.h" | |
| 12 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" | 12 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
| 13 #include "chrome/browser/extensions/extension_event_names.h" | 13 #include "chrome/browser/extensions/extension_event_names.h" |
| 14 #include "chrome/browser/extensions/extension_event_router.h" | 14 #include "chrome/browser/extensions/extension_event_router.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const char kCroshName[] = "crosh"; | 21 const char kCroshName[] = "crosh"; |
| 22 const char kCroshCommand[] = "/usr/bin/crosh"; | 22 const char kCroshCommand[] = "/usr/bin/crosh"; |
| 23 // We make stubbed crosh just echo back input. | 23 // We make stubbed crosh just echo back input. |
| 24 const char kStubbedCroshCommand[] = "cat"; | 24 const char kStubbedCroshCommand[] = "cat"; |
| 25 | 25 |
| 26 const char* GetCroshPath() { | 26 const char* GetCroshPath() { |
| 27 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) | 27 if (base::chromeos::IsRunningOnChromeOS()) |
| 28 return kCroshCommand; | 28 return kCroshCommand; |
| 29 else | 29 else |
| 30 return kStubbedCroshCommand; | 30 return kStubbedCroshCommand; |
| 31 } | 31 } |
| 32 | 32 |
| 33 const char* GetProcessCommandForName(const std::string& name) { | 33 const char* GetProcessCommandForName(const std::string& name) { |
| 34 if (name == kCroshName) { | 34 if (name == kCroshName) { |
| 35 return GetCroshPath(); | 35 return GetCroshPath(); |
| 36 } else { | 36 } else { |
| 37 return NULL; | 37 return NULL; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 212 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 213 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, | 213 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, |
| 214 success)); | 214 success)); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { | 217 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { |
| 218 result_.reset(new base::FundamentalValue(success)); | 218 result_.reset(new base::FundamentalValue(success)); |
| 219 SendResponse(true); | 219 SendResponse(true); |
| 220 } | 220 } |
| OLD | NEW |