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

Side by Side Diff: chrome/app/chrome_main_delegate.cc

Issue 9623027: Move --user-agent overriding logic from chrome into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: replace SetContentClient() with Initialize() Created 8 years, 8 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 "chrome/app/chrome_main_delegate.h" 5 #include "chrome/app/chrome_main_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/plugin/chrome_content_plugin_client.h" 29 #include "chrome/plugin/chrome_content_plugin_client.h"
30 #include "chrome/renderer/chrome_content_renderer_client.h" 30 #include "chrome/renderer/chrome_content_renderer_client.h"
31 #include "chrome/utility/chrome_content_utility_client.h" 31 #include "chrome/utility/chrome_content_utility_client.h"
32 #include "content/common/content_counters.h" 32 #include "content/common/content_counters.h"
33 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
34 #include "content/public/common/content_client.h" 34 #include "content/public/common/content_client.h"
35 #include "content/public/common/content_paths.h" 35 #include "content/public/common/content_paths.h"
36 #include "content/public/common/content_switches.h" 36 #include "content/public/common/content_switches.h"
37 #include "ui/base/resource/resource_bundle.h" 37 #include "ui/base/resource/resource_bundle.h"
38 #include "ui/base/ui_base_switches.h" 38 #include "ui/base/ui_base_switches.h"
39 #include "webkit/glue/user_agent.h"
39 40
40 #if defined(OS_WIN) 41 #if defined(OS_WIN)
41 #include <algorithm> 42 #include <algorithm>
42 #include <atlbase.h> 43 #include <atlbase.h>
43 #include <malloc.h> 44 #include <malloc.h>
44 #include "base/string_util.h" 45 #include "base/string_util.h"
45 #include "base/win/registry.h" 46 #include "base/win/registry.h"
46 #include "chrome/browser/policy/policy_path_parser.h" 47 #include "chrome/browser/policy/policy_path_parser.h"
47 #include "policy/policy_constants.h" 48 #include "policy/policy_constants.h"
48 #include "sandbox/src/sandbox.h" 49 #include "sandbox/src/sandbox.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 if (IsCrashReporterEnabled()) 538 if (IsCrashReporterEnabled())
538 InitCrashProcessInfo(); 539 InitCrashProcessInfo();
539 } 540 }
540 #endif // defined(OS_MACOSX) 541 #endif // defined(OS_MACOSX)
541 542
542 void ChromeMainDelegate::PreSandboxStartup() { 543 void ChromeMainDelegate::PreSandboxStartup() {
543 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 544 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
544 std::string process_type = 545 std::string process_type =
545 command_line.GetSwitchValueASCII(switches::kProcessType); 546 command_line.GetSwitchValueASCII(switches::kProcessType);
546 547
548 // Construct our user agent string.
549 chrome::VersionInfo version_info;
550 std::string product("Chrome/");
551 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0";
552 std::string user_agent = webkit_glue::BuildUserAgentFromProduct(product);
scherkus (not reviewing) 2012/04/05 23:20:45 FYI this code was moved here instead of chrome_con
553
547 // Initialize the content client which that code uses to talk to Chrome. 554 // Initialize the content client which that code uses to talk to Chrome.
548 content::SetContentClient(&chrome_content_client_); 555 content::Initialize(&chrome_content_client_, user_agent);
549 InitializeChromeContentClient(process_type); 556 InitializeChromeContentClient(process_type);
Dirk Pranke 2012/04/05 23:35:54 Nit: does it make sense to change this to somethin
scherkus (not reviewing) 2012/04/05 23:58:33 Agreed but will wait to hear back on jam on which
550 557
551 // Initialize the Chrome path provider. 558 // Initialize the Chrome path provider.
552 chrome::RegisterPathProvider(); 559 chrome::RegisterPathProvider();
553 560
554 #if defined(OS_MACOSX) 561 #if defined(OS_MACOSX)
555 // On the Mac, the child executable lives at a predefined location within 562 // On the Mac, the child executable lives at a predefined location within
556 // the app bundle's versioned directory. 563 // the app bundle's versioned directory.
557 PathService::Override(content::CHILD_PROCESS_EXE, 564 PathService::Override(content::CHILD_PROCESS_EXE,
558 chrome::GetVersionedDirectory(). 565 chrome::GetVersionedDirectory().
559 Append(chrome::kHelperProcessExecutablePath)); 566 Append(chrome::kHelperProcessExecutablePath));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 743
737 #if defined(USE_LINUX_BREAKPAD) 744 #if defined(USE_LINUX_BREAKPAD)
738 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets 745 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets
739 // this up for the browser process in a different manner. 746 // this up for the browser process in a different manner.
740 InitCrashReporter(); 747 InitCrashReporter();
741 #endif 748 #endif
742 749
743 InitializeChromeContentClient(process_type); 750 InitializeChromeContentClient(process_type);
744 } 751 }
745 #endif // OS_MACOSX 752 #endif // OS_MACOSX
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_content_client.h » ('j') | chrome/test/base/chrome_test_suite.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698