| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/automation_internal/automation_internal_
api.h" | 5 #include "chrome/browser/extensions/api/automation_internal/automation_internal_
api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 302 } |
| 303 | 303 |
| 304 AutomationWebContentsObserver::CreateForWebContents(contents); | 304 AutomationWebContentsObserver::CreateForWebContents(contents); |
| 305 contents->EnableTreeOnlyAccessibilityMode(); | 305 contents->EnableTreeOnlyAccessibilityMode(); |
| 306 | 306 |
| 307 int ax_tree_id = AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID( | 307 int ax_tree_id = AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID( |
| 308 rfh->GetProcess()->GetID(), rfh->GetRoutingID()); | 308 rfh->GetProcess()->GetID(), rfh->GetRoutingID()); |
| 309 | 309 |
| 310 // This gets removed when the extension process dies. | 310 // This gets removed when the extension process dies. |
| 311 AutomationEventRouter::GetInstance()->RegisterListenerForOneTree( | 311 AutomationEventRouter::GetInstance()->RegisterListenerForOneTree( |
| 312 extension_id(), |
| 312 source_process_id(), | 313 source_process_id(), |
| 313 params->args.routing_id, | 314 params->args.routing_id, |
| 314 ax_tree_id); | 315 ax_tree_id); |
| 315 | 316 |
| 316 return RespondNow(ArgumentList( | 317 return RespondNow(ArgumentList( |
| 317 api::automation_internal::EnableTab::Results::Create(ax_tree_id))); | 318 api::automation_internal::EnableTab::Results::Create(ax_tree_id))); |
| 318 } | 319 } |
| 319 | 320 |
| 320 ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() { | 321 ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() { |
| 321 // TODO(dtseng): Limited to desktop tree for now pending out of proc iframes. | 322 // TODO(dtseng): Limited to desktop tree for now pending out of proc iframes. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); | 418 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); |
| 418 if (!automation_info || !automation_info->desktop) | 419 if (!automation_info || !automation_info->desktop) |
| 419 return RespondNow(Error("desktop permission must be requested")); | 420 return RespondNow(Error("desktop permission must be requested")); |
| 420 | 421 |
| 421 using api::automation_internal::EnableDesktop::Params; | 422 using api::automation_internal::EnableDesktop::Params; |
| 422 scoped_ptr<Params> params(Params::Create(*args_)); | 423 scoped_ptr<Params> params(Params::Create(*args_)); |
| 423 EXTENSION_FUNCTION_VALIDATE(params.get()); | 424 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 424 | 425 |
| 425 // This gets removed when the extension process dies. | 426 // This gets removed when the extension process dies. |
| 426 AutomationEventRouter::GetInstance()->RegisterListenerWithDesktopPermission( | 427 AutomationEventRouter::GetInstance()->RegisterListenerWithDesktopPermission( |
| 428 extension_id(), |
| 427 source_process_id(), | 429 source_process_id(), |
| 428 params->routing_id); | 430 params->routing_id); |
| 429 | 431 |
| 430 AutomationManagerAura::GetInstance()->Enable(browser_context()); | 432 AutomationManagerAura::GetInstance()->Enable(browser_context()); |
| 431 return RespondNow(NoArguments()); | 433 return RespondNow(NoArguments()); |
| 432 #else | 434 #else |
| 433 return RespondNow(Error("getDesktop is unsupported by this platform")); | 435 return RespondNow(Error("getDesktop is unsupported by this platform")); |
| 434 #endif // defined(USE_AURA) | 436 #endif // defined(USE_AURA) |
| 435 } | 437 } |
| 436 | 438 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 int result_acc_obj_id) { | 478 int result_acc_obj_id) { |
| 477 if (!error.empty()) { | 479 if (!error.empty()) { |
| 478 Respond(Error(error)); | 480 Respond(Error(error)); |
| 479 return; | 481 return; |
| 480 } | 482 } |
| 481 | 483 |
| 482 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); | 484 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); |
| 483 } | 485 } |
| 484 | 486 |
| 485 } // namespace extensions | 487 } // namespace extensions |
| OLD | NEW |