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

Unified Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 8333021: Fix a crash in PageActionImageView when extensions are reloaded due to incognito settings changing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/page_action_image_view.cc
===================================================================
--- chrome/browser/ui/views/location_bar/page_action_image_view.cc (revision 107550)
+++ chrome/browser/ui/views/location_bar/page_action_image_view.cc (working copy)
@@ -13,8 +13,13 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
#include "chrome/common/extensions/extension_resource.h"
+#include "content/browser/notification_service_impl.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_model_adapter.h"
@@ -47,6 +52,10 @@
ImageLoadingTracker::DONT_CACHE);
}
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(
+ owner_->browser()->profile()->GetOriginalProfile()));
+
set_accessibility_focusable(true);
}
@@ -225,8 +234,8 @@
}
void PageActionImageView::InspectPopup(ExtensionAction* action) {
- ExecuteAction(1, // left-click
- true); // inspect_with_devtools
+ ExecuteAction(1, // Left-click.
+ true); // |inspect_with_devtools|.
}
void PageActionImageView::ExtensionPopupIsClosing(ExtensionPopup* popup) {
@@ -235,6 +244,16 @@
popup_ = NULL;
}
+void PageActionImageView::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED);
Aaron Boodman 2011/10/27 16:57:35 Can use _EQ.
+ const Extension* unloaded_extension =
+ content::Details<UnloadedExtensionInfo>(details)->extension;
+ if (page_action_ == unloaded_extension ->page_action())
+ owner_->UpdatePageActions();
+}
+
void PageActionImageView::HidePopup() {
if (popup_)
popup_->Close();

Powered by Google App Engine
This is Rietveld 408576698