Assume the foo_test_run depends on everything needed to run the test.
[chromium-blink-merge.git] / content / renderer / renderer_webapplicationcachehost_impl.cc
blob8aeee8a960eab76081dd0cdcd1ed4ef03d5c6733
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
3 // found in the LICENSE file.
5 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
7 #include "content/common/view_messages.h"
8 #include "content/renderer/render_thread_impl.h"
9 #include "content/renderer/render_view_impl.h"
10 #include "third_party/WebKit/public/web/WebFrame.h"
11 #include "third_party/WebKit/public/web/WebView.h"
13 using appcache::AppCacheBackend;
14 using blink::WebApplicationCacheHostClient;
15 using blink::WebConsoleMessage;
17 namespace content {
19 RendererWebApplicationCacheHostImpl::RendererWebApplicationCacheHostImpl(
20 RenderViewImpl* render_view,
21 WebApplicationCacheHostClient* client,
22 AppCacheBackend* backend)
23 : WebApplicationCacheHostImpl(client, backend),
24 routing_id_(render_view->routing_id()) {
27 void RendererWebApplicationCacheHostImpl::OnLogMessage(
28 appcache::LogLevel log_level, const std::string& message) {
29 if (RenderThreadImpl::current()->layout_test_mode())
30 return;
32 RenderViewImpl* render_view = GetRenderView();
33 if (!render_view || !render_view->webview() ||
34 !render_view->webview()->mainFrame())
35 return;
37 blink::WebFrame* frame = render_view->webview()->mainFrame();
38 frame->addMessageToConsole(WebConsoleMessage(
39 static_cast<WebConsoleMessage::Level>(log_level),
40 blink::WebString::fromUTF8(message.c_str())));
43 void RendererWebApplicationCacheHostImpl::OnContentBlocked(
44 const GURL& manifest_url) {
45 RenderThreadImpl::current()->Send(new ViewHostMsg_AppCacheAccessed(
46 routing_id_, manifest_url, true));
49 void RendererWebApplicationCacheHostImpl::OnCacheSelected(
50 const appcache::AppCacheInfo& info) {
51 if (!info.manifest_url.is_empty()) {
52 RenderThreadImpl::current()->Send(new ViewHostMsg_AppCacheAccessed(
53 routing_id_, info.manifest_url, false));
55 WebApplicationCacheHostImpl::OnCacheSelected(info);
58 RenderViewImpl* RendererWebApplicationCacheHostImpl::GetRenderView() {
59 return RenderViewImpl::FromRoutingID(routing_id_);
62 } // namespace content