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

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

Issue 2684093002: Rename JavaScript "messages" to "dialogs". (Closed)
Patch Set: win fox Created 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 controller ? controller->textInputInfo() : blink::WebTextInputInfo(); 2315 controller ? controller->textInputInfo() : blink::WebTextInputInfo();
2316 FormFieldData field; 2316 FormFieldData field;
2317 field.text = info.value.utf8(); 2317 field.text = info.value.utf8();
2318 field.placeholder = element.getAttribute("placeholder").utf8(); 2318 field.placeholder = element.getAttribute("placeholder").utf8();
2319 field.text_input_type = GetRenderWidget()->GetTextInputType(); 2319 field.text_input_type = GetRenderWidget()->GetTextInputType();
2320 2320
2321 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, 2321 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id,
2322 field)); 2322 field));
2323 } 2323 }
2324 2324
2325 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, 2325 bool RenderFrameImpl::RunJavaScriptDialog(JavaScriptDialogType type,
2326 const base::string16& message, 2326 const base::string16& message,
2327 const base::string16& default_value, 2327 const base::string16& default_value,
2328 const GURL& frame_url, 2328 const GURL& frame_url,
2329 base::string16* result) { 2329 base::string16* result) {
2330 // Don't allow further dialogs if we are waiting to swap out, since the 2330 // Don't allow further dialogs if we are waiting to swap out, since the
2331 // ScopedPageLoadDeferrer in our stack prevents it. 2331 // ScopedPageLoadDeferrer in our stack prevents it.
2332 if (suppress_further_dialogs_) 2332 if (suppress_further_dialogs_)
2333 return false; 2333 return false;
2334 2334
2335 int32_t message_length = static_cast<int32_t>(message.length()); 2335 int32_t message_length = static_cast<int32_t>(message.length());
2336 if (WebUserGestureIndicator::processedUserGestureSinceLoad(frame_)) { 2336 if (WebUserGestureIndicator::processedUserGestureSinceLoad(frame_)) {
2337 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.UserGestureSinceLoad", 2337 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.UserGestureSinceLoad",
2338 message_length); 2338 message_length);
2339 } else { 2339 } else {
2340 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.NoUserGestureSinceLoad", 2340 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.NoUserGestureSinceLoad",
2341 message_length); 2341 message_length);
2342 } 2342 }
2343 2343
2344 bool success = false; 2344 bool success = false;
2345 base::string16 result_temp; 2345 base::string16 result_temp;
2346 if (!result) 2346 if (!result)
2347 result = &result_temp; 2347 result = &result_temp;
2348 2348
2349 Send(new FrameHostMsg_RunJavaScriptMessage( 2349 Send(new FrameHostMsg_RunJavaScriptDialog(routing_id_, message, default_value,
2350 routing_id_, message, default_value, frame_url, type, &success, result)); 2350 frame_url, type, &success, result));
2351 return success; 2351 return success;
2352 } 2352 }
2353 2353
2354 bool RenderFrameImpl::ScheduleFileChooser( 2354 bool RenderFrameImpl::ScheduleFileChooser(
2355 const FileChooserParams& params, 2355 const FileChooserParams& params,
2356 blink::WebFileChooserCompletion* completion) { 2356 blink::WebFileChooserCompletion* completion) {
2357 static const size_t kMaximumPendingFileChooseRequests = 4; 2357 static const size_t kMaximumPendingFileChooseRequests = 4;
2358 2358
2359 // Do not open the file dialog in a hidden RenderFrame. 2359 // Do not open the file dialog in a hidden RenderFrame.
2360 if (IsHidden()) 2360 if (IsHidden())
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
4091 new RendererWebColorChooserImpl(this, client); 4091 new RendererWebColorChooserImpl(this, client);
4092 std::vector<ColorSuggestion> color_suggestions; 4092 std::vector<ColorSuggestion> color_suggestions;
4093 for (size_t i = 0; i < suggestions.size(); i++) { 4093 for (size_t i = 0; i < suggestions.size(); i++) {
4094 color_suggestions.push_back(ColorSuggestion(suggestions[i])); 4094 color_suggestions.push_back(ColorSuggestion(suggestions[i]));
4095 } 4095 }
4096 color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions); 4096 color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions);
4097 return color_chooser; 4097 return color_chooser;
4098 } 4098 }
4099 4099
4100 void RenderFrameImpl::runModalAlertDialog(const blink::WebString& message) { 4100 void RenderFrameImpl::runModalAlertDialog(const blink::WebString& message) {
4101 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, message.utf16(), 4101 RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_ALERT, message.utf16(),
4102 base::string16(), frame_->document().url(), NULL); 4102 base::string16(), frame_->document().url(), NULL);
4103 } 4103 }
4104 4104
4105 bool RenderFrameImpl::runModalConfirmDialog(const blink::WebString& message) { 4105 bool RenderFrameImpl::runModalConfirmDialog(const blink::WebString& message) {
4106 return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, message.utf16(), 4106 return RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_CONFIRM, message.utf16(),
4107 base::string16(), frame_->document().url(), NULL); 4107 base::string16(), frame_->document().url(), NULL);
4108 } 4108 }
4109 4109
4110 bool RenderFrameImpl::runModalPromptDialog( 4110 bool RenderFrameImpl::runModalPromptDialog(
4111 const blink::WebString& message, 4111 const blink::WebString& message,
4112 const blink::WebString& default_value, 4112 const blink::WebString& default_value,
4113 blink::WebString* actual_value) { 4113 blink::WebString* actual_value) {
4114 base::string16 result; 4114 base::string16 result;
4115 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, 4115 bool ok = RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_PROMPT, message.utf16(),
4116 message.utf16(), default_value.utf16(), 4116 default_value.utf16(), frame_->document().url(),
4117 frame_->document().url(), &result); 4117 &result);
4118 if (ok) 4118 if (ok)
4119 actual_value->assign(WebString::fromUTF16(result)); 4119 actual_value->assign(WebString::fromUTF16(result));
4120 return ok; 4120 return ok;
4121 } 4121 }
4122 4122
4123 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) { 4123 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) {
4124 // Don't allow further dialogs if we are waiting to swap out, since the 4124 // Don't allow further dialogs if we are waiting to swap out, since the
4125 // ScopedPageLoadDeferrer in our stack prevents it. 4125 // ScopedPageLoadDeferrer in our stack prevents it.
4126 if (suppress_further_dialogs_) 4126 if (suppress_further_dialogs_)
4127 return false; 4127 return false;
4128 4128
4129 bool success = false; 4129 bool success = false;
4130 // This is an ignored return value, but is included so we can accept the same 4130 // This is an ignored return value, but is included so we can accept the same
4131 // response as RunJavaScriptMessage. 4131 // response as RunJavaScriptDialog.
4132 base::string16 ignored_result; 4132 base::string16 ignored_result;
4133 Send(new FrameHostMsg_RunBeforeUnloadConfirm( 4133 Send(new FrameHostMsg_RunBeforeUnloadConfirm(
4134 routing_id_, frame_->document().url(), is_reload, &success, 4134 routing_id_, frame_->document().url(), is_reload, &success,
4135 &ignored_result)); 4135 &ignored_result));
4136 return success; 4136 return success;
4137 } 4137 }
4138 4138
4139 bool RenderFrameImpl::runFileChooser( 4139 bool RenderFrameImpl::runFileChooser(
4140 const blink::WebFileChooserParams& params, 4140 const blink::WebFileChooserParams& params,
4141 blink::WebFileChooserCompletion* chooser_completion) { 4141 blink::WebFileChooserCompletion* chooser_completion) {
(...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after
6828 // event target. Potentially a Pepper plugin will receive the event. 6828 // event target. Potentially a Pepper plugin will receive the event.
6829 // In order to tell whether a plugin gets the last mouse event and which it 6829 // In order to tell whether a plugin gets the last mouse event and which it
6830 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6830 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6831 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6831 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6832 // |pepper_last_mouse_event_target_|. 6832 // |pepper_last_mouse_event_target_|.
6833 pepper_last_mouse_event_target_ = nullptr; 6833 pepper_last_mouse_event_target_ = nullptr;
6834 #endif 6834 #endif
6835 } 6835 }
6836 6836
6837 } // namespace content 6837 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698