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 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3357 } | 3357 } |
3358 | 3358 |
3359 void Browser::WorkerCrashed() { | 3359 void Browser::WorkerCrashed() { |
3360 TabContents* tab_contents = GetSelectedTabContents(); | 3360 TabContents* tab_contents = GetSelectedTabContents(); |
3361 if (!tab_contents) | 3361 if (!tab_contents) |
3362 return; | 3362 return; |
3363 tab_contents->AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents, NULL, | 3363 tab_contents->AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents, NULL, |
3364 l10n_util::GetStringUTF16(IDS_WEBWORKER_CRASHED_PROMPT), true)); | 3364 l10n_util::GetStringUTF16(IDS_WEBWORKER_CRASHED_PROMPT), true)); |
3365 } | 3365 } |
3366 | 3366 |
| 3367 bool Browser::IsHidden(const TabContents* source) const { |
| 3368 TabContentsWrapper* wrapper = GetSelectedTabContentsWrapper(); |
| 3369 if (wrapper) |
| 3370 return wrapper->tab_contents() != source; |
| 3371 // If we cant find the tab contents, assume we are not visible. |
| 3372 return true; |
| 3373 } |
| 3374 |
3367 /////////////////////////////////////////////////////////////////////////////// | 3375 /////////////////////////////////////////////////////////////////////////////// |
3368 // Browser, TabContentsWrapperDelegate implementation: | 3376 // Browser, TabContentsWrapperDelegate implementation: |
3369 | 3377 |
3370 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, | 3378 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, |
3371 int32 page_id) { | 3379 int32 page_id) { |
3372 if (GetSelectedTabContentsWrapper() != source) | 3380 if (GetSelectedTabContentsWrapper() != source) |
3373 return; | 3381 return; |
3374 | 3382 |
3375 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); | 3383 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); |
3376 if (!entry || (entry->page_id() != page_id)) | 3384 if (!entry || (entry->page_id() != page_id)) |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4614 TabContents* current_tab = GetSelectedTabContents(); | 4622 TabContents* current_tab = GetSelectedTabContents(); |
4615 if (current_tab) { | 4623 if (current_tab) { |
4616 content_restrictions = current_tab->content_restrictions(); | 4624 content_restrictions = current_tab->content_restrictions(); |
4617 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4625 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
4618 // See comment in UpdateCommandsForTabState about why we call url(). | 4626 // See comment in UpdateCommandsForTabState about why we call url(). |
4619 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4627 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
4620 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4628 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
4621 } | 4629 } |
4622 return content_restrictions; | 4630 return content_restrictions; |
4623 } | 4631 } |
OLD | NEW |