OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 #include "chrome/browser/ui/browser_window.h" | 111 #include "chrome/browser/ui/browser_window.h" |
112 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 112 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
113 #include "chrome/browser/ui/extensions/shell_window.h" | 113 #include "chrome/browser/ui/extensions/shell_window.h" |
114 #include "chrome/browser/ui/find_bar/find_bar.h" | 114 #include "chrome/browser/ui/find_bar/find_bar.h" |
115 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 115 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
116 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 116 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
117 #include "chrome/browser/ui/fullscreen_controller.h" | 117 #include "chrome/browser/ui/fullscreen_controller.h" |
118 #include "chrome/browser/ui/global_error.h" | 118 #include "chrome/browser/ui/global_error.h" |
119 #include "chrome/browser/ui/global_error_service.h" | 119 #include "chrome/browser/ui/global_error_service.h" |
120 #include "chrome/browser/ui/global_error_service_factory.h" | 120 #include "chrome/browser/ui/global_error_service_factory.h" |
| 121 #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
121 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 122 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
122 #include "chrome/browser/ui/omnibox/location_bar.h" | 123 #include "chrome/browser/ui/omnibox/location_bar.h" |
123 #include "chrome/browser/ui/panels/panel.h" | 124 #include "chrome/browser/ui/panels/panel.h" |
124 #include "chrome/browser/ui/panels/panel_manager.h" | 125 #include "chrome/browser/ui/panels/panel_manager.h" |
125 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 126 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
126 #include "chrome/browser/ui/status_bubble.h" | 127 #include "chrome/browser/ui/status_bubble.h" |
127 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 128 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
128 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 129 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
129 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 130 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
130 #include "chrome/browser/ui/tabs/dock_info.h" | 131 #include "chrome/browser/ui/tabs/dock_info.h" |
(...skipping 2780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2911 } | 2912 } |
2912 | 2913 |
2913 // static | 2914 // static |
2914 void Browser::CrashedPluginHelper(WebContents* tab, | 2915 void Browser::CrashedPluginHelper(WebContents* tab, |
2915 const FilePath& plugin_path) { | 2916 const FilePath& plugin_path) { |
2916 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2917 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
2917 tab); | 2918 tab); |
2918 if (!tcw) | 2919 if (!tcw) |
2919 return; | 2920 return; |
2920 | 2921 |
| 2922 // Tell the hung plugin infobars about this crash so they can close any |
| 2923 // related ones. |
| 2924 tcw->hung_plugin_tab_helper()->PluginCrashed(plugin_path); |
| 2925 |
2921 DCHECK(!plugin_path.value().empty()); | 2926 DCHECK(!plugin_path.value().empty()); |
2922 | 2927 |
2923 string16 plugin_name = plugin_path.LossyDisplayName(); | 2928 string16 plugin_name = |
2924 webkit::WebPluginInfo plugin_info; | 2929 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); |
2925 if (PluginService::GetInstance()->GetPluginInfoByPath( | |
2926 plugin_path, &plugin_info) && | |
2927 !plugin_info.name.empty()) { | |
2928 plugin_name = plugin_info.name; | |
2929 #if defined(OS_MACOSX) | |
2930 // Many plugins on the Mac have .plugin in the actual name, which looks | |
2931 // terrible, so look for that and strip it off if present. | |
2932 const std::string kPluginExtension = ".plugin"; | |
2933 if (EndsWith(plugin_name, ASCIIToUTF16(kPluginExtension), true)) | |
2934 plugin_name.erase(plugin_name.length() - kPluginExtension.length()); | |
2935 #endif // OS_MACOSX | |
2936 } | |
2937 gfx::Image* icon = &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 2930 gfx::Image* icon = &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
2938 IDR_INFOBAR_PLUGIN_CRASHED); | 2931 IDR_INFOBAR_PLUGIN_CRASHED); |
2939 InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); | 2932 InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); |
2940 infobar_helper->AddInfoBar( | 2933 infobar_helper->AddInfoBar( |
2941 new SimpleAlertInfoBarDelegate( | 2934 new SimpleAlertInfoBarDelegate( |
2942 infobar_helper, | 2935 infobar_helper, |
2943 icon, | 2936 icon, |
2944 l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, plugin_name), | 2937 l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, plugin_name), |
2945 true)); | 2938 true)); |
2946 } | 2939 } |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4277 int active_match_ordinal, | 4270 int active_match_ordinal, |
4278 bool final_update) { | 4271 bool final_update) { |
4279 FindReplyHelper(tab, request_id, number_of_matches, selection_rect, | 4272 FindReplyHelper(tab, request_id, number_of_matches, selection_rect, |
4280 active_match_ordinal, final_update); | 4273 active_match_ordinal, final_update); |
4281 } | 4274 } |
4282 | 4275 |
4283 void Browser::CrashedPlugin(WebContents* tab, const FilePath& plugin_path) { | 4276 void Browser::CrashedPlugin(WebContents* tab, const FilePath& plugin_path) { |
4284 CrashedPluginHelper(tab, plugin_path); | 4277 CrashedPluginHelper(tab, plugin_path); |
4285 } | 4278 } |
4286 | 4279 |
| 4280 void Browser::PluginHungStatusChanged(WebContents* tab, |
| 4281 int plugin_child_id, |
| 4282 const FilePath& plugin_path, |
| 4283 bool is_hung) { |
| 4284 TabContentsWrapper* tcw = |
| 4285 TabContentsWrapper::GetCurrentWrapperForContents(tab); |
| 4286 tcw->hung_plugin_tab_helper()->PluginHungStatusChanged( |
| 4287 plugin_child_id, plugin_path, is_hung); |
| 4288 } |
| 4289 |
4287 void Browser::UpdatePreferredSize(WebContents* source, | 4290 void Browser::UpdatePreferredSize(WebContents* source, |
4288 const gfx::Size& pref_size) { | 4291 const gfx::Size& pref_size) { |
4289 window_->UpdatePreferredSize(source, pref_size); | 4292 window_->UpdatePreferredSize(source, pref_size); |
4290 } | 4293 } |
4291 | 4294 |
4292 void Browser::ResizeDueToAutoResize(WebContents* source, | 4295 void Browser::ResizeDueToAutoResize(WebContents* source, |
4293 const gfx::Size& new_size) { | 4296 const gfx::Size& new_size) { |
4294 window_->ResizeDueToAutoResize(source, new_size); | 4297 window_->ResizeDueToAutoResize(source, new_size); |
4295 } | 4298 } |
4296 | 4299 |
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5687 ShowSingletonTabOverwritingNTP(params); | 5690 ShowSingletonTabOverwritingNTP(params); |
5688 } else { | 5691 } else { |
5689 LoginUIServiceFactory::GetForProfile( | 5692 LoginUIServiceFactory::GetForProfile( |
5690 profile()->GetOriginalProfile())->ShowLoginUI(false); | 5693 profile()->GetOriginalProfile())->ShowLoginUI(false); |
5691 } | 5694 } |
5692 } | 5695 } |
5693 | 5696 |
5694 void Browser::ToggleSpeechInput() { | 5697 void Browser::ToggleSpeechInput() { |
5695 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); | 5698 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); |
5696 } | 5699 } |
OLD | NEW |