OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #include "grit/locale_settings.h" | 103 #include "grit/locale_settings.h" |
104 #include "grit/platform_locale_settings.h" | 104 #include "grit/platform_locale_settings.h" |
105 #include "grit/theme_resources.h" | 105 #include "grit/theme_resources.h" |
106 #include "net/base/mime_util.h" | 106 #include "net/base/mime_util.h" |
107 #include "net/base/net_errors.h" | 107 #include "net/base/net_errors.h" |
108 #include "net/base/net_util.h" | 108 #include "net/base/net_util.h" |
109 #include "net/base/registry_controlled_domain.h" | 109 #include "net/base/registry_controlled_domain.h" |
110 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 110 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
111 #include "webkit/glue/webpreferences.h" | 111 #include "webkit/glue/webpreferences.h" |
112 #include "webkit/glue/password_form.h" | 112 #include "webkit/glue/password_form.h" |
113 #include "webkit/glue/plugins/plugin_list.h" | |
114 | 113 |
115 // Cross-Site Navigations | 114 // Cross-Site Navigations |
116 // | 115 // |
117 // If a TabContents is told to navigate to a different web site (as determined | 116 // If a TabContents is told to navigate to a different web site (as determined |
118 // by SiteInstance), it will replace its current RenderViewHost with a new | 117 // by SiteInstance), it will replace its current RenderViewHost with a new |
119 // RenderViewHost dedicated to the new SiteInstance. This works as follows: | 118 // RenderViewHost dedicated to the new SiteInstance. This works as follows: |
120 // | 119 // |
121 // - Navigate determines whether the destination is cross-site, and if so, | 120 // - Navigate determines whether the destination is cross-site, and if so, |
122 // it creates a pending_render_view_host_ and moves into the PENDING | 121 // it creates a pending_render_view_host_ and moves into the PENDING |
123 // RendererState. | 122 // RendererState. |
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 #if defined(OS_WIN) | 2019 #if defined(OS_WIN) |
2021 // TODO(PORT): pull in when plug-ins work | 2020 // TODO(PORT): pull in when plug-ins work |
2022 GetPluginInstaller()->OnMissingPluginStatus(status); | 2021 GetPluginInstaller()->OnMissingPluginStatus(status); |
2023 #endif | 2022 #endif |
2024 } | 2023 } |
2025 | 2024 |
2026 void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { | 2025 void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { |
2027 DCHECK(!plugin_path.value().empty()); | 2026 DCHECK(!plugin_path.value().empty()); |
2028 | 2027 |
2029 std::wstring plugin_name = plugin_path.ToWStringHack(); | 2028 std::wstring plugin_name = plugin_path.ToWStringHack(); |
2030 WebPluginInfo plugin_info; | 2029 #if defined(OS_WIN) || defined(OS_MACOSX) |
2031 if (NPAPI::PluginList::Singleton()->GetPluginInfoByPath( | 2030 scoped_ptr<FileVersionInfo> version_info( |
2032 plugin_path, &plugin_info) && | 2031 FileVersionInfo::CreateFileVersionInfo(plugin_path)); |
2033 !plugin_info.name.empty()) { | 2032 if (version_info.get()) { |
2034 plugin_name = UTF16ToWide(plugin_info.name); | 2033 const std::wstring& product_name = version_info->product_name(); |
| 2034 if (!product_name.empty()) { |
| 2035 plugin_name = product_name; |
2035 #if defined(OS_MACOSX) | 2036 #if defined(OS_MACOSX) |
2036 // Many plugins on the Mac have .plugin in the actual name, which looks | 2037 // Many plugins on the Mac have .plugin in the actual name, which looks |
2037 // terrible, so look for that and strip it off if present. | 2038 // terrible, so look for that and strip it off if present. |
2038 const std::wstring plugin_extension(L".plugin"); | 2039 const std::wstring plugin_extension(L".plugin"); |
2039 if (EndsWith(plugin_name, plugin_extension, true)) | 2040 if (EndsWith(plugin_name, plugin_extension, true)) |
2040 plugin_name.erase(plugin_name.length() - plugin_extension.length()); | 2041 plugin_name.erase(plugin_name.length() - plugin_extension.length()); |
2041 #endif // OS_MACOSX | 2042 #endif // OS_MACOSX |
| 2043 } |
2042 } | 2044 } |
| 2045 #else |
| 2046 NOTIMPLEMENTED() << " convert plugin path to plugin name"; |
| 2047 #endif |
2043 SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( | 2048 SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( |
2044 IDR_INFOBAR_PLUGIN_CRASHED); | 2049 IDR_INFOBAR_PLUGIN_CRASHED); |
2045 AddInfoBar(new SimpleAlertInfoBarDelegate( | 2050 AddInfoBar(new SimpleAlertInfoBarDelegate( |
2046 this, l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, | 2051 this, l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, |
2047 WideToUTF16Hack(plugin_name)), | 2052 WideToUTF16Hack(plugin_name)), |
2048 crash_icon, true)); | 2053 crash_icon, true)); |
2049 } | 2054 } |
2050 | 2055 |
2051 void TabContents::OnCrashedWorker() { | 2056 void TabContents::OnCrashedWorker() { |
2052 AddInfoBar(new SimpleAlertInfoBarDelegate( | 2057 AddInfoBar(new SimpleAlertInfoBarDelegate( |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3320 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
3316 } | 3321 } |
3317 | 3322 |
3318 Profile* TabContents::GetProfileForPasswordManager() { | 3323 Profile* TabContents::GetProfileForPasswordManager() { |
3319 return profile(); | 3324 return profile(); |
3320 } | 3325 } |
3321 | 3326 |
3322 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3327 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
3323 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3328 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
3324 } | 3329 } |
OLD | NEW |