| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/background_contents_service.h" | 10 #include "chrome/browser/background_contents_service.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 title_ = WideToUTF16Hack(title); | 213 title_ = WideToUTF16Hack(title); |
| 214 page_id_ = page_id; | 214 page_id_ = page_id; |
| 215 } | 215 } |
| 216 | 216 |
| 217 void PrerenderContents::RunJavaScriptMessage( | 217 void PrerenderContents::RunJavaScriptMessage( |
| 218 const std::wstring& message, | 218 const std::wstring& message, |
| 219 const std::wstring& default_prompt, | 219 const std::wstring& default_prompt, |
| 220 const GURL& frame_url, | 220 const GURL& frame_url, |
| 221 const int flags, | 221 const int flags, |
| 222 const bool unload_handler_being_run, |
| 222 IPC::Message* reply_msg, | 223 IPC::Message* reply_msg, |
| 223 bool* did_suppress_message) { | 224 bool* did_suppress_message) { |
| 224 // Always suppress JavaScript messages if they're triggered by a page being | 225 // Always suppress JavaScript messages if they're triggered by a page being |
| 225 // prerendered. | 226 // prerendered. |
| 226 *did_suppress_message = true; | 227 *did_suppress_message = true; |
| 227 // We still want to show the user the message when they navigate to this | 228 // We still want to show the user the message when they navigate to this |
| 228 // page, so cancel this prerender. | 229 // page, so cancel this prerender. |
| 229 Destroy(FINAL_STATUS_JAVASCRIPT_ALERT); | 230 Destroy(FINAL_STATUS_JAVASCRIPT_ALERT); |
| 230 } | 231 } |
| 231 | 232 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 return; | 463 return; |
| 463 | 464 |
| 464 size_t private_bytes, shared_bytes; | 465 size_t private_bytes, shared_bytes; |
| 465 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { | 466 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { |
| 466 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) | 467 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) |
| 467 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); | 468 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); |
| 468 } | 469 } |
| 469 } | 470 } |
| 470 | 471 |
| 471 } // namespace prerender | 472 } // namespace prerender |
| OLD | NEW |