| 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 <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "ash/high_contrast/high_contrast_controller.h" | 9 #include "ash/high_contrast/high_contrast_controller.h" |
| 10 #include "ash/magnifier/magnification_controller.h" | 10 #include "ash/magnifier/magnification_controller.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 void OnFileLoaded(bool success, const std::string& data) { | 75 void OnFileLoaded(bool success, const std::string& data) { |
| 76 if (success) { | 76 if (success) { |
| 77 ExtensionMsg_ExecuteCode_Params params; | 77 ExtensionMsg_ExecuteCode_Params params; |
| 78 params.request_id = 0; | 78 params.request_id = 0; |
| 79 params.extension_id = extension_id_; | 79 params.extension_id = extension_id_; |
| 80 params.is_javascript = true; | 80 params.is_javascript = true; |
| 81 params.code = data; | 81 params.code = data; |
| 82 params.run_at = UserScript::DOCUMENT_IDLE; | 82 params.run_at = extensions::UserScript::DOCUMENT_IDLE; |
| 83 params.all_frames = true; | 83 params.all_frames = true; |
| 84 params.in_main_world = false; | 84 params.in_main_world = false; |
| 85 render_view_host_->Send(new ExtensionMsg_ExecuteCode( | 85 render_view_host_->Send(new ExtensionMsg_ExecuteCode( |
| 86 render_view_host_->GetRoutingID(), params)); | 86 render_view_host_->GetRoutingID(), params)); |
| 87 } | 87 } |
| 88 Run(); | 88 Run(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::string extension_id_; | 91 std::string extension_id_; |
| 92 RenderViewHost* render_view_host_; | 92 RenderViewHost* render_view_host_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (login_web_ui) { | 127 if (login_web_ui) { |
| 128 RenderViewHost* render_view_host = | 128 RenderViewHost* render_view_host = |
| 129 login_web_ui->GetWebContents()->GetRenderViewHost(); | 129 login_web_ui->GetWebContents()->GetRenderViewHost(); |
| 130 // Set a flag to tell ChromeVox that it's just been enabled, | 130 // Set a flag to tell ChromeVox that it's just been enabled, |
| 131 // so that it won't interrupt our speech feedback enabled message. | 131 // so that it won't interrupt our speech feedback enabled message. |
| 132 ExtensionMsg_ExecuteCode_Params params; | 132 ExtensionMsg_ExecuteCode_Params params; |
| 133 params.request_id = 0; | 133 params.request_id = 0; |
| 134 params.extension_id = extension->id(); | 134 params.extension_id = extension->id(); |
| 135 params.is_javascript = true; | 135 params.is_javascript = true; |
| 136 params.code = "window.INJECTED_AFTER_LOAD = true;"; | 136 params.code = "window.INJECTED_AFTER_LOAD = true;"; |
| 137 params.run_at = UserScript::DOCUMENT_IDLE; | 137 params.run_at = extensions::UserScript::DOCUMENT_IDLE; |
| 138 params.all_frames = true; | 138 params.all_frames = true; |
| 139 params.in_main_world = false; | 139 params.in_main_world = false; |
| 140 render_view_host->Send(new ExtensionMsg_ExecuteCode( | 140 render_view_host->Send(new ExtensionMsg_ExecuteCode( |
| 141 render_view_host->GetRoutingID(), params)); | 141 render_view_host->GetRoutingID(), params)); |
| 142 | 142 |
| 143 // Inject ChromeVox' content scripts. | 143 // Inject ChromeVox' content scripts. |
| 144 ContentScriptLoader* loader = new ContentScriptLoader( | 144 ContentScriptLoader* loader = new ContentScriptLoader( |
| 145 extension->id(), render_view_host); | 145 extension->id(), render_view_host); |
| 146 | 146 |
| 147 for (size_t i = 0; i < extension->content_scripts().size(); i++) { | 147 for (size_t i = 0; i < extension->content_scripts().size(); i++) { |
| 148 const UserScript& script = extension->content_scripts()[i]; | 148 const extensions::UserScript& script = extension->content_scripts()[i]; |
| 149 for (size_t j = 0; j < script.js_scripts().size(); ++j) { | 149 for (size_t j = 0; j < script.js_scripts().size(); ++j) { |
| 150 const UserScript::File &file = script.js_scripts()[j]; | 150 const extensions::UserScript::File &file = script.js_scripts()[j]; |
| 151 ExtensionResource resource = extension->GetResource( | 151 ExtensionResource resource = extension->GetResource( |
| 152 file.relative_path()); | 152 file.relative_path()); |
| 153 loader->AppendScript(resource); | 153 loader->AppendScript(resource); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 loader->Run(); // It cleans itself up when done. | 156 loader->Run(); // It cleans itself up when done. |
| 157 } | 157 } |
| 158 | 158 |
| 159 DLOG(INFO) << "ChromeVox was Loaded."; | 159 DLOG(INFO) << "ChromeVox was Loaded."; |
| 160 } else { // Unload ChromeVox | 160 } else { // Unload ChromeVox |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 return enabled; | 235 return enabled; |
| 236 } | 236 } |
| 237 | 237 |
| 238 void MaybeSpeak(const std::string& utterance) { | 238 void MaybeSpeak(const std::string& utterance) { |
| 239 if (IsSpokenFeedbackEnabled()) | 239 if (IsSpokenFeedbackEnabled()) |
| 240 Speak(utterance); | 240 Speak(utterance); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace accessibility | 243 } // namespace accessibility |
| 244 } // namespace chromeos | 244 } // namespace chromeos |
| OLD | NEW |