Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Side by Side Diff: content/shell/renderer/shell_content_renderer_client.cc

Issue 1530393003: WIP: Move 'X-Frame-Options' checking to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/shell/renderer/shell_content_renderer_client.h" 5 #include "content/shell/renderer/shell_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h"
8 #include "components/web_cache/renderer/web_cache_render_process_observer.h" 10 #include "components/web_cache/renderer/web_cache_render_process_observer.h"
9 #include "content/public/renderer/render_thread.h" 11 #include "content/public/renderer/render_thread.h"
10 #include "content/shell/renderer/shell_render_view_observer.h" 12 #include "content/shell/renderer/shell_render_view_observer.h"
11 #include "third_party/WebKit/public/web/WebView.h" 13 #include "third_party/WebKit/public/web/WebView.h"
14 #include "third_party/WebKit/public/platform/WebURLError.h"
12 #include "v8/include/v8.h" 15 #include "v8/include/v8.h"
13 16
14 #if defined(ENABLE_PLUGINS) 17 #if defined(ENABLE_PLUGINS)
15 #include "ppapi/shared_impl/ppapi_switches.h" 18 #include "ppapi/shared_impl/ppapi_switches.h"
16 #endif 19 #endif
17 20
18 namespace content { 21 namespace content {
19 22
20 ShellContentRendererClient::ShellContentRendererClient() { 23 ShellContentRendererClient::ShellContentRendererClient() {
21 } 24 }
22 25
23 ShellContentRendererClient::~ShellContentRendererClient() { 26 ShellContentRendererClient::~ShellContentRendererClient() {
24 } 27 }
25 28
26 void ShellContentRendererClient::RenderThreadStarted() { 29 void ShellContentRendererClient::RenderThreadStarted() {
27 RenderThread* thread = RenderThread::Get(); 30 RenderThread* thread = RenderThread::Get();
28 web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver()); 31 web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver());
29 thread->AddObserver(web_cache_observer_.get()); 32 thread->AddObserver(web_cache_observer_.get());
30 } 33 }
31 34
32 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { 35 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) {
33 new ShellRenderViewObserver(render_view); 36 new ShellRenderViewObserver(render_view);
34 } 37 }
35 38
39 void ShellContentRendererClient::GetNavigationErrorStrings(
40 content::RenderFrame* render_frame,
41 const blink::WebURLRequest& failed_request,
42 const blink::WebURLError& error,
43 std::string* error_html,
44 base::string16* error_description) {
45 const GURL failed_url = error.unreachableURL;
46 if (error_html) {
47 *error_html = base::StringPrintf(
48 "<html><head><title>Error</title></head><body>"
49 "<h1>Error loading '%s'</h1><p>Reason code: '%d'</p></body></html>",
50 failed_url.spec().c_str(), error.reason);
51 }
52
53 if (error_description) {
54 *error_description = base::UTF8ToUTF16(base::StringPrintf("Reason: '%d'", er ror.reason));
55 }
56 }
57
36 bool ShellContentRendererClient::IsPluginAllowedToUseCompositorAPI( 58 bool ShellContentRendererClient::IsPluginAllowedToUseCompositorAPI(
37 const GURL& url) { 59 const GURL& url) {
38 #if defined(ENABLE_PLUGINS) 60 #if defined(ENABLE_PLUGINS)
39 return base::CommandLine::ForCurrentProcess()->HasSwitch( 61 return base::CommandLine::ForCurrentProcess()->HasSwitch(
40 switches::kEnablePepperTesting); 62 switches::kEnablePepperTesting);
41 #else 63 #else
42 return false; 64 return false;
43 #endif 65 #endif
44 } 66 }
45 67
46 bool ShellContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { 68 bool ShellContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() {
47 #if defined(ENABLE_PLUGINS) 69 #if defined(ENABLE_PLUGINS)
48 return base::CommandLine::ForCurrentProcess()->HasSwitch( 70 return base::CommandLine::ForCurrentProcess()->HasSwitch(
49 switches::kEnablePepperTesting); 71 switches::kEnablePepperTesting);
50 #else 72 #else
51 return false; 73 return false;
52 #endif 74 #endif
53 } 75 }
54 76
55 } // namespace content 77 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698