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

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

Issue 173314: Fix "crashed extension" infobar browser crashes. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "app/animation.h" 7 #include "app/animation.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/idle_timer.h" 10 #include "base/idle_timer.h"
11 #include "base/keyboard_codes.h" 11 #include "base/keyboard_codes.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/thread.h" 14 #include "base/thread.h"
15 #include "chrome/app/chrome_dll_resource.h" 15 #include "chrome/app/chrome_dll_resource.h"
16 #include "chrome/browser/bookmarks/bookmark_model.h" 16 #include "chrome/browser/bookmarks/bookmark_model.h"
17 #include "chrome/browser/browser_list.h" 17 #include "chrome/browser/browser_list.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/browser_shutdown.h" 19 #include "chrome/browser/browser_shutdown.h"
20 #include "chrome/browser/browser_window.h" 20 #include "chrome/browser/browser_window.h"
21 #include "chrome/browser/character_encoding.h" 21 #include "chrome/browser/character_encoding.h"
22 #include "chrome/browser/debugger/devtools_manager.h" 22 #include "chrome/browser/debugger/devtools_manager.h"
23 #include "chrome/browser/download/download_item_model.h" 23 #include "chrome/browser/download/download_item_model.h"
24 #include "chrome/browser/download/download_manager.h" 24 #include "chrome/browser/download/download_manager.h"
25 #include "chrome/browser/download/download_shelf.h" 25 #include "chrome/browser/download/download_shelf.h"
26 #include "chrome/browser/download/download_started_animation.h" 26 #include "chrome/browser/download/download_started_animation.h"
27 #include "chrome/browser/extensions/crashed_extension_infobar.h"
27 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" 28 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
28 #include "chrome/browser/find_bar.h" 29 #include "chrome/browser/find_bar.h"
29 #include "chrome/browser/find_bar_controller.h" 30 #include "chrome/browser/find_bar_controller.h"
30 #include "chrome/browser/location_bar.h" 31 #include "chrome/browser/location_bar.h"
31 #include "chrome/browser/metrics/user_metrics.h" 32 #include "chrome/browser/metrics/user_metrics.h"
32 #include "chrome/browser/net/url_fixer_upper.h" 33 #include "chrome/browser/net/url_fixer_upper.h"
33 #include "chrome/browser/options_window.h" 34 #include "chrome/browser/options_window.h"
34 #include "chrome/browser/profile.h" 35 #include "chrome/browser/profile.h"
35 #include "chrome/browser/renderer_host/site_instance.h" 36 #include "chrome/browser/renderer_host/site_instance.h"
36 #include "chrome/browser/sessions/session_service.h" 37 #include "chrome/browser/sessions/session_service.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 method_factory_(this), 189 method_factory_(this),
189 idle_task_(new BrowserIdleTimer) { 190 idle_task_(new BrowserIdleTimer) {
190 tabstrip_model_.AddObserver(this); 191 tabstrip_model_.AddObserver(this);
191 192
192 registrar_.Add(this, NotificationType::SSL_VISIBLE_STATE_CHANGED, 193 registrar_.Add(this, NotificationType::SSL_VISIBLE_STATE_CHANGED,
193 NotificationService::AllSources()); 194 NotificationService::AllSources());
194 registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, 195 registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED,
195 NotificationService::AllSources()); 196 NotificationService::AllSources());
196 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, 197 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
197 NotificationService::AllSources()); 198 NotificationService::AllSources());
199 registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CRASHED,
200 NotificationService::AllSources());
198 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, 201 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
199 NotificationService::AllSources()); 202 NotificationService::AllSources());
200 203
201 InitCommandState(); 204 InitCommandState();
202 BrowserList::AddBrowser(this); 205 BrowserList::AddBrowser(this);
203 206
204 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, 207 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
205 profile_->GetPrefs(), NULL); 208 profile_->GetPrefs(), NULL);
206 209
207 // Trim browser memory on idle for low & medium memory models. 210 // Trim browser memory on idle for low & medium memory models.
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 TabContents* tc = tabstrip_model_.GetTabContentsAt(i); 2091 TabContents* tc = tabstrip_model_.GetTabContentsAt(i);
2089 if (tc->GetURL().SchemeIs(chrome::kExtensionScheme) && 2092 if (tc->GetURL().SchemeIs(chrome::kExtensionScheme) &&
2090 tc->GetURL().host() == extension->id()) { 2093 tc->GetURL().host() == extension->id()) {
2091 CloseTabContents(tc); 2094 CloseTabContents(tc);
2092 return; 2095 return;
2093 } 2096 }
2094 } 2097 }
2095 break; 2098 break;
2096 } 2099 }
2097 2100
2101 case NotificationType::EXTENSION_PROCESS_CRASHED: {
2102 TabContents* tab_contents = GetSelectedTabContents();
2103 if (!tab_contents)
2104 break;
2105 ExtensionsService* extensions_service =
2106 Source<ExtensionsService>(source).ptr();
2107 ExtensionHost* extension_host = Details<ExtensionHost>(details).ptr();
2108 tab_contents->AddInfoBar(new CrashedExtensionInfoBarDelegate(
2109 tab_contents, extensions_service, extension_host->extension()));
2110 break;
2111 }
2112
2098 case NotificationType::BROWSER_THEME_CHANGED: 2113 case NotificationType::BROWSER_THEME_CHANGED:
2099 window()->UserChangedTheme(); 2114 window()->UserChangedTheme();
2100 break; 2115 break;
2101 2116
2102 default: 2117 default:
2103 NOTREACHED() << "Got a notification we didn't register for."; 2118 NOTREACHED() << "Got a notification we didn't register for.";
2104 } 2119 }
2105 } 2120 }
2106 2121
2107 2122
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 /////////////////////////////////////////////////////////////////////////////// 2813 ///////////////////////////////////////////////////////////////////////////////
2799 // BrowserToolbarModel (private): 2814 // BrowserToolbarModel (private):
2800 2815
2801 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 2816 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
2802 // This |current_tab| can be NULL during the initialization of the 2817 // This |current_tab| can be NULL during the initialization of the
2803 // toolbar during window creation (i.e. before any tabs have been added 2818 // toolbar during window creation (i.e. before any tabs have been added
2804 // to the window). 2819 // to the window).
2805 TabContents* current_tab = browser_->GetSelectedTabContents(); 2820 TabContents* current_tab = browser_->GetSelectedTabContents();
2806 return current_tab ? &current_tab->controller() : NULL; 2821 return current_tab ? &current_tab->controller() : NULL;
2807 } 2822 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/crashed_extension_infobar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698