| 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/app/shell_main_delegate.h" | 5 #include "content/shell/app/shell_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/platform_file.h" | |
| 16 #include "cc/base/switches.h" | 15 #include "cc/base/switches.h" |
| 17 #include "content/public/browser/browser_main_runner.h" | 16 #include "content/public/browser/browser_main_runner.h" |
| 18 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 19 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
| 20 #include "content/public/test/layouttest_support.h" | 19 #include "content/public/test/layouttest_support.h" |
| 21 #include "content/shell/app/shell_breakpad_client.h" | 20 #include "content/shell/app/shell_breakpad_client.h" |
| 22 #include "content/shell/app/webkit_test_platform_support.h" | 21 #include "content/shell/app/webkit_test_platform_support.h" |
| 23 #include "content/shell/browser/shell_browser_main.h" | 22 #include "content/shell/browser/shell_browser_main.h" |
| 24 #include "content/shell/browser/shell_content_browser_client.h" | 23 #include "content/shell/browser/shell_content_browser_client.h" |
| 25 #include "content/shell/common/shell_switches.h" | 24 #include "content/shell/common/shell_switches.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 255 } |
| 257 #endif | 256 #endif |
| 258 | 257 |
| 259 void ShellMainDelegate::InitializeResourceBundle() { | 258 void ShellMainDelegate::InitializeResourceBundle() { |
| 260 #if defined(OS_ANDROID) | 259 #if defined(OS_ANDROID) |
| 261 // In the Android case, the renderer runs with a different UID and can never | 260 // In the Android case, the renderer runs with a different UID and can never |
| 262 // access the file system. So we are passed a file descriptor to the | 261 // access the file system. So we are passed a file descriptor to the |
| 263 // ResourceBundle pak at launch time. | 262 // ResourceBundle pak at launch time. |
| 264 int pak_fd = | 263 int pak_fd = |
| 265 base::GlobalDescriptors::GetInstance()->MaybeGet(kShellPakDescriptor); | 264 base::GlobalDescriptors::GetInstance()->MaybeGet(kShellPakDescriptor); |
| 266 if (pak_fd != base::kInvalidPlatformFileValue) { | 265 if (pak_fd >= 0) { |
| 266 // This is clearly wrong. See crbug.com/330930 |
| 267 ui::ResourceBundle::InitSharedInstanceWithPakFile(base::File(pak_fd), | 267 ui::ResourceBundle::InitSharedInstanceWithPakFile(base::File(pak_fd), |
| 268 false); | 268 false); |
| 269 ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 269 ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
| 270 base::File(pak_fd), ui::SCALE_FACTOR_100P); | 270 base::File(pak_fd), ui::SCALE_FACTOR_100P); |
| 271 return; | 271 return; |
| 272 } | 272 } |
| 273 #endif | 273 #endif |
| 274 | 274 |
| 275 base::FilePath pak_file; | 275 base::FilePath pak_file; |
| 276 #if defined(OS_MACOSX) | 276 #if defined(OS_MACOSX) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 295 browser_client_.reset(new ShellContentBrowserClient); | 295 browser_client_.reset(new ShellContentBrowserClient); |
| 296 return browser_client_.get(); | 296 return browser_client_.get(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { | 299 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { |
| 300 renderer_client_.reset(new ShellContentRendererClient); | 300 renderer_client_.reset(new ShellContentRendererClient); |
| 301 return renderer_client_.get(); | 301 return renderer_client_.get(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace content | 304 } // namespace content |
| OLD | NEW |