OLD | NEW |
1 // Copyright (c) 2011 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/themes/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 PRS_THEME_TOOLBAR, | 279 PRS_THEME_TOOLBAR, |
280 PRS_THEME_NTP_BACKGROUND, | 280 PRS_THEME_NTP_BACKGROUND, |
281 PRS_THEME_BUTTON_BACKGROUND, | 281 PRS_THEME_BUTTON_BACKGROUND, |
282 PRS_THEME_NTP_ATTRIBUTION, | 282 PRS_THEME_NTP_ATTRIBUTION, |
283 PRS_THEME_WINDOW_CONTROL_BACKGROUND | 283 PRS_THEME_WINDOW_CONTROL_BACKGROUND |
284 }; | 284 }; |
285 | 285 |
286 // Returns a piece of memory with the contents of the file |path|. | 286 // Returns a piece of memory with the contents of the file |path|. |
287 RefCountedMemory* ReadFileData(const FilePath& path) { | 287 RefCountedMemory* ReadFileData(const FilePath& path) { |
288 if (!path.empty()) { | 288 if (!path.empty()) { |
289 net::FileStream file; | 289 net::FileStream file(NULL); |
290 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; | 290 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; |
291 if (file.Open(path, flags) == net::OK) { | 291 if (file.Open(path, flags) == net::OK) { |
292 int64 avail = file.Available(); | 292 int64 avail = file.Available(); |
293 if (avail > 0 && avail < INT_MAX) { | 293 if (avail > 0 && avail < INT_MAX) { |
294 size_t size = static_cast<size_t>(avail); | 294 size_t size = static_cast<size_t>(avail); |
295 std::vector<unsigned char> raw_data; | 295 std::vector<unsigned char> raw_data; |
296 raw_data.resize(size); | 296 raw_data.resize(size); |
297 char* data = reinterpret_cast<char*>(&(raw_data.front())); | 297 char* data = reinterpret_cast<char*>(&(raw_data.front())); |
298 if (file.ReadUntilComplete(data, size) == avail) | 298 if (file.ReadUntilComplete(data, size) == avail) |
299 return RefCountedBytes::TakeVector(&raw_data); | 299 return RefCountedBytes::TakeVector(&raw_data); |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 hsl.h = tints_[i].h; | 1065 hsl.h = tints_[i].h; |
1066 hsl.s = tints_[i].s; | 1066 hsl.s = tints_[i].s; |
1067 hsl.l = tints_[i].l; | 1067 hsl.l = tints_[i].l; |
1068 return hsl; | 1068 return hsl; |
1069 } | 1069 } |
1070 } | 1070 } |
1071 } | 1071 } |
1072 | 1072 |
1073 return ThemeService::GetDefaultTint(id); | 1073 return ThemeService::GetDefaultTint(id); |
1074 } | 1074 } |
OLD | NEW |