Commit 4fd26bf4 authored by sky@chromium.org's avatar sky@chromium.org

Revert 284725 "Use ExtensionRegistryObserver instead of DEPRECAT..."

This appears to have broke
StackedPanelBrowserTest.AddNewPanelFromDifferentProfile on windows
interactive.
http://build.chromium.org/p/chromium.win/builders/Win%207%20Tests%20x64%20%281%29/builds/15556/steps/interactive_ui_tests/logs/AddNewPanelFromDifferentProfile

[ RUN      ] StackedPanelBrowserTest.AddNewPanelFromDifferentProfile
Backtrace:
        extensions::ExtensionRegistry::RemoveObserver
        [0x00000001430B3030+32]
        (No symbol) [0x00000000086491C0]
        base::SupportsWeakPtr\u003CObserverListBase\u003Caura::WindowObserver>
        >::AsWeakPtr [0x000007FEEF42B175+85]

StackedPanelBrowserTest.AddNewPanelFromDifferentProfile (run #2):
...


> Use ExtensionRegistryObserver instead of DEPRECATED extension notify.
> 
> BUG=354458
> 
> Review URL: https://codereview.chromium.org/262223003

TBR=limasdf@gmail.com

Review URL: https://codereview.chromium.org/409983002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284769 0039d316-1c4b-4281-b951-d872f2087c98
parent c90eb80f
......@@ -33,7 +33,6 @@
#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"
......@@ -440,6 +439,11 @@ void Panel::Observe(int type,
case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED:
ConfigureAutoResize(content::Source<content::WebContents>(source).ptr());
break;
case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED:
if (content::Details<extensions::UnloadedExtensionInfo>(
details)->extension->id() == extension_id())
Close();
break;
case chrome::NOTIFICATION_APP_TERMINATING:
Close();
break;
......@@ -448,14 +452,6 @@ 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);
......@@ -536,8 +532,8 @@ void Panel::Initialize(const GURL& url,
native_panel_->AttachWebContents(web_contents);
// Close when the extension is unloaded or the browser is exiting.
extension_registry_observer_.Add(
extensions::ExtensionRegistry::Get(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
......@@ -819,7 +815,6 @@ Panel::Panel(Profile* profile, const std::string& app_name,
attention_mode_(USE_PANEL_ATTENTION),
expansion_state_(EXPANDED),
command_updater_(this),
extension_registry_observer_(this),
image_loader_ptr_factory_(this) {
}
......
......@@ -10,7 +10,6 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/command_updater_delegate.h"
......@@ -18,7 +17,6 @@
#include "chrome/browser/ui/panels/panel_constants.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/extension_registry_observer.h"
#include "ui/base/base_window.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/rect.h"
......@@ -38,7 +36,6 @@ struct NativeWebKeyboardEvent;
namespace extensions {
class Extension;
class ExtensionRegistry;
class WindowController;
}
......@@ -53,8 +50,7 @@ class WindowController;
// other Panels. For example deleting a panel would rearrange other panels.
class Panel : public ui::BaseWindow,
public CommandUpdaterDelegate,
public content::NotificationObserver,
public extensions::ExtensionRegistryObserver {
public content::NotificationObserver {
public:
enum ExpansionState {
// The panel is fully expanded with both title-bar and the client-area.
......@@ -149,12 +145,6 @@ class Panel : public ui::BaseWindow,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// extensions::ExtensionRegistryObserver implementation.
virtual void OnExtensionUnloaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
// Construct a native panel implementation.
static NativePanel* CreateNativePanel(Panel* panel,
const gfx::Rect& bounds,
......@@ -402,11 +392,6 @@ class Panel : public ui::BaseWindow,
scoped_ptr<extensions::WindowController> extension_window_controller_;
scoped_ptr<PanelHost> panel_host_;
// Listen to extension unloaded notification.
ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver>
extension_registry_observer_;
// Icon showed in the task bar.
gfx::Image app_icon_;
......
......@@ -37,7 +37,6 @@
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
#include "content/test/net/url_request_mock_http_job.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
#include "net/base/net_util.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -1419,12 +1418,12 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest,
content::Source<Panel>(panel1));
// Send unload notification on the first extension.
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(browser()->profile());
registry->RemoveEnabled(extension->id());
registry->TriggerOnUnloaded(
extension.get(),
extensions::UnloadedExtensionInfo::REASON_UNINSTALL);
extensions::UnloadedExtensionInfo details(
extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::Source<Profile>(browser()->profile()),
content::Details<extensions::UnloadedExtensionInfo>(&details));
// Wait for the panels opened by the first extension to close.
signal.Wait();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment