OLD | NEW |
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 Loading... |
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 Loading... |
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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 /////////////////////////////////////////////////////////////////////////////// | 2806 /////////////////////////////////////////////////////////////////////////////// |
2792 // BrowserToolbarModel (private): | 2807 // BrowserToolbarModel (private): |
2793 | 2808 |
2794 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2809 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
2795 // This |current_tab| can be NULL during the initialization of the | 2810 // This |current_tab| can be NULL during the initialization of the |
2796 // toolbar during window creation (i.e. before any tabs have been added | 2811 // toolbar during window creation (i.e. before any tabs have been added |
2797 // to the window). | 2812 // to the window). |
2798 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2813 TabContents* current_tab = browser_->GetSelectedTabContents(); |
2799 return current_tab ? ¤t_tab->controller() : NULL; | 2814 return current_tab ? ¤t_tab->controller() : NULL; |
2800 } | 2815 } |
OLD | NEW |