OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 // Update various elements that are interested in knowing the current | 824 // Update various elements that are interested in knowing the current |
825 // WebContents. | 825 // WebContents. |
826 | 826 |
827 // When we toggle the NTP floating bookmarks bar and/or the info bar, | 827 // When we toggle the NTP floating bookmarks bar and/or the info bar, |
828 // we don't want any WebContents to be attached, so that we | 828 // we don't want any WebContents to be attached, so that we |
829 // avoid an unnecessary resize and re-layout of a WebContents. | 829 // avoid an unnecessary resize and re-layout of a WebContents. |
830 if (change_tab_contents) { | 830 if (change_tab_contents) { |
831 contents_web_view_->SetWebContents(NULL); | 831 contents_web_view_->SetWebContents(NULL); |
832 devtools_web_view_->SetWebContents(NULL); | 832 devtools_web_view_->SetWebContents(NULL); |
833 } | 833 } |
834 infobar_container_->ChangeInfoBarService( | 834 |
835 InfoBarService::FromWebContents(new_contents)); | 835 InfoBarManager* infobar_manager = NULL; |
| 836 InfoBarService* infobar_service = |
| 837 InfoBarService::FromWebContents(new_contents); |
| 838 if (infobar_service) |
| 839 infobar_manager = infobar_service->infobar_manager(); |
| 840 infobar_container_->ChangeInfoBarManager(infobar_manager); |
836 | 841 |
837 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) | 842 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) |
838 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL); | 843 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL); |
839 | 844 |
840 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { | 845 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { |
841 PermissionBubbleManager::FromWebContents(new_contents)->SetView( | 846 PermissionBubbleManager::FromWebContents(new_contents)->SetView( |
842 permission_bubble_view_.get()); | 847 permission_bubble_view_.get()); |
843 } | 848 } |
844 | 849 |
845 if (bookmark_bar_view_.get()) { | 850 if (bookmark_bar_view_.get()) { |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 1488 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); |
1484 | 1489 |
1485 // We use index here rather than comparing |contents| because by this time | 1490 // We use index here rather than comparing |contents| because by this time |
1486 // the model has already removed |contents| from its list, so | 1491 // the model has already removed |contents| from its list, so |
1487 // browser_->GetActiveWebContents() will return NULL or something else. | 1492 // browser_->GetActiveWebContents() will return NULL or something else. |
1488 if (index == browser_->tab_strip_model()->active_index()) { | 1493 if (index == browser_->tab_strip_model()->active_index()) { |
1489 // We need to reset the current tab contents to NULL before it gets | 1494 // We need to reset the current tab contents to NULL before it gets |
1490 // freed. This is because the focus manager performs some operations | 1495 // freed. This is because the focus manager performs some operations |
1491 // on the selected WebContents when it is removed. | 1496 // on the selected WebContents when it is removed. |
1492 contents_web_view_->SetWebContents(NULL); | 1497 contents_web_view_->SetWebContents(NULL); |
1493 infobar_container_->ChangeInfoBarService(NULL); | 1498 infobar_container_->ChangeInfoBarManager(NULL); |
1494 UpdateDevToolsForContents(NULL, true); | 1499 UpdateDevToolsForContents(NULL, true); |
1495 } | 1500 } |
1496 } | 1501 } |
1497 | 1502 |
1498 void BrowserView::TabDeactivated(WebContents* contents) { | 1503 void BrowserView::TabDeactivated(WebContents* contents) { |
1499 if (PermissionBubbleManager::FromWebContents(contents)) | 1504 if (PermissionBubbleManager::FromWebContents(contents)) |
1500 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 1505 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); |
1501 | 1506 |
1502 // We do not store the focus when closing the tab to work-around bug 4633. | 1507 // We do not store the focus when closing the tab to work-around bug 4633. |
1503 // Some reports seem to show that the focus manager and/or focused view can | 1508 // Some reports seem to show that the focus manager and/or focused view can |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2588 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2584 gfx::Point icon_bottom( | 2589 gfx::Point icon_bottom( |
2585 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2590 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2586 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2591 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2587 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2592 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2588 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2593 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2589 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2594 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2590 } | 2595 } |
2591 return top_arrow_height; | 2596 return top_arrow_height; |
2592 } | 2597 } |
OLD | NEW |