Chromium Code Reviews| 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/containers/hash_tables.h" | |
| 10 #include "base/lazy_instance.h" | |
| 9 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/accessibility/ax_tree_id_registry.h" | 14 #include "chrome/browser/accessibility/ax_tree_id_registry.h" |
| 13 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad apter.h" | 15 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad apter.h" |
| 16 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou ter.h" | |
| 14 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" | 17 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" |
| 15 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 18 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 16 #include "chrome/browser/extensions/extension_tab_util.h" | 19 #include "chrome/browser/extensions/extension_tab_util.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/common/extensions/api/automation_internal.h" | 23 #include "chrome/common/extensions/api/automation_internal.h" |
| 24 #include "chrome/common/extensions/chrome_extension_messages.h" | |
| 21 #include "chrome/common/extensions/manifest_handlers/automation.h" | 25 #include "chrome/common/extensions/manifest_handlers/automation.h" |
| 22 #include "content/public/browser/ax_event_notification_details.h" | 26 #include "content/public/browser/ax_event_notification_details.h" |
| 23 #include "content/public/browser/browser_accessibility_state.h" | 27 #include "content/public/browser/browser_accessibility_state.h" |
| 24 #include "content/public/browser/render_frame_host.h" | 28 #include "content/public/browser/render_frame_host.h" |
| 25 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
| 26 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
| 27 #include "content/public/browser/render_widget_host.h" | 31 #include "content/public/browser/render_widget_host.h" |
| 28 #include "content/public/browser/render_widget_host_view.h" | 32 #include "content/public/browser/render_widget_host_view.h" |
| 29 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 34 #include "extensions/browser/extension_host.h" | |
| 35 #include "extensions/browser/process_manager.h" | |
| 30 #include "extensions/common/extension_messages.h" | 36 #include "extensions/common/extension_messages.h" |
| 31 #include "extensions/common/permissions/permissions_data.h" | 37 #include "extensions/common/permissions/permissions_data.h" |
| 32 | 38 |
| 33 #if defined(USE_AURA) | 39 #if defined(USE_AURA) |
| 34 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" | 40 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
| 35 #endif | 41 #endif |
| 36 | 42 |
| 37 namespace extensions { | 43 namespace extensions { |
| 38 class AutomationWebContentsObserver; | 44 class AutomationWebContentsObserver; |
| 39 } // namespace extensions | 45 } // namespace extensions |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 return RespondNow(NoArguments()); | 350 return RespondNow(NoArguments()); |
| 345 } | 351 } |
| 346 | 352 |
| 347 ExtensionFunction::ResponseAction | 353 ExtensionFunction::ResponseAction |
| 348 AutomationInternalEnableDesktopFunction::Run() { | 354 AutomationInternalEnableDesktopFunction::Run() { |
| 349 #if defined(USE_AURA) | 355 #if defined(USE_AURA) |
| 350 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); | 356 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); |
| 351 if (!automation_info || !automation_info->desktop) | 357 if (!automation_info || !automation_info->desktop) |
| 352 return RespondNow(Error("desktop permission must be requested")); | 358 return RespondNow(Error("desktop permission must be requested")); |
| 353 | 359 |
| 360 using api::automation_internal::EnableTab::Params; | |
| 361 scoped_ptr<Params> params(Params::Create(*args_)); | |
| 362 EXTENSION_FUNCTION_VALIDATE(params.get()); | |
| 363 | |
| 364 AutomationEventRouter* router = AutomationEventRouter::GetInstance(); | |
| 365 router->AddListener(extension()->id(), | |
|
not at google - send to devlin
2015/06/02 23:59:24
you might want to comment when this gets removed,
dmazzoni
2015/06/04 20:07:39
Done.
| |
| 366 0, | |
| 367 source_process_id(), | |
| 368 params->routing_id, | |
| 369 true); | |
| 370 | |
| 354 AutomationManagerAura::GetInstance()->Enable(browser_context()); | 371 AutomationManagerAura::GetInstance()->Enable(browser_context()); |
| 355 return RespondNow(NoArguments()); | 372 return RespondNow(NoArguments()); |
| 356 #else | 373 #else |
| 357 return RespondNow(Error("getDesktop is unsupported by this platform")); | 374 return RespondNow(Error("getDesktop is unsupported by this platform")); |
| 358 #endif // defined(USE_AURA) | 375 #endif // defined(USE_AURA) |
| 359 } | 376 } |
| 360 | 377 |
| 361 // static | 378 // static |
| 362 int AutomationInternalQuerySelectorFunction::query_request_id_counter_ = 0; | 379 int AutomationInternalQuerySelectorFunction::query_request_id_counter_ = 0; |
| 363 | 380 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 int result_acc_obj_id) { | 417 int result_acc_obj_id) { |
| 401 if (!error.empty()) { | 418 if (!error.empty()) { |
| 402 Respond(Error(error)); | 419 Respond(Error(error)); |
| 403 return; | 420 return; |
| 404 } | 421 } |
| 405 | 422 |
| 406 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); | 423 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); |
| 407 } | 424 } |
| 408 | 425 |
| 409 } // namespace extensions | 426 } // namespace extensions |
| OLD | NEW |