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

Side by Side Diff: content/app/content_main_runner.cc

Issue 186883002: Move user_agent code from webkit/ to content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 "content/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 23 matching lines...) Expand all
34 #include "content/public/app/startup_helper_win.h" 34 #include "content/public/app/startup_helper_win.h"
35 #include "content/public/browser/content_browser_client.h" 35 #include "content/public/browser/content_browser_client.h"
36 #include "content/public/browser/render_process_host.h" 36 #include "content/public/browser/render_process_host.h"
37 #include "content/public/browser/utility_process_host.h" 37 #include "content/public/browser/utility_process_host.h"
38 #include "content/public/common/content_client.h" 38 #include "content/public/common/content_client.h"
39 #include "content/public/common/content_constants.h" 39 #include "content/public/common/content_constants.h"
40 #include "content/public/common/content_paths.h" 40 #include "content/public/common/content_paths.h"
41 #include "content/public/common/content_switches.h" 41 #include "content/public/common/content_switches.h"
42 #include "content/public/common/main_function_params.h" 42 #include "content/public/common/main_function_params.h"
43 #include "content/public/common/sandbox_init.h" 43 #include "content/public/common/sandbox_init.h"
44 #include "content/public/common/user_agent.h"
44 #include "content/renderer/in_process_renderer_thread.h" 45 #include "content/renderer/in_process_renderer_thread.h"
45 #include "content/utility/in_process_utility_thread.h" 46 #include "content/utility/in_process_utility_thread.h"
46 #include "crypto/nss_util.h" 47 #include "crypto/nss_util.h"
47 #include "ipc/ipc_switches.h" 48 #include "ipc/ipc_switches.h"
48 #include "media/base/media.h" 49 #include "media/base/media.h"
49 #include "sandbox/win/src/sandbox_types.h" 50 #include "sandbox/win/src/sandbox_types.h"
50 #include "ui/base/ui_base_paths.h" 51 #include "ui/base/ui_base_paths.h"
51 #include "ui/base/ui_base_switches.h" 52 #include "ui/base/ui_base_switches.h"
52 #include "ui/gfx/win/dpi.h" 53 #include "ui/gfx/win/dpi.h"
53 #include "webkit/common/user_agent/user_agent.h"
54 54
55 #if defined(USE_TCMALLOC) 55 #if defined(USE_TCMALLOC)
56 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" 56 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h"
57 #if defined(TYPE_PROFILING) 57 #if defined(TYPE_PROFILING)
58 #include "base/allocator/type_profiler.h" 58 #include "base/allocator/type_profiler.h"
59 #include "base/allocator/type_profiler_tcmalloc.h" 59 #include "base/allocator/type_profiler_tcmalloc.h"
60 #endif 60 #endif
61 #endif 61 #endif
62 62
63 #if !defined(OS_IOS) 63 #if !defined(OS_IOS)
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // line so update it here with the new version. 376 // line so update it here with the new version.
377 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 377 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
378 std::string process_type = 378 std::string process_type =
379 command_line.GetSwitchValueASCII(switches::kProcessType); 379 command_line.GetSwitchValueASCII(switches::kProcessType);
380 ContentClientInitializer::Set(process_type, delegate); 380 ContentClientInitializer::Set(process_type, delegate);
381 381
382 // If a custom user agent was passed on the command line, we need 382 // If a custom user agent was passed on the command line, we need
383 // to (re)set it now, rather than using the default one the zygote 383 // to (re)set it now, rather than using the default one the zygote
384 // initialized. 384 // initialized.
385 if (command_line.HasSwitch(switches::kUserAgent)) { 385 if (command_line.HasSwitch(switches::kUserAgent)) {
386 webkit_glue::SetUserAgent( 386 SetUserAgent(command_line.GetSwitchValueASCII(switches::kUserAgent), true);
387 command_line.GetSwitchValueASCII(switches::kUserAgent), true);
388 } 387 }
389 388
390 // The StatsTable must be initialized in each process; we already 389 // The StatsTable must be initialized in each process; we already
391 // initialized for the browser process, now we need to initialize 390 // initialized for the browser process, now we need to initialize
392 // within the new processes as well. 391 // within the new processes as well.
393 InitializeStatsTable(command_line); 392 InitializeStatsTable(command_line);
394 393
395 MainFunctionParams main_params(command_line); 394 MainFunctionParams main_params(command_line);
396 395
397 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { 396 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) {
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 RegisterContentSchemes(true); 734 RegisterContentSchemes(true);
736 735
737 CHECK(base::i18n::InitializeICU()); 736 CHECK(base::i18n::InitializeICU());
738 737
739 InitializeStatsTable(command_line); 738 InitializeStatsTable(command_line);
740 739
741 if (delegate) 740 if (delegate)
742 delegate->PreSandboxStartup(); 741 delegate->PreSandboxStartup();
743 742
744 // Set any custom user agent passed on the command line now so the string 743 // Set any custom user agent passed on the command line now so the string
745 // doesn't change between calls to webkit_glue::GetUserAgent(), otherwise it 744 // doesn't change between calls to GetUserAgent(), otherwise it
746 // defaults to the user agent set during SetContentClient(). 745 // defaults to the user agent set during SetContentClient().
747 if (command_line.HasSwitch(switches::kUserAgent)) { 746 if (command_line.HasSwitch(switches::kUserAgent)) {
748 webkit_glue::SetUserAgent( 747 SetUserAgent(command_line.GetSwitchValueASCII(switches::kUserAgent),
749 command_line.GetSwitchValueASCII(switches::kUserAgent), true); 748 true);
750 } 749 }
751 750
752 if (!process_type.empty()) 751 if (!process_type.empty())
753 CommonSubprocessInit(process_type); 752 CommonSubprocessInit(process_type);
754 753
755 #if defined(OS_WIN) 754 #if defined(OS_WIN)
756 CHECK(InitializeSandbox(sandbox_info)); 755 CHECK(InitializeSandbox(sandbox_info));
757 #elif defined(OS_MACOSX) && !defined(OS_IOS) 756 #elif defined(OS_MACOSX) && !defined(OS_IOS)
758 if (process_type == switches::kRendererProcess || 757 if (process_type == switches::kRendererProcess ||
759 process_type == switches::kPpapiPluginProcess || 758 process_type == switches::kPpapiPluginProcess ||
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 851
853 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 852 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
854 }; 853 };
855 854
856 // static 855 // static
857 ContentMainRunner* ContentMainRunner::Create() { 856 ContentMainRunner* ContentMainRunner::Create() {
858 return new ContentMainRunnerImpl(); 857 return new ContentMainRunnerImpl();
859 } 858 }
860 859
861 } // namespace content 860 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698