Chromium Code Reviews| Index: chrome/browser/extensions/user_script_master_manager.cc |
| diff --git a/chrome/browser/extensions/user_script_master_manager.cc b/chrome/browser/extensions/user_script_master_manager.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e0c392cc65c4f569c5f7b2412fb4a1a0fbbe2b01 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/user_script_master_manager.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
|
Devlin
2014/08/04 18:33:26
no (c)
Mark Dittmer
2014/08/05 20:33:20
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/extensions/user_script_master_manager.h" |
| + |
| +#include "chrome/browser/extensions/shared_user_script_master.h" |
| +#include "chrome/browser/profiles/profile.h" |
| + |
| +namespace extensions { |
| + |
| +UserScriptMasterManager::UserScriptMasterManager(Profile* profile) |
| + : profile_(profile), |
| + shared_master_(new SharedUserScriptMaster(profile)), |
| + extension_registry_observer_(this) { |
| + extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); |
| +} |
| + |
| +UserScriptMasterManager::~UserScriptMasterManager() { |
| +} |
| + |
| +void UserScriptMasterManager::OnExtensionLoaded( |
| + content::BrowserContext* browser_context, |
|
Devlin
2014/08/04 18:33:26
Why?
Mark Dittmer
2014/08/05 20:33:20
Good question. I erroneously presumed that OnExten
|
| + const Extension* extension) { |
| +} |
| + |
| +void UserScriptMasterManager::OnExtensionUnloaded( |
| + content::BrowserContext* browser_context, |
| + const Extension* extension, |
| + UnloadedExtensionInfo::Reason reason) { |
| + const ExtensionId& id = extension->id(); |
| + if (declarative_masters_.find(id) != declarative_masters_.end()) { |
|
Devlin
2014/08/04 18:33:26
We could just have the DeclUSM listen for this.
Mark Dittmer
2014/08/05 20:33:20
Done.
|
| + declarative_masters_.get(id)->ClearScripts(); |
| + } |
| +} |
| + |
| +} // namespace extensions |