| 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/i18n/rtl.h" |
| 7 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 8 #include "base/task.h" | 9 #include "base/task.h" |
| 9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/background_contents_service.h" | 11 #include "chrome/browser/background_contents_service.h" |
| 11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/prerender/prerender_final_status.h" | 13 #include "chrome/browser/prerender/prerender_final_status.h" |
| 13 #include "chrome/browser/prerender/prerender_manager.h" | 14 #include "chrome/browser/prerender/prerender_manager.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/renderer_preferences_util.h" | 16 #include "chrome/browser/renderer_preferences_util.h" |
| 16 #include "chrome/browser/ui/login/login_prompt.h" | 17 #include "chrome/browser/ui/login/login_prompt.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 navigate_params_.reset(p); | 247 navigate_params_.reset(p); |
| 247 | 248 |
| 248 if (!AddAliasURL(params.url)) { | 249 if (!AddAliasURL(params.url)) { |
| 249 Destroy(FINAL_STATUS_HTTPS); | 250 Destroy(FINAL_STATUS_HTTPS); |
| 250 return; | 251 return; |
| 251 } | 252 } |
| 252 | 253 |
| 253 url_ = params.url; | 254 url_ = params.url; |
| 254 } | 255 } |
| 255 | 256 |
| 256 void PrerenderContents::UpdateTitle(RenderViewHost* render_view_host, | 257 void PrerenderContents::UpdateTitle( |
| 257 int32 page_id, | 258 RenderViewHost* render_view_host, |
| 258 const string16& title, | 259 int32 page_id, |
| 259 WebKit::WebTextDirection title_direction) { | 260 const base::i18n::StringWithDirection& title) { |
| 260 if (title.empty()) | 261 if (title.string.empty()) |
| 261 return; | 262 return; |
| 262 | 263 |
| 263 // TODO(evan): use directionality of title. | 264 // TODO(evan): use directionality of title. |
| 264 // http://code.google.com/p/chromium/issues/detail?id=27094 | 265 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 265 title_ = title; | 266 title_ = title.string; |
| 266 page_id_ = page_id; | 267 page_id_ = page_id; |
| 267 } | 268 } |
| 268 | 269 |
| 269 void PrerenderContents::RunJavaScriptMessage( | 270 void PrerenderContents::RunJavaScriptMessage( |
| 270 const std::wstring& message, | 271 const std::wstring& message, |
| 271 const std::wstring& default_prompt, | 272 const std::wstring& default_prompt, |
| 272 const GURL& frame_url, | 273 const GURL& frame_url, |
| 273 const int flags, | 274 const int flags, |
| 274 IPC::Message* reply_msg, | 275 IPC::Message* reply_msg, |
| 275 bool* did_suppress_message) { | 276 bool* did_suppress_message) { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 return; | 544 return; |
| 544 | 545 |
| 545 size_t private_bytes, shared_bytes; | 546 size_t private_bytes, shared_bytes; |
| 546 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { | 547 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { |
| 547 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) | 548 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) |
| 548 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); | 549 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); |
| 549 } | 550 } |
| 550 } | 551 } |
| 551 | 552 |
| 552 } // namespace prerender | 553 } // namespace prerender |
| OLD | NEW |