| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_util.h" | 5 #include "chrome/browser/chromeos/accessibility_util.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 11 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" | 12 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" |
| 12 #include "chrome/browser/extensions/extension_accessibility_api.h" | 13 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/file_reader.h" | 15 #include "chrome/browser/extensions/file_reader.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 48 // Fianlly, call this method once to fetch all of the resources and | 49 // Fianlly, call this method once to fetch all of the resources and |
| 49 // load them. This method will delete this object when done. | 50 // load them. This method will delete this object when done. |
| 50 void Run() { | 51 void Run() { |
| 51 if (resources_.empty()) { | 52 if (resources_.empty()) { |
| 52 delete this; | 53 delete this; |
| 53 return; | 54 return; |
| 54 } | 55 } |
| 55 | 56 |
| 56 ExtensionResource resource = resources_.front(); | 57 ExtensionResource resource = resources_.front(); |
| 57 resources_.pop(); | 58 resources_.pop(); |
| 58 scoped_refptr<FileReader> reader(new FileReader(resource, NewCallback( | 59 scoped_refptr<FileReader> reader(new FileReader(resource, base::Bind( |
| 59 this, &ContentScriptLoader::OnFileLoaded))); | 60 &ContentScriptLoader::OnFileLoaded, base::Unretained(this)))); |
| 60 reader->Start(); | 61 reader->Start(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 void OnFileLoaded(bool success, const std::string& data) { | 65 void OnFileLoaded(bool success, const std::string& data) { |
| 65 if (success) { | 66 if (success) { |
| 66 ExtensionMsg_ExecuteCode_Params params; | 67 ExtensionMsg_ExecuteCode_Params params; |
| 67 params.request_id = 0; | 68 params.request_id = 0; |
| 68 params.extension_id = extension_id_; | 69 params.extension_id = extension_id_; |
| 69 params.is_javascript = true; | 70 params.is_javascript = true; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 SetSpeakProperties(props.c_str()); | 167 SetSpeakProperties(props.c_str()); |
| 167 } | 168 } |
| 168 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()-> | 169 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()-> |
| 169 Speak(speak_str); | 170 Speak(speak_str); |
| 170 } | 171 } |
| 171 } | 172 } |
| 172 | 173 |
| 173 | 174 |
| 174 } // namespace accessibility | 175 } // namespace accessibility |
| 175 } // namespace chromeos | 176 } // namespace chromeos |
| OLD | NEW |