| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 if (profile()->GetExtensionsService()) { | 304 if (profile()->GetExtensionsService()) { |
| 305 if (profile()->GetExtensionsService()->extensions()->size() > 0 || | 305 if (profile()->GetExtensionsService()->extensions()->size() > 0 || |
| 306 profile()->GetExtensionsService()->extensions_enabled()) | 306 profile()->GetExtensionsService()->extensions_enabled()) |
| 307 cmd_line.AppendSwitch(switches::kEnableExtensions); | 307 cmd_line.AppendSwitch(switches::kEnableExtensions); |
| 308 } | 308 } |
| 309 | 309 |
| 310 // Pass on the browser locale. | 310 // Pass on the browser locale. |
| 311 const std::string locale = g_browser_process->GetApplicationLocale(); | 311 const std::string locale = g_browser_process->GetApplicationLocale(); |
| 312 cmd_line.AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); | 312 cmd_line.AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); |
| 313 | 313 |
| 314 // If we run a FieldTrial that we want to pass to the renderer, this is where | 314 // If we run FieldTrials, we want to pass to their state to the renderer so |
| 315 // the SINGULAR trial name and value should be specified. Note that only one | 315 // that it can act in accordance with each state, or record histograms |
| 316 // such flag should be passed/set in the renderer command line. | 316 // relating to the FieldTrial states. |
| 317 | 317 std::string field_trial_states; |
| 318 // Today we're watching the impact of DNS on some page load times. | 318 FieldTrialList::StatesToString(&field_trial_states); |
| 319 FieldTrial* field_trial = FieldTrialList::Find("DnsImpact"); | 319 if (!field_trial_states.empty()) |
| 320 if (field_trial && (field_trial->group() != FieldTrial::kNotParticipating)) | |
| 321 cmd_line.AppendSwitchWithValue(switches::kForceFieldTestNameAndValue, | 320 cmd_line.AppendSwitchWithValue(switches::kForceFieldTestNameAndValue, |
| 322 ASCIIToWide(field_trial->MakePersistentString())); | 321 ASCIIToWide(field_trial_states)); |
| 323 | 322 |
| 324 #if defined(OS_POSIX) | 323 #if defined(OS_POSIX) |
| 325 const bool has_cmd_prefix = | 324 const bool has_cmd_prefix = |
| 326 browser_command_line.HasSwitch(switches::kRendererCmdPrefix); | 325 browser_command_line.HasSwitch(switches::kRendererCmdPrefix); |
| 327 if (has_cmd_prefix) { | 326 if (has_cmd_prefix) { |
| 328 // launch the renderer child with some prefix (usually "gdb --args") | 327 // launch the renderer child with some prefix (usually "gdb --args") |
| 329 const std::wstring prefix = | 328 const std::wstring prefix = |
| 330 browser_command_line.GetSwitchValue(switches::kRendererCmdPrefix); | 329 browser_command_line.GetSwitchValue(switches::kRendererCmdPrefix); |
| 331 cmd_line.PrependWrapper(prefix); | 330 cmd_line.PrependWrapper(prefix); |
| 332 } | 331 } |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 891 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
| 893 ems->AddEventListener(event_name, pid()); | 892 ems->AddEventListener(event_name, pid()); |
| 894 } | 893 } |
| 895 | 894 |
| 896 void BrowserRenderProcessHost::OnExtensionRemoveListener( | 895 void BrowserRenderProcessHost::OnExtensionRemoveListener( |
| 897 const std::string& event_name) { | 896 const std::string& event_name) { |
| 898 URLRequestContext* context = profile()->GetRequestContext(); | 897 URLRequestContext* context = profile()->GetRequestContext(); |
| 899 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 898 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
| 900 ems->RemoveEventListener(event_name, pid()); | 899 ems->RemoveEventListener(event_name, pid()); |
| 901 } | 900 } |
| OLD | NEW |