OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <shellapi.h> | 8 #include <shellapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 3266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3277 break; | 3277 break; |
3278 } | 3278 } |
3279 | 3279 |
3280 case NotificationType::EXTENSION_LOADED: { | 3280 case NotificationType::EXTENSION_LOADED: { |
3281 window()->GetLocationBar()->UpdatePageActions(); | 3281 window()->GetLocationBar()->UpdatePageActions(); |
3282 | 3282 |
3283 // If any "This extension has crashed" InfoBarDelegates are around for | 3283 // If any "This extension has crashed" InfoBarDelegates are around for |
3284 // this extension, it means that it has been reloaded in another window | 3284 // this extension, it means that it has been reloaded in another window |
3285 // so just remove the remaining CrashedExtensionInfoBarDelegate objects. | 3285 // so just remove the remaining CrashedExtensionInfoBarDelegate objects. |
3286 const Extension* extension = Details<const Extension>(details).ptr(); | 3286 const Extension* extension = Details<const Extension>(details).ptr(); |
3287 CrashedExtensionInfoBarDelegate* delegate = NULL; | |
3288 TabStripModel* model = tab_handler_->GetTabStripModel(); | 3287 TabStripModel* model = tab_handler_->GetTabStripModel(); |
3289 for (int m = 0; m < model->count(); ++m) { | 3288 for (int m = 0; m < model->count(); ++m) { |
3290 TabContents* tab_contents = model->GetTabContentsAt(m)->tab_contents(); | 3289 TabContents* tab_contents = model->GetTabContentsAt(m)->tab_contents(); |
3291 for (int i = 0; i < tab_contents->infobar_delegate_count();) { | 3290 for (int i = 0; i < tab_contents->infobar_delegate_count(); ) { |
3292 delegate = tab_contents->GetInfoBarDelegateAt(i)-> | 3291 CrashedExtensionInfoBarDelegate* delegate = tab_contents-> |
3293 AsCrashedExtensionInfoBarDelegate(); | 3292 GetInfoBarDelegateAt(i)->AsCrashedExtensionInfoBarDelegate(); |
3294 if (delegate && delegate->extension_id() == extension->id()) { | 3293 if (delegate && delegate->extension_id() == extension->id()) |
3295 tab_contents->RemoveInfoBar(delegate); | 3294 tab_contents->RemoveInfoBar(delegate); |
3296 continue; | 3295 else |
3297 } | 3296 ++i; |
3298 // Only increment |i| if we didn't remove an entry. | |
3299 ++i; | |
3300 } | 3297 } |
3301 } | 3298 } |
3302 break; | 3299 break; |
3303 } | 3300 } |
3304 | 3301 |
3305 case NotificationType::BROWSER_THEME_CHANGED: | 3302 case NotificationType::BROWSER_THEME_CHANGED: |
3306 window()->UserChangedTheme(); | 3303 window()->UserChangedTheme(); |
3307 break; | 3304 break; |
3308 | 3305 |
3309 case NotificationType::EXTENSION_READY_FOR_INSTALL: { | 3306 case NotificationType::EXTENSION_READY_FOR_INSTALL: { |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4262 // The page transition below is only for the purpose of inserting the tab. | 4259 // The page transition below is only for the purpose of inserting the tab. |
4263 browser->AddTab(view_source_contents, PageTransition::LINK); | 4260 browser->AddTab(view_source_contents, PageTransition::LINK); |
4264 } | 4261 } |
4265 | 4262 |
4266 if (profile_->HasSessionService()) { | 4263 if (profile_->HasSessionService()) { |
4267 SessionService* session_service = profile_->GetSessionService(); | 4264 SessionService* session_service = profile_->GetSessionService(); |
4268 if (session_service) | 4265 if (session_service) |
4269 session_service->TabRestored(&view_source_contents->controller(), false); | 4266 session_service->TabRestored(&view_source_contents->controller(), false); |
4270 } | 4267 } |
4271 } | 4268 } |
OLD | NEW |