| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/web_contents.h" | 5 #include "chrome/browser/web_contents.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 if (!select_file_dialog_.get()) | 1060 if (!select_file_dialog_.get()) |
| 1061 select_file_dialog_ = SelectFileDialog::Create(this); | 1061 select_file_dialog_ = SelectFileDialog::Create(this); |
| 1062 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, L"", | 1062 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, L"", |
| 1063 default_file, toplevel_hwnd, NULL); | 1063 default_file, toplevel_hwnd, NULL); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 void WebContents::RunJavaScriptMessage( | 1066 void WebContents::RunJavaScriptMessage( |
| 1067 const std::wstring& message, | 1067 const std::wstring& message, |
| 1068 const std::wstring& default_prompt, | 1068 const std::wstring& default_prompt, |
| 1069 const int flags, | 1069 const int flags, |
| 1070 IPC::Message* reply_msg) { | 1070 IPC::Message* reply_msg, |
| 1071 bool* did_suppress_message) { |
| 1071 // Suppress javascript messages when requested and when inside a constrained | 1072 // Suppress javascript messages when requested and when inside a constrained |
| 1072 // popup window (because that activates them and breaks them out of the | 1073 // popup window (because that activates them and breaks them out of the |
| 1073 // constrained window jail). | 1074 // constrained window jail). |
| 1074 bool suppress_this_message = suppress_javascript_messages_; | 1075 bool suppress_this_message = suppress_javascript_messages_; |
| 1075 if (delegate()) | 1076 if (delegate()) |
| 1076 suppress_this_message |= delegate()->IsPopup(this); | 1077 suppress_this_message |= delegate()->IsPopup(this); |
| 1077 | 1078 |
| 1079 *did_suppress_message = suppress_this_message; |
| 1080 |
| 1078 if (!suppress_this_message) { | 1081 if (!suppress_this_message) { |
| 1079 TimeDelta time_since_last_message( | 1082 TimeDelta time_since_last_message( |
| 1080 TimeTicks::Now() - last_javascript_message_dismissal_); | 1083 TimeTicks::Now() - last_javascript_message_dismissal_); |
| 1081 bool show_suppress_checkbox = false; | 1084 bool show_suppress_checkbox = false; |
| 1082 // Show a checkbox offering to suppress further messages if this message is | 1085 // Show a checkbox offering to suppress further messages if this message is |
| 1083 // being displayed within kJavascriptMessageExpectedDelay of the last one. | 1086 // being displayed within kJavascriptMessageExpectedDelay of the last one. |
| 1084 if (time_since_last_message < | 1087 if (time_since_last_message < |
| 1085 TimeDelta::FromMilliseconds(kJavascriptMessageExpectedDelay)) | 1088 TimeDelta::FromMilliseconds(kJavascriptMessageExpectedDelay)) |
| 1086 show_suppress_checkbox = true; | 1089 show_suppress_checkbox = true; |
| 1087 | 1090 |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 // The favicon url isn't valid. This means there really isn't a favicon, | 1818 // The favicon url isn't valid. This means there really isn't a favicon, |
| 1816 // or the favicon url wasn't obtained before the load started. This assumes | 1819 // or the favicon url wasn't obtained before the load started. This assumes |
| 1817 // the later. | 1820 // the later. |
| 1818 // TODO(sky): Need a way to set the favicon that doesn't involve generating | 1821 // TODO(sky): Need a way to set the favicon that doesn't involve generating |
| 1819 // its url. | 1822 // its url. |
| 1820 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer)); | 1823 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer)); |
| 1821 } | 1824 } |
| 1822 new_url->set_safe_for_autoreplace(true); | 1825 new_url->set_safe_for_autoreplace(true); |
| 1823 url_model->Add(new_url); | 1826 url_model->Add(new_url); |
| 1824 } | 1827 } |
| OLD | NEW |