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 e7c862520374a63a4a930c9747f078b09084d658..3189466a56af924f3bfb5a37d3fa8599a4d5577c 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 |
@@ -4,9 +4,12 @@ |
#include "components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager.h" |
+#include <vector> |
+ |
#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" |
@@ -29,9 +32,12 @@ 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) { |
+ DCHECK(!app_locale.empty()); |
} |
DataReductionProxyDebugUIManager::~DataReductionProxyDebugUIManager() { |
@@ -68,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) { |
+ const BypassResource& resource = *iter; |
+ if (!resource.callback.is_null()) |
+ resource.callback.Run(proceed); |
+ } |
if (proceed) |
blocking_page_last_shown_ = base::Time::Now(); |
} |