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

Side by Side Diff: content/browser/webui/web_ui_message_handler.cc

Issue 2099563002: WebUI: DisallowJavascript only on Refresh and non-same-page navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix style Created 4 years, 5 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
« no previous file with comments | « content/browser/webui/web_ui_impl.cc ('k') | content/public/browser/web_ui_message_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/public/browser/web_ui_message_handler.h" 5 #include "content/public/browser/web_ui_message_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 base::string16 WebUIMessageHandler::ExtractStringValue( 67 base::string16 WebUIMessageHandler::ExtractStringValue(
68 const base::ListValue* value) { 68 const base::ListValue* value) {
69 base::string16 string16_value; 69 base::string16 string16_value;
70 if (value->GetString(0, &string16_value)) 70 if (value->GetString(0, &string16_value))
71 return string16_value; 71 return string16_value;
72 NOTREACHED(); 72 NOTREACHED();
73 return base::string16(); 73 return base::string16();
74 } 74 }
75 75
76 void WebUIMessageHandler::RenderViewReused() {
77 DisallowJavascript();
78 }
79
80 void WebUIMessageHandler::ResolveJavascriptCallback( 76 void WebUIMessageHandler::ResolveJavascriptCallback(
81 const base::Value& callback_id, 77 const base::Value& callback_id,
82 const base::Value& response) { 78 const base::Value& response) {
83 // cr.webUIResponse is a global JS function exposed from cr.js. 79 // cr.webUIResponse is a global JS function exposed from cr.js.
84 CallJavascriptFunction("cr.webUIResponse", callback_id, 80 CallJavascriptFunction("cr.webUIResponse", callback_id,
85 base::FundamentalValue(true), response); 81 base::FundamentalValue(true), response);
86 } 82 }
87 83
88 void WebUIMessageHandler::RejectJavascriptCallback( 84 void WebUIMessageHandler::RejectJavascriptCallback(
89 const base::Value& callback_id, 85 const base::Value& callback_id,
90 const base::Value& response) { 86 const base::Value& response) {
91 // cr.webUIResponse is a global JS function exposed from cr.js. 87 // cr.webUIResponse is a global JS function exposed from cr.js.
92 CallJavascriptFunction("cr.webUIResponse", callback_id, 88 CallJavascriptFunction("cr.webUIResponse", callback_id,
93 base::FundamentalValue(false), response); 89 base::FundamentalValue(false), response);
94 } 90 }
95 91
96 } // namespace content 92 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_impl.cc ('k') | content/public/browser/web_ui_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698