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