Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 197018: Strip .plugin off of Mac plugin names when showing the crash info bar. (Closed)
Patch Set: Add a test with the match in the middle Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« base/string_util_unittest.cc ('K') | « base/string_util_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 083296c37f5f1d29a77cb867233181607590e9f9..c76b733c7531c7124d0f9f47e80ce1c7e59b48f4 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -9,6 +9,7 @@
#include "base/file_version_info.h"
#include "base/process_util.h"
#include "base/string16.h"
+#include "base/string_util.h"
#include "base/time.h"
#include "chrome/browser/autofill_manager.h"
#include "chrome/browser/blocked_popup_container.h"
@@ -1657,8 +1658,16 @@ void TabContents::OnCrashedPlugin(const FilePath& plugin_path) {
FileVersionInfo::CreateFileVersionInfo(plugin_path));
if (version_info.get()) {
const std::wstring& product_name = version_info->product_name();
- if (!product_name.empty())
+ if (!product_name.empty()) {
plugin_name = product_name;
+#if defined(OS_MACOSX)
+ // Many plugins on the Mac have .plugin in the actual name, which looks
+ // terrible, so look for that and strip it off if present.
+ const std::wstring plugin_extension(L".plugin");
+ if (EndsWith(plugin_name, plugin_extension, true))
+ plugin_name.erase(plugin_name.length() - plugin_extension.length());
+#endif // OS_MACOSX
+ }
}
#else
NOTIMPLEMENTED() << " convert plugin path to plugin name";
« base/string_util_unittest.cc ('K') | « base/string_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698