| 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 "chrome/browser/extensions/api/automation_internal/automation_util.h" | 9 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 content::WebContents* contents = | 69 content::WebContents* contents = |
| 70 tab_strip->GetWebContentsAt(tab_strip->active_index()); | 70 tab_strip->GetWebContentsAt(tab_strip->active_index()); |
| 71 if (!contents) | 71 if (!contents) |
| 72 return RespondNow(Error("No active tab")); | 72 return RespondNow(Error("No active tab")); |
| 73 content::RenderWidgetHost* rwh = | 73 content::RenderWidgetHost* rwh = |
| 74 contents->GetRenderWidgetHostView()->GetRenderWidgetHost(); | 74 contents->GetRenderWidgetHostView()->GetRenderWidgetHost(); |
| 75 if (!rwh) | 75 if (!rwh) |
| 76 return RespondNow(Error("Could not enable accessibility for active tab")); | 76 return RespondNow(Error("Could not enable accessibility for active tab")); |
| 77 AutomationWebContentsObserver::CreateForWebContents(contents); | 77 AutomationWebContentsObserver::CreateForWebContents(contents); |
| 78 rwh->EnableTreeOnlyAccessibilityMode(); | 78 rwh->EnableTreeOnlyAccessibilityMode(); |
| 79 scoped_ptr<base::ListValue> results = | 79 return RespondNow( |
| 80 api::automation_internal::EnableCurrentTab::Results::Create( | 80 ArgumentList(api::automation_internal::EnableCurrentTab::Results::Create( |
| 81 rwh->GetProcess()->GetID(), rwh->GetRoutingID()); | 81 rwh->GetProcess()->GetID(), rwh->GetRoutingID()))); |
| 82 return RespondNow(MultipleArguments(results.release())); | |
| 83 } | 82 } |
| 84 | 83 |
| 85 ExtensionFunction::ResponseAction | 84 ExtensionFunction::ResponseAction |
| 86 AutomationInternalPerformActionFunction::Run() { | 85 AutomationInternalPerformActionFunction::Run() { |
| 87 using api::automation_internal::PerformAction::Params; | 86 using api::automation_internal::PerformAction::Params; |
| 88 scoped_ptr<Params> params(Params::Create(*args_)); | 87 scoped_ptr<Params> params(Params::Create(*args_)); |
| 89 EXTENSION_FUNCTION_VALIDATE(params.get()); | 88 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 90 | 89 |
| 91 content::RenderWidgetHost* rwh = | 90 content::RenderWidgetHost* rwh = |
| 92 content::RenderWidgetHost::FromID(params->args.process_id, | 91 content::RenderWidgetHost::FromID(params->args.process_id, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 return RespondNow(Error("desktop permission must be requested")); | 126 return RespondNow(Error("desktop permission must be requested")); |
| 128 | 127 |
| 129 AutomationManagerViews::GetInstance()->Enable(browser_context()); | 128 AutomationManagerViews::GetInstance()->Enable(browser_context()); |
| 130 return RespondNow(NoArguments()); | 129 return RespondNow(NoArguments()); |
| 131 #else | 130 #else |
| 132 return RespondNow(Error("getDesktop is unsupported by this platform")); | 131 return RespondNow(Error("getDesktop is unsupported by this platform")); |
| 133 #endif | 132 #endif |
| 134 } | 133 } |
| 135 | 134 |
| 136 } // namespace extensions | 135 } // namespace extensions |
| OLD | NEW |