OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.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" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/string_util.h" |
12 #include "base/time.h" | 13 #include "base/time.h" |
13 #include "chrome/browser/autofill_manager.h" | 14 #include "chrome/browser/autofill_manager.h" |
14 #include "chrome/browser/blocked_popup_container.h" | 15 #include "chrome/browser/blocked_popup_container.h" |
15 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/cert_store.h" | 18 #include "chrome/browser/cert_store.h" |
18 #include "chrome/browser/character_encoding.h" | 19 #include "chrome/browser/character_encoding.h" |
19 #include "chrome/browser/debugger/devtools_manager.h" | 20 #include "chrome/browser/debugger/devtools_manager.h" |
20 #include "chrome/browser/dom_operation_notification_details.h" | 21 #include "chrome/browser/dom_operation_notification_details.h" |
21 #include "chrome/browser/dom_ui/dom_ui.h" | 22 #include "chrome/browser/dom_ui/dom_ui.h" |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 | 1651 |
1651 void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { | 1652 void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { |
1652 DCHECK(!plugin_path.value().empty()); | 1653 DCHECK(!plugin_path.value().empty()); |
1653 | 1654 |
1654 std::wstring plugin_name = plugin_path.ToWStringHack(); | 1655 std::wstring plugin_name = plugin_path.ToWStringHack(); |
1655 #if defined(OS_WIN) || defined(OS_MACOSX) | 1656 #if defined(OS_WIN) || defined(OS_MACOSX) |
1656 scoped_ptr<FileVersionInfo> version_info( | 1657 scoped_ptr<FileVersionInfo> version_info( |
1657 FileVersionInfo::CreateFileVersionInfo(plugin_path)); | 1658 FileVersionInfo::CreateFileVersionInfo(plugin_path)); |
1658 if (version_info.get()) { | 1659 if (version_info.get()) { |
1659 const std::wstring& product_name = version_info->product_name(); | 1660 const std::wstring& product_name = version_info->product_name(); |
1660 if (!product_name.empty()) | 1661 if (!product_name.empty()) { |
1661 plugin_name = product_name; | 1662 plugin_name = product_name; |
| 1663 #if defined(OS_MACOSX) |
| 1664 // Many plugins on the Mac have .plugin in the actual name, which looks |
| 1665 // terrible, so look for that and strip it off if present. |
| 1666 const std::wstring plugin_extension(L".plugin"); |
| 1667 if (EndsWith(plugin_name, plugin_extension, true)) |
| 1668 plugin_name.erase(plugin_name.length() - plugin_extension.length()); |
| 1669 #endif // OS_MACOSX |
| 1670 } |
1662 } | 1671 } |
1663 #else | 1672 #else |
1664 NOTIMPLEMENTED() << " convert plugin path to plugin name"; | 1673 NOTIMPLEMENTED() << " convert plugin path to plugin name"; |
1665 #endif | 1674 #endif |
1666 AddInfoBar(new SimpleAlertInfoBarDelegate( | 1675 AddInfoBar(new SimpleAlertInfoBarDelegate( |
1667 this, l10n_util::GetStringF(IDS_PLUGIN_CRASHED_PROMPT, plugin_name), | 1676 this, l10n_util::GetStringF(IDS_PLUGIN_CRASHED_PROMPT, plugin_name), |
1668 NULL)); | 1677 NULL)); |
1669 } | 1678 } |
1670 | 1679 |
1671 void TabContents::OnCrashedWorker() { | 1680 void TabContents::OnCrashedWorker() { |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 | 2502 |
2494 default: | 2503 default: |
2495 NOTREACHED(); | 2504 NOTREACHED(); |
2496 } | 2505 } |
2497 } | 2506 } |
2498 | 2507 |
2499 void TabContents::set_encoding(const std::wstring& encoding) { | 2508 void TabContents::set_encoding(const std::wstring& encoding) { |
2500 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2509 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
2501 } | 2510 } |
2502 | 2511 |
OLD | NEW |