Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: chrome/browser/extensions/api/terminal/terminal_private_api.cc

Issue 11232066: Remove GetExtensionEventRouter from Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rerebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/event_names.h" 13 #include "chrome/browser/extensions/event_names.h"
14 #include "chrome/browser/extensions/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/extensions/extension_system.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 19
19 namespace { 20 namespace {
20 21
21 const char kCroshName[] = "crosh"; 22 const char kCroshName[] = "crosh";
22 const char kCroshCommand[] = "/usr/bin/crosh"; 23 const char kCroshCommand[] = "/usr/bin/crosh";
23 // We make stubbed crosh just echo back input. 24 // We make stubbed crosh just echo back input.
24 const char kStubbedCroshCommand[] = "cat"; 25 const char kStubbedCroshCommand[] = "cat";
25 26
(...skipping 22 matching lines...) Expand all
48 base::Bind(&NotifyProcessOutput, profile, extension_id, 49 base::Bind(&NotifyProcessOutput, profile, extension_id,
49 pid, output_type, output)); 50 pid, output_type, output));
50 return; 51 return;
51 } 52 }
52 53
53 scoped_ptr<base::ListValue> args(new base::ListValue()); 54 scoped_ptr<base::ListValue> args(new base::ListValue());
54 args->Append(new base::FundamentalValue(pid)); 55 args->Append(new base::FundamentalValue(pid));
55 args->Append(new base::StringValue(output_type)); 56 args->Append(new base::StringValue(output_type));
56 args->Append(new base::StringValue(output)); 57 args->Append(new base::StringValue(output));
57 58
58 if (profile && profile->GetExtensionEventRouter()) { 59 if (profile &&
59 profile->GetExtensionEventRouter()->DispatchEventToExtension( 60 extensions::ExtensionSystem::Get(profile)->event_router()) {
60 extension_id, extensions::event_names::kOnTerminalProcessOutput, 61 extensions::ExtensionSystem::Get(profile)->event_router()->
61 args.Pass(), NULL, GURL()); 62 DispatchEventToExtension(extension_id,
63 extensions::event_names::kOnTerminalProcessOutput, args.Pass(),
64 NULL, GURL());
62 } 65 }
63 } 66 }
64 67
65 } // namespace 68 } // namespace
66 69
67 TerminalPrivateFunction::TerminalPrivateFunction() {} 70 TerminalPrivateFunction::TerminalPrivateFunction() {}
68 71
69 TerminalPrivateFunction::~TerminalPrivateFunction() {} 72 TerminalPrivateFunction::~TerminalPrivateFunction() {}
70 73
71 bool TerminalPrivateFunction::RunImpl() { 74 bool TerminalPrivateFunction::RunImpl() {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 213
211 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 214 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
212 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this, 215 base::Bind(&OnTerminalResizeFunction::RespondOnUIThread, this,
213 success)); 216 success));
214 } 217 }
215 218
216 void OnTerminalResizeFunction::RespondOnUIThread(bool success) { 219 void OnTerminalResizeFunction::RespondOnUIThread(bool success) {
217 SetResult(new base::FundamentalValue(success)); 220 SetResult(new base::FundamentalValue(success));
218 SendResponse(true); 221 SendResponse(true);
219 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698