Chromium Code Reviews| Index: components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager.cc |
| diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager.cc |
| index c05247e00cd539ac7052bf859da363fbcbea767b..66a6c686aec455dcff9d449643958be4c52eb040 100644 |
| --- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager.cc |
| +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/bind.h" |
| #include "base/single_thread_task_runner.h" |
| #include "base/time/time.h" |
| +#include "components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -33,9 +34,11 @@ DataReductionProxyDebugUIManager::BypassResource::~BypassResource() { |
| DataReductionProxyDebugUIManager::DataReductionProxyDebugUIManager( |
| const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
| - const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
| + const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| + const std::string& app_locale) |
| : ui_task_runner_(ui_task_runner), |
| - io_task_runner_(io_task_runner) { |
| + io_task_runner_(io_task_runner), |
| + app_locale_(app_locale) { |
| } |
| DataReductionProxyDebugUIManager::~DataReductionProxyDebugUIManager() { |
| @@ -71,26 +74,34 @@ void DataReductionProxyDebugUIManager::DisplayBlockingPage( |
| if (IsTabClosed(resource)) { |
| // The tab is gone and there was not a chance to show the interstitial. |
| // Just act as if "Don't Proceed" were chosen. |
| + std::vector<BypassResource> resources; |
| + resources.push_back(resource); |
| io_task_runner_->PostTask( |
| FROM_HERE, |
| base::Bind(&DataReductionProxyDebugUIManager::OnBlockingPageDone, |
| - this, resource, false)); |
| + this, resources, false)); |
| return; |
| } |
| - // TODO(megjablon): Show blocking page. For now, continue on to the page. |
| - io_task_runner_->PostTask( |
| - FROM_HERE, |
| - base::Bind(&DataReductionProxyDebugUIManager::OnBlockingPageDone, |
| - this, resource, true)); |
| + ShowBlockingPage(resource); |
| +} |
| + |
| +void DataReductionProxyDebugUIManager::ShowBlockingPage( |
| + const BypassResource& resource) { |
| + DataReductionProxyDebugBlockingPage::ShowBlockingPage( |
| + this, io_task_runner_, resource, app_locale_); |
| } |
| void DataReductionProxyDebugUIManager::OnBlockingPageDone( |
| - const BypassResource& resource, |
| + const std::vector<BypassResource>& resources, |
| bool proceed) { |
| DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| - if (!resource.callback.is_null()) |
| - resource.callback.Run(proceed); |
| + for (std::vector<BypassResource>::const_iterator iter = resources.begin(); |
| + iter != resources.end(); ++iter) { |
|
bengr
2015/02/05 01:30:09
I'd indent one more.
megjablon
2015/02/13 01:48:08
Done.
|
| + const BypassResource& resource = *iter; |
| + if (!resource.callback.is_null()) |
| + resource.callback.Run(proceed); |
| + } |
| if (proceed) |
| blocking_page_last_shown_ = base::Time::Now(); |
| } |