OLD | NEW |
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 "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" | 5 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" |
6 | 6 |
7 #include "chrome/browser/browser_shutdown.h" | 7 #include "chrome/browser/browser_shutdown.h" |
8 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 8 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/browser/web_contents_view.h" | 10 #include "content/public/browser/web_contents_view.h" |
11 #include "ui/base/text/text_elider.h" | 11 #include "ui/base/text/text_elider.h" |
12 | 12 |
13 #if defined(USE_AURA) | 13 #if defined(USE_AURA) |
14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
15 #endif | 15 #endif |
16 | 16 |
17 using content::JavaScriptDialogCreator; | 17 using content::JavaScriptDialogManager; |
18 using content::WebContents; | 18 using content::WebContents; |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Control maximum sizes of various texts passed to us from javascript. | 22 // Control maximum sizes of various texts passed to us from javascript. |
23 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 23 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
24 // Two-dimensional eliding. Reformat the text of the message dialog | 24 // Two-dimensional eliding. Reformat the text of the message dialog |
25 // inserting line breaks because otherwise a single long line can overflow | 25 // inserting line breaks because otherwise a single long line can overflow |
26 // the message dialog (and crash/hang the GTK, depending on the version). | 26 // the message dialog (and crash/hang the GTK, depending on the version). |
27 const int kMessageTextMaxRows = 32; | 27 const int kMessageTextMaxRows = 32; |
(...skipping 30 matching lines...) Expand all Loading... |
58 JavaScriptAppModalDialog::JavaScriptAppModalDialog( | 58 JavaScriptAppModalDialog::JavaScriptAppModalDialog( |
59 WebContents* web_contents, | 59 WebContents* web_contents, |
60 ChromeJavaScriptDialogExtraData* extra_data, | 60 ChromeJavaScriptDialogExtraData* extra_data, |
61 const string16& title, | 61 const string16& title, |
62 content::JavaScriptMessageType javascript_message_type, | 62 content::JavaScriptMessageType javascript_message_type, |
63 const string16& message_text, | 63 const string16& message_text, |
64 const string16& default_prompt_text, | 64 const string16& default_prompt_text, |
65 bool display_suppress_checkbox, | 65 bool display_suppress_checkbox, |
66 bool is_before_unload_dialog, | 66 bool is_before_unload_dialog, |
67 bool is_reload, | 67 bool is_reload, |
68 const JavaScriptDialogCreator::DialogClosedCallback& callback) | 68 const JavaScriptDialogManager::DialogClosedCallback& callback) |
69 : AppModalDialog(web_contents, title), | 69 : AppModalDialog(web_contents, title), |
70 extra_data_(extra_data), | 70 extra_data_(extra_data), |
71 javascript_message_type_(javascript_message_type), | 71 javascript_message_type_(javascript_message_type), |
72 display_suppress_checkbox_(display_suppress_checkbox), | 72 display_suppress_checkbox_(display_suppress_checkbox), |
73 is_before_unload_dialog_(is_before_unload_dialog), | 73 is_before_unload_dialog_(is_before_unload_dialog), |
74 is_reload_(is_reload), | 74 is_reload_(is_reload), |
75 callback_(callback), | 75 callback_(callback), |
76 use_override_prompt_text_(false) { | 76 use_override_prompt_text_(false) { |
77 EnforceMaxTextSize(message_text, &message_text_); | 77 EnforceMaxTextSize(message_text, &message_text_); |
78 EnforceMaxPromptSize(default_prompt_text, &default_prompt_text_); | 78 EnforceMaxPromptSize(default_prompt_text, &default_prompt_text_); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 callback_.Run(success, user_input); | 156 callback_.Run(success, user_input); |
157 | 157 |
158 extra_data_->last_javascript_message_dismissal_ = base::TimeTicks::Now(); | 158 extra_data_->last_javascript_message_dismissal_ = base::TimeTicks::Now(); |
159 extra_data_->suppress_javascript_messages_ = suppress_js_messages; | 159 extra_data_->suppress_javascript_messages_ = suppress_js_messages; |
160 | 160 |
161 // On Views, we can end up coming through this code path twice :(. | 161 // On Views, we can end up coming through this code path twice :(. |
162 // See crbug.com/63732. | 162 // See crbug.com/63732. |
163 valid_ = false; | 163 valid_ = false; |
164 } | 164 } |
OLD | NEW |