| 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/shell/shell_content_browser_client.h" | 5 #include "content/shell/shell_content_browser_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "base/android/path_utils.h" | 27 #include "base/android/path_utils.h" |
| 28 #include "base/path_service.h" | 28 #include "base/path_service.h" |
| 29 #include "base/platform_file.h" | 29 #include "base/platform_file.h" |
| 30 #include "content/shell/android/shell_descriptors.h" | 30 #include "content/shell/android/shell_descriptors.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 namespace content { | 33 namespace content { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 FilePath GetWebKitRootDirFilePath() { | 37 base::FilePath GetWebKitRootDirFilePath() { |
| 38 FilePath base_path; | 38 base::FilePath base_path; |
| 39 PathService::Get(base::DIR_SOURCE_ROOT, &base_path); | 39 PathService::Get(base::DIR_SOURCE_ROOT, &base_path); |
| 40 if (file_util::PathExists( | 40 if (file_util::PathExists( |
| 41 base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { | 41 base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { |
| 42 // We're in a WebKit-in-chrome checkout. | 42 // We're in a WebKit-in-chrome checkout. |
| 43 return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")); | 43 return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")); |
| 44 } else if (file_util::PathExists( | 44 } else if (file_util::PathExists( |
| 45 base_path.Append(FILE_PATH_LITERAL("chromium")))) { | 45 base_path.Append(FILE_PATH_LITERAL("chromium")))) { |
| 46 // We're in a WebKit-only checkout on Windows. | 46 // We're in a WebKit-only checkout on Windows. |
| 47 return base_path.Append(FILE_PATH_LITERAL("../..")); | 47 return base_path.Append(FILE_PATH_LITERAL("../..")); |
| 48 } else if (file_util::PathExists( | 48 } else if (file_util::PathExists( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return true; | 128 return true; |
| 129 return WebKitTestController::Get()->CanOpenWindows(); | 129 return WebKitTestController::Get()->CanOpenWindows(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 #if defined(OS_ANDROID) | 132 #if defined(OS_ANDROID) |
| 133 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 133 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 134 const CommandLine& command_line, | 134 const CommandLine& command_line, |
| 135 int child_process_id, | 135 int child_process_id, |
| 136 std::vector<content::FileDescriptorInfo>* mappings) { | 136 std::vector<content::FileDescriptorInfo>* mappings) { |
| 137 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; | 137 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; |
| 138 FilePath pak_file; | 138 base::FilePath pak_file; |
| 139 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); | 139 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); |
| 140 CHECK(r); | 140 CHECK(r); |
| 141 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks")); | 141 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks")); |
| 142 pak_file = pak_file.Append(FILE_PATH_LITERAL("content_shell.pak")); | 142 pak_file = pak_file.Append(FILE_PATH_LITERAL("content_shell.pak")); |
| 143 | 143 |
| 144 base::PlatformFile f = | 144 base::PlatformFile f = |
| 145 base::CreatePlatformFile(pak_file, flags, NULL, NULL); | 145 base::CreatePlatformFile(pak_file, flags, NULL, NULL); |
| 146 if (f == base::kInvalidPlatformFileValue) { | 146 if (f == base::kInvalidPlatformFileValue) { |
| 147 NOTREACHED() << "Failed to open file when creating renderer process: " | 147 NOTREACHED() << "Failed to open file when creating renderer process: " |
| 148 << "content_shell.pak"; | 148 << "content_shell.pak"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 160 ShellBrowserContext* | 160 ShellBrowserContext* |
| 161 ShellContentBrowserClient::off_the_record_browser_context() { | 161 ShellContentBrowserClient::off_the_record_browser_context() { |
| 162 return shell_browser_main_parts_->off_the_record_browser_context(); | 162 return shell_browser_main_parts_->off_the_record_browser_context(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { | 165 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { |
| 166 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); | 166 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace content | 169 } // namespace content |
| OLD | NEW |