 Chromium Code Reviews
 Chromium Code Reviews Issue 211273007:
  Split InfoBarService core code into InfoBarManager  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 211273007:
  Split InfoBarService core code into InfoBarManager  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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 infobar_container_->ChangeInfoBarManager( | 
| 835 InfoBarService::FromWebContents(new_contents)); | 835 &InfoBarService::FromWebContents(new_contents)->infobar_manager()); | 
| 
blundell
2014/03/27 09:40:30
Do we know the infobar service won't be NULL here?
 | |
| 836 | 836 | 
| 837 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) | 837 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) | 
| 838 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL); | 838 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL); | 
| 839 | 839 | 
| 840 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { | 840 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { | 
| 841 PermissionBubbleManager::FromWebContents(new_contents)->SetView( | 841 PermissionBubbleManager::FromWebContents(new_contents)->SetView( | 
| 842 permission_bubble_view_.get()); | 842 permission_bubble_view_.get()); | 
| 843 } | 843 } | 
| 844 | 844 | 
| 845 if (bookmark_bar_view_.get()) { | 845 if (bookmark_bar_view_.get()) { | 
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1483 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 1483 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 
| 1484 | 1484 | 
| 1485 // We use index here rather than comparing |contents| because by this time | 1485 // We use index here rather than comparing |contents| because by this time | 
| 1486 // the model has already removed |contents| from its list, so | 1486 // the model has already removed |contents| from its list, so | 
| 1487 // browser_->GetActiveWebContents() will return NULL or something else. | 1487 // browser_->GetActiveWebContents() will return NULL or something else. | 
| 1488 if (index == browser_->tab_strip_model()->active_index()) { | 1488 if (index == browser_->tab_strip_model()->active_index()) { | 
| 1489 // We need to reset the current tab contents to NULL before it gets | 1489 // We need to reset the current tab contents to NULL before it gets | 
| 1490 // freed. This is because the focus manager performs some operations | 1490 // freed. This is because the focus manager performs some operations | 
| 1491 // on the selected WebContents when it is removed. | 1491 // on the selected WebContents when it is removed. | 
| 1492 contents_web_view_->SetWebContents(NULL); | 1492 contents_web_view_->SetWebContents(NULL); | 
| 1493 infobar_container_->ChangeInfoBarService(NULL); | 1493 infobar_container_->ChangeInfoBarManager(NULL); | 
| 1494 UpdateDevToolsForContents(NULL, true); | 1494 UpdateDevToolsForContents(NULL, true); | 
| 1495 } | 1495 } | 
| 1496 } | 1496 } | 
| 1497 | 1497 | 
| 1498 void BrowserView::TabDeactivated(WebContents* contents) { | 1498 void BrowserView::TabDeactivated(WebContents* contents) { | 
| 1499 if (PermissionBubbleManager::FromWebContents(contents)) | 1499 if (PermissionBubbleManager::FromWebContents(contents)) | 
| 1500 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 1500 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); | 
| 1501 | 1501 | 
| 1502 // We do not store the focus when closing the tab to work-around bug 4633. | 1502 // 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 | 1503 // 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()) { | 2583 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 
| 2584 gfx::Point icon_bottom( | 2584 gfx::Point icon_bottom( | 
| 2585 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2585 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 
| 2586 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2586 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 
| 2587 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2587 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 
| 2588 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2588 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 
| 2589 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2589 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 
| 2590 } | 2590 } | 
| 2591 return top_arrow_height; | 2591 return top_arrow_height; | 
| 2592 } | 2592 } | 
| OLD | NEW |