OLD | NEW |
1 // Copyright (c) 2012 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 "content/test/test_content_client.h" | 5 #include "content/test/test_content_client.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/path_service.h" | 12 #include "base/path_service.h" |
11 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
12 #include "build/build_config.h" | 14 #include "build/build_config.h" |
13 | 15 |
14 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
15 #include "base/android/apk_assets.h" | 17 #include "base/android/apk_assets.h" |
16 #endif | 18 #endif |
(...skipping 15 matching lines...) Expand all Loading... |
32 | 34 |
33 // on Android all pak files are inside the paks folder. | 35 // on Android all pak files are inside the paks folder. |
34 PathService::Get(base::DIR_ANDROID_APP_DATA, &content_shell_pack_path); | 36 PathService::Get(base::DIR_ANDROID_APP_DATA, &content_shell_pack_path); |
35 content_shell_pack_path = content_shell_pack_path.Append( | 37 content_shell_pack_path = content_shell_pack_path.Append( |
36 FILE_PATH_LITERAL("paks")); | 38 FILE_PATH_LITERAL("paks")); |
37 #else | 39 #else |
38 PathService::Get(base::DIR_MODULE, &content_shell_pack_path); | 40 PathService::Get(base::DIR_MODULE, &content_shell_pack_path); |
39 #endif // defined(OS_ANDROID) | 41 #endif // defined(OS_ANDROID) |
40 | 42 |
41 if (pak_file.IsValid()) { | 43 if (pak_file.IsValid()) { |
42 data_pack_.LoadFromFileRegion(pak_file.Pass(), pak_region); | 44 data_pack_.LoadFromFileRegion(std::move(pak_file), pak_region); |
43 } else { | 45 } else { |
44 content_shell_pack_path = content_shell_pack_path.Append( | 46 content_shell_pack_path = content_shell_pack_path.Append( |
45 FILE_PATH_LITERAL("content_shell.pak")); | 47 FILE_PATH_LITERAL("content_shell.pak")); |
46 data_pack_.LoadFromPath(content_shell_pack_path); | 48 data_pack_.LoadFromPath(content_shell_pack_path); |
47 } | 49 } |
48 #endif // !defined(OS_IOS) | 50 #endif // !defined(OS_IOS) |
49 } | 51 } |
50 | 52 |
51 TestContentClient::~TestContentClient() { | 53 TestContentClient::~TestContentClient() { |
52 } | 54 } |
53 | 55 |
54 std::string TestContentClient::GetUserAgent() const { | 56 std::string TestContentClient::GetUserAgent() const { |
55 return std::string("TestContentClient"); | 57 return std::string("TestContentClient"); |
56 } | 58 } |
57 | 59 |
58 base::StringPiece TestContentClient::GetDataResource( | 60 base::StringPiece TestContentClient::GetDataResource( |
59 int resource_id, | 61 int resource_id, |
60 ui::ScaleFactor scale_factor) const { | 62 ui::ScaleFactor scale_factor) const { |
61 base::StringPiece resource; | 63 base::StringPiece resource; |
62 data_pack_.GetStringPiece(resource_id, &resource); | 64 data_pack_.GetStringPiece(resource_id, &resource); |
63 return resource; | 65 return resource; |
64 } | 66 } |
65 | 67 |
66 } // namespace content | 68 } // namespace content |
OLD | NEW |