OLD | NEW |
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/browser/renderer_host/chrome_render_message_filter.h" | 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/metrics/field_trial.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/content_settings/cookie_settings.h" | 14 #include "chrome/browser/content_settings/cookie_settings.h" |
14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
15 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 16 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
16 #include "chrome/browser/net/predictor.h" | 17 #include "chrome/browser/net/predictor.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/common/render_messages.h" | 20 #include "chrome/common/render_messages.h" |
20 #include "components/dns_prefetch/common/prefetch_common.h" | 21 #include "components/dns_prefetch/common/prefetch_common.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 IPC_MESSAGE_HANDLER_DELAY_REPLY( | 78 IPC_MESSAGE_HANDLER_DELAY_REPLY( |
78 ChromeViewHostMsg_RequestFileSystemAccessSync, | 79 ChromeViewHostMsg_RequestFileSystemAccessSync, |
79 OnRequestFileSystemAccessSync) | 80 OnRequestFileSystemAccessSync) |
80 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessAsync, | 81 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessAsync, |
81 OnRequestFileSystemAccessAsync) | 82 OnRequestFileSystemAccessAsync) |
82 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB) | 83 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB) |
83 #if defined(ENABLE_PLUGINS) | 84 #if defined(ENABLE_PLUGINS) |
84 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_IsCrashReportingEnabled, | 85 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_IsCrashReportingEnabled, |
85 OnIsCrashReportingEnabled) | 86 OnIsCrashReportingEnabled) |
86 #endif | 87 #endif |
| 88 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FieldTrialActivated, |
| 89 OnFieldTrialActivated) |
87 IPC_MESSAGE_UNHANDLED(handled = false) | 90 IPC_MESSAGE_UNHANDLED(handled = false) |
88 IPC_END_MESSAGE_MAP() | 91 IPC_END_MESSAGE_MAP() |
89 | 92 |
90 return handled; | 93 return handled; |
91 } | 94 } |
92 | 95 |
93 void ChromeRenderMessageFilter::OverrideThreadForMessage( | 96 void ChromeRenderMessageFilter::OverrideThreadForMessage( |
94 const IPC::Message& message, BrowserThread::ID* thread) { | 97 const IPC::Message& message, BrowserThread::ID* thread) { |
95 switch (message.type()) { | 98 switch (message.type()) { |
96 case ChromeViewHostMsg_ResourceTypeStats::ID: | 99 case ChromeViewHostMsg_ResourceTypeStats::ID: |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 base::Bind(&TabSpecificContentSettings::IndexedDBAccessed, | 359 base::Bind(&TabSpecificContentSettings::IndexedDBAccessed, |
357 render_process_id_, render_frame_id, origin_url, name, | 360 render_process_id_, render_frame_id, origin_url, name, |
358 !*allowed)); | 361 !*allowed)); |
359 } | 362 } |
360 | 363 |
361 #if defined(ENABLE_PLUGINS) | 364 #if defined(ENABLE_PLUGINS) |
362 void ChromeRenderMessageFilter::OnIsCrashReportingEnabled(bool* enabled) { | 365 void ChromeRenderMessageFilter::OnIsCrashReportingEnabled(bool* enabled) { |
363 *enabled = ChromeMetricsServiceAccessor::IsCrashReportingEnabled(); | 366 *enabled = ChromeMetricsServiceAccessor::IsCrashReportingEnabled(); |
364 } | 367 } |
365 #endif | 368 #endif |
| 369 |
| 370 void ChromeRenderMessageFilter::OnFieldTrialActivated( |
| 371 const std::string& trial_name) { |
| 372 // Activate the trial in the browser process to match its state in the |
| 373 // renderer. This is done by calling FindFullName which finalizes the group |
| 374 // and activates the trial. |
| 375 base::FieldTrialList::FindFullName(trial_name); |
| 376 } |
OLD | NEW |