| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/braille_display_private/braille_display_
private_api.h" | 5 #include "chrome/browser/extensions/api/braille_display_private/braille_display_
private_api.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 ~BrailleDisplayPrivateWriteDotsFunction() { | 166 ~BrailleDisplayPrivateWriteDotsFunction() { |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool BrailleDisplayPrivateWriteDotsFunction::Prepare() { | 169 bool BrailleDisplayPrivateWriteDotsFunction::Prepare() { |
| 170 params_ = WriteDots::Params::Create(*args_); | 170 params_ = WriteDots::Params::Create(*args_); |
| 171 EXTENSION_FUNCTION_VALIDATE(params_); | 171 EXTENSION_FUNCTION_VALIDATE(params_); |
| 172 return true; | 172 return true; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void BrailleDisplayPrivateWriteDotsFunction::Work() { | 175 void BrailleDisplayPrivateWriteDotsFunction::Work() { |
| 176 BrailleController::GetInstance()->WriteDots(params_->cells); | 176 std::vector<std::vector<char>> input; |
| 177 |
| 178 for (int i = 0; i < params_->rows; i++) { |
| 179 input.push_back(std::vector<char>(params_->columns)); |
| 180 for (int j = 0; j < params_->columns; j++) { |
| 181 input[i][j] = params_->cells[i * params_->columns + j]; |
| 182 } |
| 183 } |
| 184 BrailleController::GetInstance()->WriteDots(input); |
| 177 } | 185 } |
| 178 | 186 |
| 179 bool BrailleDisplayPrivateWriteDotsFunction::Respond() { | 187 bool BrailleDisplayPrivateWriteDotsFunction::Respond() { |
| 180 return true; | 188 return true; |
| 181 } | 189 } |
| 182 } // namespace api | 190 } // namespace api |
| 183 } // namespace extensions | 191 } // namespace extensions |
| OLD | NEW |