Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/policy/remote_commands/device_commands_factory _chromeos.h" | 5 #include "chrome/browser/chromeos/policy/remote_commands/device_commands_factory _chromeos.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
| 9 #include "chrome/browser/browser_process.h" | |
| 10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
| 9 #include "chrome/browser/chromeos/policy/remote_commands/device_command_reboot_j ob.h" | 11 #include "chrome/browser/chromeos/policy/remote_commands/device_command_reboot_j ob.h" |
| 10 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h" | 12 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh ot_job.h" |
| 11 #include "chrome/browser/chromeos/policy/remote_commands/screenshot_delegate.h" | 13 #include "chrome/browser/chromeos/policy/remote_commands/screenshot_delegate.h" |
| 12 #include "chromeos/dbus/dbus_thread_manager.h" | 14 #include "chromeos/dbus/dbus_thread_manager.h" |
| 13 #include "components/policy/core/common/remote_commands/remote_command_job.h" | 15 #include "components/policy/core/common/remote_commands/remote_command_job.h" |
| 14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 15 #include "policy/proto/device_management_backend.pb.h" | 17 #include "policy/proto/device_management_backend.pb.h" |
| 16 | 18 |
| 17 namespace em = enterprise_management; | 19 namespace em = enterprise_management; |
| 18 | 20 |
| 19 namespace policy { | 21 namespace policy { |
| 20 | 22 |
| 21 DeviceCommandsFactoryChromeOS::DeviceCommandsFactoryChromeOS() { | 23 DeviceCommandsFactoryChromeOS::DeviceCommandsFactoryChromeOS() { |
| 22 } | 24 } |
| 23 | 25 |
| 24 DeviceCommandsFactoryChromeOS::~DeviceCommandsFactoryChromeOS() { | 26 DeviceCommandsFactoryChromeOS::~DeviceCommandsFactoryChromeOS() { |
| 25 } | 27 } |
| 26 | 28 |
| 27 scoped_ptr<RemoteCommandJob> DeviceCommandsFactoryChromeOS::BuildJobForType( | 29 scoped_ptr<RemoteCommandJob> DeviceCommandsFactoryChromeOS::BuildJobForType( |
| 28 em::RemoteCommand_Type type) { | 30 em::RemoteCommand_Type type) { |
| 29 switch (type) { | 31 switch (type) { |
| 30 case em::RemoteCommand_Type_DEVICE_REBOOT: | 32 case em::RemoteCommand_Type_DEVICE_REBOOT: |
| 31 return make_scoped_ptr<RemoteCommandJob>(new DeviceCommandRebootJob( | 33 return make_scoped_ptr<RemoteCommandJob>(new DeviceCommandRebootJob( |
| 32 chromeos::DBusThreadManager::Get()->GetPowerManagerClient())); | 34 chromeos::DBusThreadManager::Get()->GetPowerManagerClient())); |
| 33 case em::RemoteCommand_Type_DEVICE_SCREENSHOT: | 35 case em::RemoteCommand_Type_DEVICE_SCREENSHOT: { |
| 34 return make_scoped_ptr<RemoteCommandJob>( | 36 scoped_refptr<base::TaskRunner> task_runner = |
| 35 new DeviceCommandScreenshotJob(make_scoped_ptr(new ScreenshotDelegate( | 37 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( |
| 36 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 38 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); |
| 37 content::BrowserThread::GetBlockingPool() | 39 BrowserPolicyConnectorChromeOS* connector = |
| 38 ->GetSequenceToken()))))); | 40 g_browser_process->platform_part() |
| 41 ->browser_policy_connector_chromeos(); | |
|
cschuet (SLOW)
2015/05/13 15:56:09
DCHECK(connector)?
Andrew T Wilson (Slow)
2015/05/15 09:43:51
No need, we'll just crash if it's null, which is e
| |
| 42 return make_scoped_ptr<RemoteCommandJob>(new DeviceCommandScreenshotJob( | |
| 43 make_scoped_ptr(new ScreenshotDelegate(task_runner)), | |
| 44 connector->GetDeviceCloudPolicyManager()->GetStatusUploader())); | |
| 45 } | |
|
cschuet (SLOW)
2015/05/13 15:56:09
Thanks for cleaning that up. That was a little too
Andrew T Wilson (Slow)
2015/05/15 09:43:51
Hah, and I reverted back to the original since now
| |
| 39 default: | 46 default: |
| 40 return nullptr; | 47 return nullptr; |
| 41 } | 48 } |
| 42 } | 49 } |
| 43 | 50 |
| 44 } // namespace policy | 51 } // namespace policy |
| OLD | NEW |