| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 Error(kCannotRequestAutomationOnPage, contents->GetURL().spec())); | 269 Error(kCannotRequestAutomationOnPage, contents->GetURL().spec())); |
| 270 } | 270 } |
| 271 | 271 |
| 272 AutomationWebContentsObserver::CreateForWebContents(contents); | 272 AutomationWebContentsObserver::CreateForWebContents(contents); |
| 273 contents->EnableTreeOnlyAccessibilityMode(); | 273 contents->EnableTreeOnlyAccessibilityMode(); |
| 274 | 274 |
| 275 int ax_tree_id = rfh->GetAXTreeID(); | 275 int ax_tree_id = rfh->GetAXTreeID(); |
| 276 | 276 |
| 277 // This gets removed when the extension process dies. | 277 // This gets removed when the extension process dies. |
| 278 AutomationEventRouter::GetInstance()->RegisterListenerForOneTree( | 278 AutomationEventRouter::GetInstance()->RegisterListenerForOneTree( |
| 279 extension_id(), |
| 279 source_process_id(), | 280 source_process_id(), |
| 280 params->args.routing_id, | 281 params->args.routing_id, |
| 281 ax_tree_id); | 282 ax_tree_id); |
| 282 | 283 |
| 283 return RespondNow(ArgumentList( | 284 return RespondNow(ArgumentList( |
| 284 api::automation_internal::EnableTab::Results::Create(ax_tree_id))); | 285 api::automation_internal::EnableTab::Results::Create(ax_tree_id))); |
| 285 } | 286 } |
| 286 | 287 |
| 287 ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() { | 288 ExtensionFunction::ResponseAction AutomationInternalEnableFrameFunction::Run() { |
| 288 // TODO(dtseng): Limited to desktop tree for now pending out of proc iframes. | 289 // TODO(dtseng): Limited to desktop tree for now pending out of proc iframes. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); | 381 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); |
| 381 if (!automation_info || !automation_info->desktop) | 382 if (!automation_info || !automation_info->desktop) |
| 382 return RespondNow(Error("desktop permission must be requested")); | 383 return RespondNow(Error("desktop permission must be requested")); |
| 383 | 384 |
| 384 using api::automation_internal::EnableDesktop::Params; | 385 using api::automation_internal::EnableDesktop::Params; |
| 385 scoped_ptr<Params> params(Params::Create(*args_)); | 386 scoped_ptr<Params> params(Params::Create(*args_)); |
| 386 EXTENSION_FUNCTION_VALIDATE(params.get()); | 387 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 387 | 388 |
| 388 // This gets removed when the extension process dies. | 389 // This gets removed when the extension process dies. |
| 389 AutomationEventRouter::GetInstance()->RegisterListenerWithDesktopPermission( | 390 AutomationEventRouter::GetInstance()->RegisterListenerWithDesktopPermission( |
| 391 extension_id(), |
| 390 source_process_id(), | 392 source_process_id(), |
| 391 params->routing_id); | 393 params->routing_id); |
| 392 | 394 |
| 393 AutomationManagerAura::GetInstance()->Enable(browser_context()); | 395 AutomationManagerAura::GetInstance()->Enable(browser_context()); |
| 394 return RespondNow(NoArguments()); | 396 return RespondNow(NoArguments()); |
| 395 #else | 397 #else |
| 396 return RespondNow(Error("getDesktop is unsupported by this platform")); | 398 return RespondNow(Error("getDesktop is unsupported by this platform")); |
| 397 #endif // defined(USE_AURA) | 399 #endif // defined(USE_AURA) |
| 398 } | 400 } |
| 399 | 401 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 int result_acc_obj_id) { | 439 int result_acc_obj_id) { |
| 438 if (!error.empty()) { | 440 if (!error.empty()) { |
| 439 Respond(Error(error)); | 441 Respond(Error(error)); |
| 440 return; | 442 return; |
| 441 } | 443 } |
| 442 | 444 |
| 443 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); | 445 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); |
| 444 } | 446 } |
| 445 | 447 |
| 446 } // namespace extensions | 448 } // namespace extensions |
| OLD | NEW |