Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: chrome/renderer/chrome_render_process_observer.cc

Issue 799643004: Combine PDF plugin into the Chromium binary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/renderer/chrome_render_process_observer.h" 5 #include "chrome/renderer/chrome_render_process_observer.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/allocator/allocator_extension.h" 10 #include "base/allocator/allocator_extension.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/metrics/statistics_recorder.h" 18 #include "base/metrics/statistics_recorder.h"
19 #include "base/native_library.h" 19 #include "base/native_library.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/threading/platform_thread.h" 22 #include "base/threading/platform_thread.h"
23 #include "chrome/common/child_process_logging.h" 23 #include "chrome/common/child_process_logging.h"
24 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/net/net_resource_provider.h" 26 #include "chrome/common/net/net_resource_provider.h"
27 #include "chrome/common/render_messages.h" 27 #include "chrome/common/render_messages.h"
28 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
29 #include "chrome/common/variations/variations_util.h" 29 #include "chrome/common/variations/variations_util.h"
30 #include "chrome/installer/util/util_constants.h"
30 #include "chrome/renderer/content_settings_observer.h" 31 #include "chrome/renderer/content_settings_observer.h"
31 #include "chrome/renderer/security_filter_peer.h" 32 #include "chrome/renderer/security_filter_peer.h"
32 #include "content/public/child/resource_dispatcher_delegate.h" 33 #include "content/public/child/resource_dispatcher_delegate.h"
33 #include "content/public/renderer/render_thread.h" 34 #include "content/public/renderer/render_thread.h"
34 #include "content/public/renderer/render_view.h" 35 #include "content/public/renderer/render_view.h"
35 #include "content/public/renderer/render_view_visitor.h" 36 #include "content/public/renderer/render_view_visitor.h"
36 #include "crypto/nss_util.h" 37 #include "crypto/nss_util.h"
37 #include "net/base/net_errors.h" 38 #include "net/base/net_errors.h"
38 #include "net/base/net_module.h" 39 #include "net/base/net_module.h"
39 #include "third_party/WebKit/public/web/WebCache.h" 40 #include "third_party/WebKit/public/web/WebCache.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); 279 thread->SetResourceDispatcherDelegate(resource_delegate_.get());
279 280
280 // Configure modules that need access to resources. 281 // Configure modules that need access to resources.
281 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); 282 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);
282 283
283 #if defined(OS_WIN) 284 #if defined(OS_WIN)
284 // TODO(scottmg): http://crbug.com/448473. This code should be removed once 285 // TODO(scottmg): http://crbug.com/448473. This code should be removed once
285 // PDF is always OOP and/or PDF is made to use Skia instead of GDI directly. 286 // PDF is always OOP and/or PDF is made to use Skia instead of GDI directly.
286 if (!command_line.HasSwitch(switches::kEnableOutOfProcessPdf)) { 287 if (!command_line.HasSwitch(switches::kEnableOutOfProcessPdf)) {
287 // Need to patch a few functions for font loading to work correctly. 288 // Need to patch a few functions for font loading to work correctly.
288 base::FilePath pdf; 289 const wchar_t* chrome_dll_name =
289 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && 290 #if defined(CHROME_MULTIPLE_DLL_CHILD)
290 base::PathExists(pdf)) { 291 installer::kChromeChildDll;
291 g_iat_patch_createdca.Patch(pdf.value().c_str(), "gdi32.dll", "CreateDCA", 292 #else
292 CreateDCAPatch); 293 installer::kChromeDll;
293 g_iat_patch_get_font_data.Patch(pdf.value().c_str(), "gdi32.dll", 294 #endif
294 "GetFontData", GetFontDataPatch); 295
295 } 296 g_iat_patch_createdca.Patch(chrome_dll_name, "gdi32.dll", "CreateDCA",
297 CreateDCAPatch);
298 g_iat_patch_get_font_data.Patch(chrome_dll_name, "gdi32.dll",
299 "GetFontData", GetFontDataPatch);
296 } 300 }
297 #endif 301 #endif
298 302
299 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS) 303 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS)
300 // On platforms where we use system NSS shared libraries, 304 // On platforms where we use system NSS shared libraries,
301 // initialize NSS now because it won't be able to load the .so's 305 // initialize NSS now because it won't be able to load the .so's
302 // after we engage the sandbox. 306 // after we engage the sandbox.
303 if (!command_line.HasSwitch(switches::kSingleProcess)) 307 if (!command_line.HasSwitch(switches::kSingleProcess))
304 crypto::InitNSSSafely(); 308 crypto::InitNSSSafely();
305 #elif defined(OS_WIN) 309 #elif defined(OS_WIN)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ChromeRenderProcessObserver::content_setting_rules() const { 395 ChromeRenderProcessObserver::content_setting_rules() const {
392 return &content_setting_rules_; 396 return &content_setting_rules_;
393 } 397 }
394 398
395 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( 399 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized(
396 const std::string& trial_name, 400 const std::string& trial_name,
397 const std::string& group_name) { 401 const std::string& group_name) {
398 content::RenderThread::Get()->Send( 402 content::RenderThread::Get()->Send(
399 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); 403 new ChromeViewHostMsg_FieldTrialActivated(trial_name));
400 } 404 }
OLDNEW
« chrome/renderer/DEPS ('K') | « chrome/renderer/DEPS ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698