forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DataReductionProxy IPC to determine if the Data Reduction Proxy w…
…as used. The current mechanism is to create an instance of DataReductionProxyParams inside of page_load_histogram, and to then check the proxy server inside of DocumentState against DataReductionProxyParams. However, the plan is to make the configuration dynamic, so we can no longer use DataReductionProxyParams. BUG=452773 Review URL: https://codereview.chromium.org/966443002 Cr-Commit-Position: refs/heads/master@{#318917}
- Loading branch information
jeremyim
authored and
Commit bot
committed
Mar 3, 2015
1 parent
0171e3c
commit 364ac11
Showing
24 changed files
with
363 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include_rules = [ | ||
"+ipc", | ||
"+net", | ||
] |
54 changes: 54 additions & 0 deletions
54
components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.h" | ||
|
||
#include "components/data_reduction_proxy/content/common/data_reduction_proxy_messages.h" | ||
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" | ||
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" | ||
#include "content/public/browser/browser_thread.h" | ||
#include "ipc/ipc_message_macros.h" | ||
#include "net/base/host_port_pair.h" | ||
|
||
namespace data_reduction_proxy { | ||
|
||
DataReductionProxyMessageFilter::DataReductionProxyMessageFilter( | ||
DataReductionProxySettings* settings) | ||
: BrowserMessageFilter(DataReductionProxyStart), | ||
config_(nullptr) { | ||
DCHECK(settings); | ||
config_ = settings->Config(); | ||
} | ||
|
||
DataReductionProxyMessageFilter::~DataReductionProxyMessageFilter() { | ||
} | ||
|
||
bool DataReductionProxyMessageFilter::OnMessageReceived( | ||
const IPC::Message& message) { | ||
bool handled = true; | ||
IPC_BEGIN_MESSAGE_MAP(DataReductionProxyMessageFilter, message) | ||
IPC_MESSAGE_HANDLER(DataReductionProxyViewHostMsg_IsDataReductionProxy, | ||
OnIsDataReductionProxy) | ||
IPC_MESSAGE_UNHANDLED(handled = false) | ||
IPC_END_MESSAGE_MAP() | ||
return handled; | ||
} | ||
|
||
void DataReductionProxyMessageFilter::OverrideThreadForMessage( | ||
const IPC::Message& message, content::BrowserThread::ID* thread) { | ||
if (message.type() == | ||
DataReductionProxyViewHostMsg_IsDataReductionProxy::ID) { | ||
*thread = content::BrowserThread::IO; | ||
} | ||
} | ||
|
||
void DataReductionProxyMessageFilter::OnIsDataReductionProxy( | ||
const net::HostPortPair& proxy_server, bool* response) { | ||
if (config_) | ||
*response = config_->IsDataReductionProxy(proxy_server, nullptr); | ||
else | ||
*response = false; | ||
} | ||
|
||
} // namespace data_reduction_proxy |
Oops, something went wrong.