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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 10014013: Add a hang monitor for Pepper plugins (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
4275 int active_match_ordinal, 4268 int active_match_ordinal,
4276 bool final_update) { 4269 bool final_update) {
4277 FindReplyHelper(tab, request_id, number_of_matches, selection_rect, 4270 FindReplyHelper(tab, request_id, number_of_matches, selection_rect,
4278 active_match_ordinal, final_update); 4271 active_match_ordinal, final_update);
4279 } 4272 }
4280 4273
4281 void Browser::CrashedPlugin(WebContents* tab, const FilePath& plugin_path) { 4274 void Browser::CrashedPlugin(WebContents* tab, const FilePath& plugin_path) {
4282 CrashedPluginHelper(tab, plugin_path); 4275 CrashedPluginHelper(tab, plugin_path);
4283 } 4276 }
4284 4277
4278 void Browser::PluginHungStatusChanged(WebContents* tab,
4279 int plugin_child_id,
4280 const FilePath& plugin_path,
4281 bool is_hung) {
4282 TabContentsWrapper* tcw =
4283 TabContentsWrapper::GetCurrentWrapperForContents(tab);
4284 tcw->hung_plugin_tab_helper()->PluginHungStatusChanged(
4285 plugin_child_id, plugin_path, is_hung);
4286 }
4287
4285 void Browser::UpdatePreferredSize(WebContents* source, 4288 void Browser::UpdatePreferredSize(WebContents* source,
4286 const gfx::Size& pref_size) { 4289 const gfx::Size& pref_size) {
4287 window_->UpdatePreferredSize(source, pref_size); 4290 window_->UpdatePreferredSize(source, pref_size);
4288 } 4291 }
4289 4292
4290 void Browser::ResizeDueToAutoResize(WebContents* source, 4293 void Browser::ResizeDueToAutoResize(WebContents* source,
4291 const gfx::Size& new_size) { 4294 const gfx::Size& new_size) {
4292 window_->ResizeDueToAutoResize(source, new_size); 4295 window_->ResizeDueToAutoResize(source, new_size);
4293 } 4296 }
4294 4297
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698