OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/font_service/font_service_app.h" | 5 #include "components/font_service/font_service_app.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "mojo/application/public/cpp/application_connection.h" | 9 #include "mojo/application/public/cpp/application_connection.h" |
10 #include "mojo/platform_handle/platform_handle_functions.h" | 10 #include "mojo/platform_handle/platform_handle_functions.h" |
11 | 11 |
12 static_assert(static_cast<uint32>(SkTypeface::kNormal) == | 12 static_assert(static_cast<uint32_t>(SkTypeface::kNormal) == |
13 static_cast<uint32>(font_service::TYPEFACE_STYLE_NORMAL), | 13 static_cast<uint32_t>(font_service::TYPEFACE_STYLE_NORMAL), |
14 "Skia and font service flags must match"); | 14 "Skia and font service flags must match"); |
15 static_assert(static_cast<uint32>(SkTypeface::kBold) == | 15 static_assert(static_cast<uint32_t>(SkTypeface::kBold) == |
16 static_cast<uint32>(font_service::TYPEFACE_STYLE_BOLD), | 16 static_cast<uint32_t>(font_service::TYPEFACE_STYLE_BOLD), |
17 "Skia and font service flags must match"); | 17 "Skia and font service flags must match"); |
18 static_assert(static_cast<uint32>(SkTypeface::kItalic) == | 18 static_assert(static_cast<uint32_t>(SkTypeface::kItalic) == |
19 static_cast<uint32>(font_service::TYPEFACE_STYLE_ITALIC), | 19 static_cast<uint32_t>(font_service::TYPEFACE_STYLE_ITALIC), |
20 "Skia and font service flags must match"); | 20 "Skia and font service flags must match"); |
21 static_assert(static_cast<uint32>(SkTypeface::kBoldItalic) == | 21 static_assert( |
22 static_cast<uint32>(font_service::TYPEFACE_STYLE_BOLD_ITALIC), | 22 static_cast<uint32_t>(SkTypeface::kBoldItalic) == |
23 "Skia and font service flags must match"); | 23 static_cast<uint32_t>(font_service::TYPEFACE_STYLE_BOLD_ITALIC), |
| 24 "Skia and font service flags must match"); |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 mojo::ScopedHandle GetHandleForPath(const base::FilePath& path) { | 28 mojo::ScopedHandle GetHandleForPath(const base::FilePath& path) { |
28 if (path.empty()) | 29 if (path.empty()) |
29 return mojo::ScopedHandle(); | 30 return mojo::ScopedHandle(); |
30 | 31 |
31 mojo::ScopedHandle to_pass; | 32 mojo::ScopedHandle to_pass; |
32 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); | 33 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); |
33 if (!file.IsValid()) { | 34 if (!file.IsValid()) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 int count = paths_.count(); | 116 int count = paths_.count(); |
116 for (int i = 0; i < count; ++i) { | 117 for (int i = 0; i < count; ++i) { |
117 if (path == *paths_[i]) | 118 if (path == *paths_[i]) |
118 return i; | 119 return i; |
119 } | 120 } |
120 *paths_.append() = new SkString(path); | 121 *paths_.append() = new SkString(path); |
121 return count; | 122 return count; |
122 } | 123 } |
123 | 124 |
124 } // namespace font_service | 125 } // namespace font_service |
OLD | NEW |