| 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 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 DCHECK(!plugin_path.empty()); | 1331 DCHECK(!plugin_path.empty()); |
| 1332 | 1332 |
| 1333 std::wstring plugin_name = plugin_path; | 1333 std::wstring plugin_name = plugin_path; |
| 1334 scoped_ptr<FileVersionInfo> version_info( | 1334 scoped_ptr<FileVersionInfo> version_info( |
| 1335 FileVersionInfo::CreateFileVersionInfo(plugin_path)); | 1335 FileVersionInfo::CreateFileVersionInfo(plugin_path)); |
| 1336 if (version_info.get()) { | 1336 if (version_info.get()) { |
| 1337 const std::wstring& product_name = version_info->product_name(); | 1337 const std::wstring& product_name = version_info->product_name(); |
| 1338 if (!product_name.empty()) | 1338 if (!product_name.empty()) |
| 1339 plugin_name = product_name; | 1339 plugin_name = product_name; |
| 1340 } | 1340 } |
| 1341 view_->DisplayErrorInInfoBar( | 1341 AddInfoBar(new SimpleAlertInfoBarDelegate( |
| 1342 l10n_util::GetStringF(IDS_PLUGIN_CRASHED_PROMPT, plugin_name)); | 1342 l10n_util::GetStringF(IDS_PLUGIN_CRASHED_PROMPT, plugin_name), NULL)); |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 void WebContents::OnJSOutOfMemory() { | 1345 void WebContents::OnJSOutOfMemory() { |
| 1346 view_->DisplayErrorInInfoBar( | 1346 AddInfoBar(new SimpleAlertInfoBarDelegate( |
| 1347 l10n_util::GetString(IDS_JS_OUT_OF_MEMORY_PROMPT)); | 1347 l10n_util::GetString(IDS_JS_OUT_OF_MEMORY_PROMPT), NULL)); |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 bool WebContents::CanBlur() const { | 1350 bool WebContents::CanBlur() const { |
| 1351 return delegate() ? delegate()->CanBlur() : true; | 1351 return delegate() ? delegate()->CanBlur() : true; |
| 1352 } | 1352 } |
| 1353 | 1353 |
| 1354 void WebContents::RendererUnresponsive(RenderViewHost* rvh, | 1354 void WebContents::RendererUnresponsive(RenderViewHost* rvh, |
| 1355 bool is_during_unload) { | 1355 bool is_during_unload) { |
| 1356 if (is_during_unload) { | 1356 if (is_during_unload) { |
| 1357 // Hang occurred while firing the beforeunload/unload handler. | 1357 // Hang occurred while firing the beforeunload/unload handler. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 } else if (*pref_name_in == prefs::kDefaultCharset || | 1470 } else if (*pref_name_in == prefs::kDefaultCharset || |
| 1471 StartsWithASCII(WideToUTF8(*pref_name_in), "webkit.webprefs.", true) | 1471 StartsWithASCII(WideToUTF8(*pref_name_in), "webkit.webprefs.", true) |
| 1472 ) { | 1472 ) { |
| 1473 UpdateWebPreferences(); | 1473 UpdateWebPreferences(); |
| 1474 } else { | 1474 } else { |
| 1475 NOTREACHED() << "unexpected pref change notification" << *pref_name_in; | 1475 NOTREACHED() << "unexpected pref change notification" << *pref_name_in; |
| 1476 } | 1476 } |
| 1477 break; | 1477 break; |
| 1478 } | 1478 } |
| 1479 default: { | 1479 default: { |
| 1480 NOTREACHED(); | 1480 TabContents::Observe(type, source, details); |
| 1481 break; | 1481 break; |
| 1482 } | 1482 } |
| 1483 } | 1483 } |
| 1484 } | 1484 } |
| 1485 | 1485 |
| 1486 void WebContents::DidNavigateMainFramePostCommit( | 1486 void WebContents::DidNavigateMainFramePostCommit( |
| 1487 const NavigationController::LoadCommittedDetails& details, | 1487 const NavigationController::LoadCommittedDetails& details, |
| 1488 const ViewHostMsg_FrameNavigate_Params& params) { | 1488 const ViewHostMsg_FrameNavigate_Params& params) { |
| 1489 // Hide the download shelf if all the following conditions are true: | 1489 // Hide the download shelf if all the following conditions are true: |
| 1490 // - there are no active downloads. | 1490 // - there are no active downloads. |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 // The favicon url isn't valid. This means there really isn't a favicon, | 1833 // The favicon url isn't valid. This means there really isn't a favicon, |
| 1834 // or the favicon url wasn't obtained before the load started. This assumes | 1834 // or the favicon url wasn't obtained before the load started. This assumes |
| 1835 // the later. | 1835 // the later. |
| 1836 // TODO(sky): Need a way to set the favicon that doesn't involve generating | 1836 // TODO(sky): Need a way to set the favicon that doesn't involve generating |
| 1837 // its url. | 1837 // its url. |
| 1838 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer)); | 1838 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer)); |
| 1839 } | 1839 } |
| 1840 new_url->set_safe_for_autoreplace(true); | 1840 new_url->set_safe_for_autoreplace(true); |
| 1841 url_model->Add(new_url); | 1841 url_model->Add(new_url); |
| 1842 } | 1842 } |
| OLD | NEW |