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

Unified Diff: chrome/browser/ui/panels/panel.cc

Issue 557273003: Remove deprecated extension notification from panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase panel_browsertest.cc file Created 6 years, 3 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
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel.cc
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index aa5f4dfe49daf8382345ab9c7219046538ffbbfa..70d9f4677bf3c549814ac7a50395ee0bee6c7d64 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -34,6 +34,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/image_loader.h"
#include "extensions/common/constants.h"
@@ -439,11 +440,6 @@ void Panel::Observe(int type,
case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED:
ConfigureAutoResize(content::Source<content::WebContents>(source).ptr());
break;
- case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED:
- if (content::Details<extensions::UnloadedExtensionInfo>(
- details)->extension->id() == extension_id())
- Close();
- break;
case chrome::NOTIFICATION_APP_TERMINATING:
Close();
break;
@@ -452,6 +448,13 @@ void Panel::Observe(int type,
}
}
+void Panel::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension,
+ extensions::UnloadedExtensionInfo::Reason reason) {
+ if (extension->id() == extension_id())
+ Close();
+}
void Panel::OnTitlebarClicked(panel::ClickModifier modifier) {
if (collection_)
collection_->OnPanelTitlebarClicked(this, modifier);
@@ -491,6 +494,7 @@ void Panel::OnNativePanelClosed() {
// Ensure previously enqueued OnImageLoaded callbacks are ignored.
image_loader_ptr_factory_.InvalidateWeakPtrs();
registrar_.RemoveAll();
+ extension_registry_->RemoveObserver(this);
manager()->OnPanelClosed(this);
DCHECK(!collection_);
}
@@ -532,9 +536,7 @@ void Panel::Initialize(const GURL& url,
native_panel_->AttachWebContents(web_contents);
// Close when the extension is unloaded or the browser is exiting.
- registrar_.Add(this,
- extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(profile_));
+ extension_registry_->AddObserver(this);
registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
@@ -801,8 +803,10 @@ void Panel::MinimizeBySystem() {
native_panel_->MinimizePanelBySystem();
}
-Panel::Panel(Profile* profile, const std::string& app_name,
- const gfx::Size& min_size, const gfx::Size& max_size)
+Panel::Panel(Profile* profile,
+ const std::string& app_name,
+ const gfx::Size& min_size,
+ const gfx::Size& max_size)
: app_name_(app_name),
profile_(profile),
collection_(NULL),
@@ -816,6 +820,7 @@ Panel::Panel(Profile* profile, const std::string& app_name,
attention_mode_(USE_PANEL_ATTENTION),
expansion_state_(EXPANDED),
command_updater_(this),
+ extension_registry_(extensions::ExtensionRegistry::Get(profile_)),
image_loader_ptr_factory_(this) {
}
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698