OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accessibility/accessibility_util.h" | 5 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 10 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void OnFileLoaded(bool success, const std::string& data) { | 66 void OnFileLoaded(bool success, const std::string& data) { |
67 if (success) { | 67 if (success) { |
68 ExtensionMsg_ExecuteCode_Params params; | 68 ExtensionMsg_ExecuteCode_Params params; |
69 params.request_id = 0; | 69 params.request_id = 0; |
70 params.extension_id = extension_id_; | 70 params.extension_id = extension_id_; |
71 params.is_javascript = true; | 71 params.is_javascript = true; |
72 params.code = data; | 72 params.code = data; |
73 params.all_frames = true; | 73 params.all_frames = true; |
74 params.in_main_world = false; | 74 params.in_main_world = false; |
75 render_view_host_->Send(new ExtensionMsg_ExecuteCode( | 75 render_view_host_->Send(new ExtensionMsg_ExecuteCode( |
76 render_view_host_->routing_id(), params)); | 76 render_view_host_->GetRoutingID(), params)); |
77 } | 77 } |
78 Run(); | 78 Run(); |
79 } | 79 } |
80 | 80 |
81 std::string extension_id_; | 81 std::string extension_id_; |
82 RenderViewHost* render_view_host_; | 82 RenderViewHost* render_view_host_; |
83 std::queue<ExtensionResource> resources_; | 83 std::queue<ExtensionResource> resources_; |
84 }; | 84 }; |
85 | 85 |
86 void EnableSpokenFeedback(bool enabled, content::WebUI* login_web_ui) { | 86 void EnableSpokenFeedback(bool enabled, content::WebUI* login_web_ui) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Set a flag to tell ChromeVox that it's just been enabled, | 121 // Set a flag to tell ChromeVox that it's just been enabled, |
122 // so that it won't interrupt our speech feedback enabled message. | 122 // so that it won't interrupt our speech feedback enabled message. |
123 ExtensionMsg_ExecuteCode_Params params; | 123 ExtensionMsg_ExecuteCode_Params params; |
124 params.request_id = 0; | 124 params.request_id = 0; |
125 params.extension_id = extension->id(); | 125 params.extension_id = extension->id(); |
126 params.is_javascript = true; | 126 params.is_javascript = true; |
127 params.code = "window.INJECTED_AFTER_LOAD = true;"; | 127 params.code = "window.INJECTED_AFTER_LOAD = true;"; |
128 params.all_frames = true; | 128 params.all_frames = true; |
129 params.in_main_world = false; | 129 params.in_main_world = false; |
130 render_view_host->Send(new ExtensionMsg_ExecuteCode( | 130 render_view_host->Send(new ExtensionMsg_ExecuteCode( |
131 render_view_host->routing_id(), params)); | 131 render_view_host->GetRoutingID(), params)); |
132 | 132 |
133 // Inject ChromeVox' content scripts. | 133 // Inject ChromeVox' content scripts. |
134 ContentScriptLoader* loader = new ContentScriptLoader( | 134 ContentScriptLoader* loader = new ContentScriptLoader( |
135 extension->id(), render_view_host); | 135 extension->id(), render_view_host); |
136 | 136 |
137 for (size_t i = 0; i < extension->content_scripts().size(); i++) { | 137 for (size_t i = 0; i < extension->content_scripts().size(); i++) { |
138 const UserScript& script = extension->content_scripts()[i]; | 138 const UserScript& script = extension->content_scripts()[i]; |
139 for (size_t j = 0; j < script.js_scripts().size(); ++j) { | 139 for (size_t j = 0; j < script.js_scripts().size(); ++j) { |
140 const UserScript::File &file = script.js_scripts()[j]; | 140 const UserScript::File &file = script.js_scripts()[j]; |
141 ExtensionResource resource = extension->GetResource( | 141 ExtensionResource resource = extension->GetResource( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return spoken_feedback_enabled; | 198 return spoken_feedback_enabled; |
199 } | 199 } |
200 | 200 |
201 void MaybeSpeak(const std::string& utterance) { | 201 void MaybeSpeak(const std::string& utterance) { |
202 if (IsSpokenFeedbackEnabled()) | 202 if (IsSpokenFeedbackEnabled()) |
203 Speak(utterance); | 203 Speak(utterance); |
204 } | 204 } |
205 | 205 |
206 } // namespace accessibility | 206 } // namespace accessibility |
207 } // namespace chromeos | 207 } // namespace chromeos |
OLD | NEW |