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

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

Issue 2642263002: Convert ChromeViewMsg_SetFieldTrialGroup to use mojo. (Closed)
Patch Set: Convert ChromeViewMsg_SetFieldTrialGroup to use mojo. Created 3 years, 11 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_thread_observer.h" 5 #include "chrome/renderer/chrome_render_thread_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 12 matching lines...) Expand all
23 #include "base/metrics/histogram.h" 23 #include "base/metrics/histogram.h"
24 #include "base/metrics/statistics_recorder.h" 24 #include "base/metrics/statistics_recorder.h"
25 #include "base/path_service.h" 25 #include "base/path_service.h"
26 #include "base/single_thread_task_runner.h" 26 #include "base/single_thread_task_runner.h"
27 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
28 #include "base/threading/platform_thread.h" 28 #include "base/threading/platform_thread.h"
29 #include "base/threading/thread_task_runner_handle.h" 29 #include "base/threading/thread_task_runner_handle.h"
30 #include "build/build_config.h" 30 #include "build/build_config.h"
31 #include "chrome/common/child_process_logging.h" 31 #include "chrome/common/child_process_logging.h"
32 #include "chrome/common/chrome_paths.h" 32 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/field_trial_recorder.mojom.h"
34 #include "chrome/common/media/media_resource_provider.h" 33 #include "chrome/common/media/media_resource_provider.h"
35 #include "chrome/common/net/net_resource_provider.h" 34 #include "chrome/common/net/net_resource_provider.h"
36 #include "chrome/common/render_messages.h" 35 #include "chrome/common/render_messages.h"
37 #include "chrome/common/resource_usage_reporter.mojom.h" 36 #include "chrome/common/resource_usage_reporter.mojom.h"
38 #include "chrome/common/resource_usage_reporter_type_converters.h" 37 #include "chrome/common/resource_usage_reporter_type_converters.h"
39 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
40 #include "chrome/renderer/content_settings_observer.h" 39 #include "chrome/renderer/content_settings_observer.h"
41 #include "chrome/renderer/security_filter_peer.h" 40 #include "chrome/renderer/security_filter_peer.h"
42 #include "components/visitedlink/renderer/visitedlink_slave.h" 41 #include "components/visitedlink/renderer/visitedlink_slave.h"
43 #include "content/public/child/resource_dispatcher_delegate.h" 42 #include "content/public/child/resource_dispatcher_delegate.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 &ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest, 280 &ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest,
282 base::Unretained(this))); 281 base::Unretained(this)));
283 } 282 }
284 283
285 void ChromeRenderThreadObserver::UnregisterMojoInterfaces( 284 void ChromeRenderThreadObserver::UnregisterMojoInterfaces(
286 content::AssociatedInterfaceRegistry* associated_interfaces) { 285 content::AssociatedInterfaceRegistry* associated_interfaces) {
287 associated_interfaces->RemoveInterface( 286 associated_interfaces->RemoveInterface(
288 chrome::mojom::RendererConfiguration::Name_); 287 chrome::mojom::RendererConfiguration::Name_);
289 } 288 }
290 289
291 bool ChromeRenderThreadObserver::OnControlMessageReceived(
292 const IPC::Message& message) {
293 bool handled = true;
294 IPC_BEGIN_MESSAGE_MAP(ChromeRenderThreadObserver, message)
295 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup)
296 IPC_MESSAGE_UNHANDLED(handled = false)
297 IPC_END_MESSAGE_MAP()
298 return handled;
299 }
300
301 void ChromeRenderThreadObserver::OnRenderProcessShutdown() { 290 void ChromeRenderThreadObserver::OnRenderProcessShutdown() {
302 visited_link_slave_.reset(); 291 visited_link_slave_.reset();
303 292
304 // Workaround for http://crbug.com/672646 293 // Workaround for http://crbug.com/672646
305 renderer_configuration_bindings_.CloseAllBindings(); 294 renderer_configuration_bindings_.CloseAllBindings();
306 } 295 }
307 296
308 void ChromeRenderThreadObserver::OnFieldTrialGroupFinalized( 297 void ChromeRenderThreadObserver::OnFieldTrialGroupFinalized(
309 const std::string& trial_name, 298 const std::string& trial_name,
310 const std::string& group_name) { 299 const std::string& group_name) {
311 chrome::mojom::FieldTrialRecorderPtr field_trial_recorder; 300 chrome::mojom::FieldTrialRecorderPtr field_trial_recorder;
312 content::RenderThread::Get()->GetRemoteInterfaces()->GetInterface( 301 content::RenderThread::Get()->GetRemoteInterfaces()->GetInterface(
313 &field_trial_recorder); 302 &field_trial_recorder);
314 field_trial_recorder->FieldTrialActivated(trial_name); 303 field_trial_recorder->FieldTrialActivated(trial_name);
315 } 304 }
316 305
317 void ChromeRenderThreadObserver::SetInitialConfiguration( 306 void ChromeRenderThreadObserver::SetInitialConfiguration(
318 bool is_incognito_process) { 307 bool is_incognito_process) {
319 is_incognito_process_ = is_incognito_process; 308 is_incognito_process_ = is_incognito_process;
320 } 309 }
321 310
322 void ChromeRenderThreadObserver::SetContentSettingRules( 311 void ChromeRenderThreadObserver::SetContentSettingRules(
323 const RendererContentSettingRules& rules) { 312 const RendererContentSettingRules& rules) {
324 content_setting_rules_ = rules; 313 content_setting_rules_ = rules;
325 } 314 }
326 315
316 void ChromeRenderThreadObserver::SetFieldTrialGroup(
317 const std::string& trial_name,
318 const std::string& group_name) {
319 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name);
320 }
321
327 void ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest( 322 void ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest(
328 chrome::mojom::RendererConfigurationAssociatedRequest request) { 323 chrome::mojom::RendererConfigurationAssociatedRequest request) {
329 renderer_configuration_bindings_.AddBinding(this, std::move(request)); 324 renderer_configuration_bindings_.AddBinding(this, std::move(request));
330 } 325 }
331 326
332 void ChromeRenderThreadObserver::OnSetFieldTrialGroup(
333 const std::string& trial_name,
334 const std::string& group_name) {
335 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name);
336 }
337
338 const RendererContentSettingRules* 327 const RendererContentSettingRules*
339 ChromeRenderThreadObserver::content_setting_rules() const { 328 ChromeRenderThreadObserver::content_setting_rules() const {
340 return &content_setting_rules_; 329 return &content_setting_rules_;
341 } 330 }
OLDNEW
« chrome/common/field_trial_recorder.mojom ('K') | « chrome/renderer/chrome_render_thread_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698