| Index: chrome/browser/ui/views/location_bar/page_action_image_view.cc
|
| diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
|
| index bc0cc1c6173927f0b6d551d61c0611007d0be7d5..3c88f786bd9a32cae447c1621b8f52f622fd8570 100644
|
| --- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc
|
| +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
|
| @@ -8,6 +8,7 @@
|
| #include "chrome/browser/extensions/extension_action.h"
|
| #include "chrome/browser/platform_util.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/sessions/session_tab_helper.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
|
| #include "extensions/browser/extension_registry.h"
|
| @@ -87,8 +88,7 @@ void PageActionImageView::OnGestureEvent(ui::GestureEvent* event) {
|
| }
|
|
|
| void PageActionImageView::UpdateVisibility(content::WebContents* contents) {
|
| - int tab_id = view_controller_->GetCurrentTabId();
|
| -
|
| + int tab_id = GetCurrentTabId();
|
| if (!contents ||
|
| tab_id == -1 ||
|
| (!preview_enabled_ && !extension_action()->GetIsVisible(tab_id))) {
|
| @@ -111,7 +111,7 @@ void PageActionImageView::UpdateVisibility(content::WebContents* contents) {
|
| void PageActionImageView::PaintChildren(gfx::Canvas* canvas,
|
| const views::CullSet& cull_set) {
|
| View::PaintChildren(canvas, cull_set);
|
| - int tab_id = view_controller_->GetCurrentTabId();
|
| + int tab_id = GetCurrentTabId();
|
| if (tab_id >= 0) {
|
| view_controller_->extension_action()->PaintBadge(
|
| canvas, GetLocalBounds(), tab_id);
|
| @@ -119,7 +119,7 @@ void PageActionImageView::PaintChildren(gfx::Canvas* canvas,
|
| }
|
|
|
| void PageActionImageView::OnIconUpdated() {
|
| - UpdateVisibility(GetCurrentWebContents());
|
| + UpdateVisibility(owner_->GetWebContents());
|
| }
|
|
|
| views::View* PageActionImageView::GetAsView() {
|
| @@ -151,8 +151,9 @@ views::MenuButton* PageActionImageView::GetContextMenuButton() {
|
| return NULL; // No menu button for page action views.
|
| }
|
|
|
| -content::WebContents* PageActionImageView::GetCurrentWebContents() {
|
| - return owner_->GetWebContents();
|
| +int PageActionImageView::GetCurrentTabId() const {
|
| + content::WebContents* web_contents = owner_->GetWebContents();
|
| + return web_contents ? SessionTabHelper::IdForTab(web_contents) : -1;
|
| }
|
|
|
| void PageActionImageView::HideActivePopup() {
|
|
|