| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| index c488fb8a0782ccc1d43fb9fafe6b71ce77c13449..f1561f11483e9d066398b0b266393186d2f52fcb 100644
|
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| @@ -52,6 +52,7 @@
|
| #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h"
|
| #include "chrome/browser/ui/views/translate/translate_bubble_view.h"
|
| #include "chrome/browser/ui/views/translate/translate_icon_view.h"
|
| +#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
|
| #include "chrome/grit/generated_resources.h"
|
| #include "components/bookmarks/common/bookmark_pref_names.h"
|
| #include "components/favicon/content/content_favicon_driver.h"
|
| @@ -150,6 +151,9 @@ LocationBarView::LocationBarView(Browser* browser,
|
| base::Bind(&LocationBarView::UpdateWithoutTabRestore,
|
| base::Unretained(this)));
|
|
|
| + if (browser_)
|
| + browser_->tab_strip_model()->AddObserver(this);
|
| +
|
| ui_zoom::ZoomEventManager::GetForBrowserContext(profile)
|
| ->AddZoomEventManagerObserver(this);
|
| }
|
| @@ -158,6 +162,9 @@ LocationBarView::~LocationBarView() {
|
| if (template_url_service_)
|
| template_url_service_->RemoveObserver(this);
|
|
|
| + if (browser_)
|
| + browser_->tab_strip_model()->RemoveObserver(this);
|
| +
|
| ui_zoom::ZoomEventManager::GetForBrowserContext(profile())
|
| ->RemoveZoomEventManagerObserver(this);
|
| }
|
| @@ -835,6 +842,51 @@ WebContents* LocationBarView::GetWebContents() {
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| +// LocationBarView, public TabStripModelObserver implementation:
|
| +
|
| +void LocationBarView::TabDetachedAt(content::WebContents* contents, int index) {
|
| + if (PermissionBubbleManager::FromWebContents(contents))
|
| + PermissionBubbleManager::FromWebContents(contents)->HideBubble();
|
| +}
|
| +
|
| +void LocationBarView::TabDeactivated(content::WebContents* contents) {
|
| + if (PermissionBubbleManager::FromWebContents(contents))
|
| + PermissionBubbleManager::FromWebContents(contents)->HideBubble();
|
| +}
|
| +
|
| +void LocationBarView::ActiveTabChanged(content::WebContents* old_contents,
|
| + content::WebContents* new_contents,
|
| + int index,
|
| + int reason) {
|
| + // Hide the permission bubble on the old web contents if present and open a
|
| + // new one if there are pending requests on the new web contents.
|
| + if (old_contents && PermissionBubbleManager::FromWebContents(old_contents))
|
| + PermissionBubbleManager::FromWebContents(old_contents)->HideBubble();
|
| +
|
| + if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) {
|
| + PermissionBubbleManager::FromWebContents(new_contents)
|
| + ->DisplayPendingRequests();
|
| + }
|
| +
|
| + // Hide the save card, translate, and zoom bubbles if present.
|
| + if (old_contents &&
|
| + autofill::SaveCardBubbleControllerImpl::FromWebContents(old_contents)) {
|
| + autofill::SaveCardBubbleControllerImpl::FromWebContents(old_contents)
|
| + ->HideBubble();
|
| + }
|
| +
|
| + TranslateBubbleView::CloseCurrentBubble();
|
| + ZoomBubbleView::CloseCurrentBubble();
|
| +}
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// LocationBarView, public ZoomEventManagerObserver implementation:
|
| +
|
| +void LocationBarView::OnDefaultZoomLevelChanged() {
|
| + RefreshZoomView();
|
| +}
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| // LocationBarView, private:
|
|
|
| int LocationBarView::IncrementalMinimumWidth(views::View* view) const {
|
| @@ -987,10 +1039,6 @@ bool LocationBarView::RefreshZoomView() {
|
| return was_visible != zoom_view_->visible();
|
| }
|
|
|
| -void LocationBarView::OnDefaultZoomLevelChanged() {
|
| - RefreshZoomView();
|
| -}
|
| -
|
| bool LocationBarView::RefreshSaveCreditCardIconView() {
|
| WebContents* web_contents = GetWebContents();
|
| if (!web_contents)
|
|
|