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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 9349010: Move handling of debug urls like chrome://crash, chrome://gpuclean to content. These are for test... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; 318 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE;
319 } 319 }
320 320
321 static WebReferrerPolicy getReferrerPolicyFromRequest( 321 static WebReferrerPolicy getReferrerPolicyFromRequest(
322 const WebURLRequest& request) { 322 const WebURLRequest& request) {
323 return request.extraData() ? 323 return request.extraData() ?
324 static_cast<RequestExtraData*>(request.extraData())->referrer_policy() : 324 static_cast<RequestExtraData*>(request.extraData())->referrer_policy() :
325 WebKit::WebReferrerPolicyDefault; 325 WebKit::WebReferrerPolicyDefault;
326 } 326 }
327 327
328 static void MaybeHandleDebugURL(const GURL& url) {
329 if (!url.SchemeIs(chrome::kChromeUIScheme))
330 return;
331 if (url == GURL(chrome::kChromeUICrashURL)) {
332 // NOTE(shess): Crash directly rather than using NOTREACHED() so
333 // that the signature is easier to triage in crash reports.
334 volatile int* zero = NULL;
335 *zero = 0;
336
337 // Just in case the compiler decides the above is undefined and
338 // optimizes it away.
339 NOTREACHED();
340 } else if (url == GURL(chrome::kChromeUIKillURL)) {
341 base::KillProcess(base::GetCurrentProcessHandle(), 1, false);
342 } else if (url == GURL(chrome::kChromeUIHangURL)) {
343 for (;;) {
344 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
345 }
346 } else if (url == GURL(chrome::kChromeUIShorthangURL)) {
347 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20));
348 }
349 }
350
328 /////////////////////////////////////////////////////////////////////////////// 351 ///////////////////////////////////////////////////////////////////////////////
329 352
330 struct RenderViewImpl::PendingFileChooser { 353 struct RenderViewImpl::PendingFileChooser {
331 PendingFileChooser(const content::FileChooserParams& p, 354 PendingFileChooser(const content::FileChooserParams& p,
332 WebFileChooserCompletion* c) 355 WebFileChooserCompletion* c)
333 : params(p), 356 : params(p),
334 completion(c) { 357 completion(c) {
335 } 358 }
336 content::FileChooserParams params; 359 content::FileChooserParams params;
337 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. 360 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback.
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 if (!msg_is_ok) { 805 if (!msg_is_ok) {
783 // The message had a handler, but its deserialization failed. 806 // The message had a handler, but its deserialization failed.
784 // Kill the renderer to avoid potential spoofing attacks. 807 // Kill the renderer to avoid potential spoofing attacks.
785 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; 808 CHECK(false) << "Unable to deserialize message in RenderViewImpl.";
786 } 809 }
787 810
788 return handled; 811 return handled;
789 } 812 }
790 813
791 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { 814 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
815 MaybeHandleDebugURL(params.url);
792 if (!webview()) 816 if (!webview())
793 return; 817 return;
794 818
795 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); 819 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url));
796 820
797 bool is_reload = IsReload(params); 821 bool is_reload = IsReload(params);
798 822
799 // If this is a stale back/forward (due to a recent navigation the browser 823 // If this is a stale back/forward (due to a recent navigation the browser
800 // didn't know about), ignore it. 824 // didn't know about), ignore it.
801 if (IsBackForwardToStaleEntry(params, is_reload)) 825 if (IsBackForwardToStaleEntry(params, is_reload))
(...skipping 4190 matching lines...) Expand 10 before | Expand all | Expand 10 after
4992 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5016 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
4993 return !!RenderThreadImpl::current()->compositor_thread(); 5017 return !!RenderThreadImpl::current()->compositor_thread();
4994 } 5018 }
4995 5019
4996 void RenderViewImpl::OnJavaBridgeInit() { 5020 void RenderViewImpl::OnJavaBridgeInit() {
4997 DCHECK(!java_bridge_dispatcher_.get()); 5021 DCHECK(!java_bridge_dispatcher_.get());
4998 #if defined(ENABLE_JAVA_BRIDGE) 5022 #if defined(ENABLE_JAVA_BRIDGE)
4999 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); 5023 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this));
5000 #endif 5024 #endif
5001 } 5025 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698