Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1119)

Side by Side Diff: extensions/browser/computed_hashes.cc

Issue 2236443003: extensions: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add braces Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "extensions/browser/computed_hashes.h" 5 #include "extensions/browser/computed_hashes.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const char* block_start = contents.data() + offset; 177 const char* block_start = contents.data() + offset;
178 DCHECK(offset <= contents.size()); 178 DCHECK(offset <= contents.size());
179 size_t bytes_to_read = std::min(contents.size() - offset, block_size); 179 size_t bytes_to_read = std::min(contents.size() - offset, block_size);
180 std::unique_ptr<crypto::SecureHash> hash( 180 std::unique_ptr<crypto::SecureHash> hash(
181 crypto::SecureHash::Create(crypto::SecureHash::SHA256)); 181 crypto::SecureHash::Create(crypto::SecureHash::SHA256));
182 hash->Update(block_start, bytes_to_read); 182 hash->Update(block_start, bytes_to_read);
183 183
184 hashes->push_back(std::string()); 184 hashes->push_back(std::string());
185 std::string* buffer = &(hashes->back()); 185 std::string* buffer = &(hashes->back());
186 buffer->resize(crypto::kSHA256Length); 186 buffer->resize(crypto::kSHA256Length);
187 hash->Finish(string_as_array(buffer), buffer->size()); 187 hash->Finish(base::string_as_array(buffer), buffer->size());
188 188
189 // If |contents| is empty, then we want to just exit here. 189 // If |contents| is empty, then we want to just exit here.
190 if (bytes_to_read == 0) 190 if (bytes_to_read == 0)
191 break; 191 break;
192 192
193 offset += bytes_to_read; 193 offset += bytes_to_read;
194 } while (offset < contents.size()); 194 } while (offset < contents.size());
195 } 195 }
196 196
197 } // namespace extensions 197 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/app_window/app_window_geometry_cache.cc ('k') | extensions/browser/content_hash_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698