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" |
11 #include "chrome/browser/chromeos/process_proxy/process_proxy_registry.h" | 11 #include "chrome/browser/chromeos/process_proxy/process_proxy_registry.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/event_names.h" |
14 #include "chrome/browser/extensions/extension_event_router.h" | 14 #include "chrome/browser/extensions/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"; |
(...skipping 28 matching lines...) Expand all Loading... |
53 base::ListValue args; | 53 base::ListValue args; |
54 args.Append(new base::FundamentalValue(pid)); | 54 args.Append(new base::FundamentalValue(pid)); |
55 args.Append(new base::StringValue(output_type)); | 55 args.Append(new base::StringValue(output_type)); |
56 args.Append(new base::StringValue(output)); | 56 args.Append(new base::StringValue(output)); |
57 | 57 |
58 std::string args_json; | 58 std::string args_json; |
59 base::JSONWriter::Write(&args, &args_json); | 59 base::JSONWriter::Write(&args, &args_json); |
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, extensions::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 | 71 |
72 TerminalPrivateFunction::~TerminalPrivateFunction() {} | 72 TerminalPrivateFunction::~TerminalPrivateFunction() {} |
73 | 73 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 214 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
215 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, | 215 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, |
216 success)); | 216 success)); |
217 } | 217 } |
218 | 218 |
219 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { | 219 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { |
220 SetResult(new base::FundamentalValue(success)); | 220 SetResult(new base::FundamentalValue(success)); |
221 SendResponse(true); | 221 SendResponse(true); |
222 } | 222 } |
OLD | NEW |