| 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 // Update various elements that are interested in knowing the current | 820 // Update various elements that are interested in knowing the current |
| 821 // WebContents. | 821 // WebContents. |
| 822 | 822 |
| 823 // When we toggle the NTP floating bookmarks bar and/or the info bar, | 823 // When we toggle the NTP floating bookmarks bar and/or the info bar, |
| 824 // we don't want any WebContents to be attached, so that we | 824 // we don't want any WebContents to be attached, so that we |
| 825 // avoid an unnecessary resize and re-layout of a WebContents. | 825 // avoid an unnecessary resize and re-layout of a WebContents. |
| 826 if (change_tab_contents) { | 826 if (change_tab_contents) { |
| 827 contents_web_view_->SetWebContents(NULL); | 827 contents_web_view_->SetWebContents(NULL); |
| 828 devtools_web_view_->SetWebContents(NULL); | 828 devtools_web_view_->SetWebContents(NULL); |
| 829 } | 829 } |
| 830 infobar_container_->ChangeInfoBarService( | 830 InfoBarService* infobar_service = |
| 831 InfoBarService::FromWebContents(new_contents)); | 831 InfoBarService::FromWebContents(new_contents); |
| 832 infobar_container_->ChangeInfoBarManager( |
| 833 infobar_service ? &infobar_service->infobar_manager() : NULL); |
| 832 | 834 |
| 833 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) | 835 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) |
| 834 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL); | 836 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL); |
| 835 | 837 |
| 836 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { | 838 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { |
| 837 PermissionBubbleManager::FromWebContents(new_contents)->SetView( | 839 PermissionBubbleManager::FromWebContents(new_contents)->SetView( |
| 838 permission_bubble_view_.get()); | 840 permission_bubble_view_.get()); |
| 839 } | 841 } |
| 840 | 842 |
| 841 if (bookmark_bar_view_.get()) { | 843 if (bookmark_bar_view_.get()) { |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 1464 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); |
| 1463 | 1465 |
| 1464 // We use index here rather than comparing |contents| because by this time | 1466 // We use index here rather than comparing |contents| because by this time |
| 1465 // the model has already removed |contents| from its list, so | 1467 // the model has already removed |contents| from its list, so |
| 1466 // browser_->GetActiveWebContents() will return NULL or something else. | 1468 // browser_->GetActiveWebContents() will return NULL or something else. |
| 1467 if (index == browser_->tab_strip_model()->active_index()) { | 1469 if (index == browser_->tab_strip_model()->active_index()) { |
| 1468 // We need to reset the current tab contents to NULL before it gets | 1470 // We need to reset the current tab contents to NULL before it gets |
| 1469 // freed. This is because the focus manager performs some operations | 1471 // freed. This is because the focus manager performs some operations |
| 1470 // on the selected WebContents when it is removed. | 1472 // on the selected WebContents when it is removed. |
| 1471 contents_web_view_->SetWebContents(NULL); | 1473 contents_web_view_->SetWebContents(NULL); |
| 1472 infobar_container_->ChangeInfoBarService(NULL); | 1474 infobar_container_->ChangeInfoBarManager(NULL); |
| 1473 UpdateDevToolsForContents(NULL, true); | 1475 UpdateDevToolsForContents(NULL, true); |
| 1474 } | 1476 } |
| 1475 } | 1477 } |
| 1476 | 1478 |
| 1477 void BrowserView::TabDeactivated(WebContents* contents) { | 1479 void BrowserView::TabDeactivated(WebContents* contents) { |
| 1478 if (PermissionBubbleManager::FromWebContents(contents)) | 1480 if (PermissionBubbleManager::FromWebContents(contents)) |
| 1479 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 1481 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); |
| 1480 | 1482 |
| 1481 // We do not store the focus when closing the tab to work-around bug 4633. | 1483 // We do not store the focus when closing the tab to work-around bug 4633. |
| 1482 // Some reports seem to show that the focus manager and/or focused view can | 1484 // Some reports seem to show that the focus manager and/or focused view can |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2560 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2559 gfx::Point icon_bottom( | 2561 gfx::Point icon_bottom( |
| 2560 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2562 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2561 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2563 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2562 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2564 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2563 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2565 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2564 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2566 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2565 } | 2567 } |
| 2566 return top_arrow_height; | 2568 return top_arrow_height; |
| 2567 } | 2569 } |
| OLD | NEW |