Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 211273007: Split InfoBarService core code into InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 =
836 InfoBarService::InfoBarManagerFromWebContents(new_contents);
837 infobar_container_->ChangeInfoBarManager(infobar_manager);
836 838
837 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) 839 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents))
838 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL); 840 PermissionBubbleManager::FromWebContents(old_contents)->SetView(NULL);
839 841
840 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { 842 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) {
841 PermissionBubbleManager::FromWebContents(new_contents)->SetView( 843 PermissionBubbleManager::FromWebContents(new_contents)->SetView(
842 permission_bubble_view_.get()); 844 permission_bubble_view_.get());
843 } 845 }
844 846
845 if (bookmark_bar_view_.get()) { 847 if (bookmark_bar_view_.get()) {
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); 1485 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL);
1484 1486
1485 // We use index here rather than comparing |contents| because by this time 1487 // We use index here rather than comparing |contents| because by this time
1486 // the model has already removed |contents| from its list, so 1488 // the model has already removed |contents| from its list, so
1487 // browser_->GetActiveWebContents() will return NULL or something else. 1489 // browser_->GetActiveWebContents() will return NULL or something else.
1488 if (index == browser_->tab_strip_model()->active_index()) { 1490 if (index == browser_->tab_strip_model()->active_index()) {
1489 // We need to reset the current tab contents to NULL before it gets 1491 // We need to reset the current tab contents to NULL before it gets
1490 // freed. This is because the focus manager performs some operations 1492 // freed. This is because the focus manager performs some operations
1491 // on the selected WebContents when it is removed. 1493 // on the selected WebContents when it is removed.
1492 contents_web_view_->SetWebContents(NULL); 1494 contents_web_view_->SetWebContents(NULL);
1493 infobar_container_->ChangeInfoBarService(NULL); 1495 infobar_container_->ChangeInfoBarManager(NULL);
1494 UpdateDevToolsForContents(NULL, true); 1496 UpdateDevToolsForContents(NULL, true);
1495 } 1497 }
1496 } 1498 }
1497 1499
1498 void BrowserView::TabDeactivated(WebContents* contents) { 1500 void BrowserView::TabDeactivated(WebContents* contents) {
1499 if (PermissionBubbleManager::FromWebContents(contents)) 1501 if (PermissionBubbleManager::FromWebContents(contents))
1500 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL); 1502 PermissionBubbleManager::FromWebContents(contents)->SetView(NULL);
1501 1503
1502 // We do not store the focus when closing the tab to work-around bug 4633. 1504 // 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 1505 // 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
2583 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2585 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2584 gfx::Point icon_bottom( 2586 gfx::Point icon_bottom(
2585 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2587 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2586 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2588 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2587 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2589 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2588 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2590 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2589 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2591 top_arrow_height = infobar_top.y() - icon_bottom.y();
2590 } 2592 }
2591 return top_arrow_height; 2593 return top_arrow_height;
2592 } 2594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698