Commit 8fc2d0b9 authored by limasdf's avatar limasdf Committed by Commit bot

Remove some linked_ptr c/b/extension

Use std::unique_ptr instead of deprecated linked_ptr.

BUG=556939

Review-Url: https://codereview.chromium.org/2466523002
Cr-Commit-Position: refs/heads/master@{#430184}
parent c034cd40
......@@ -4,9 +4,10 @@
#include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h"
#include <memory>
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h"
#include "chrome/browser/extensions/api/gcd_private/privet_v3_session.h"
......@@ -93,8 +94,8 @@ class GcdPrivateAPIImpl {
service_discovery_client_;
struct SessionInfo {
linked_ptr<PrivetV3Session> session;
linked_ptr<local_discovery::EndpointResolver> resolver;
std::unique_ptr<PrivetV3Session> session;
std::unique_ptr<local_discovery::EndpointResolver> resolver;
};
std::map<int, SessionInfo> sessions_;
......
......@@ -6,6 +6,7 @@
#include <utility>
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "chrome/browser/extensions/api/mdns/dns_sd_device_lister.h"
#include "chrome/browser/local_discovery/service_discovery_shared_client.h"
......@@ -160,16 +161,14 @@ void DnsSdRegistry::RegisterDnsSdListener(const std::string& service_type) {
CreateDnsSdDeviceLister(this, service_type,
service_discovery_client_.get()));
dns_sd_device_lister->Discover(false);
linked_ptr<ServiceTypeData> service_type_data(
new ServiceTypeData(std::move(dns_sd_device_lister)));
service_data_map_[service_type] = service_type_data;
service_data_map_[service_type] =
base::MakeUnique<ServiceTypeData>(std::move(dns_sd_device_lister));
DispatchApiEvent(service_type);
}
void DnsSdRegistry::UnregisterDnsSdListener(const std::string& service_type) {
VLOG(1) << "UnregisterDnsSdListener: " << service_type;
DnsSdRegistry::DnsSdServiceTypeDataMap::iterator it =
service_data_map_.find(service_type);
auto it = service_data_map_.find(service_type);
if (it == service_data_map_.end())
return;
......
......@@ -12,7 +12,6 @@
#include <vector>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/extensions/api/mdns/dns_sd_delegate.h"
......@@ -94,10 +93,6 @@ class DnsSdRegistry : public DnsSdDelegate {
DISALLOW_COPY_AND_ASSIGN(ServiceTypeData);
};
// Maps service types to associated data such as listers and service lists.
typedef std::map<std::string, linked_ptr<ServiceTypeData> >
DnsSdServiceTypeDataMap;
virtual DnsSdDeviceLister* CreateDnsSdDeviceLister(
DnsSdDelegate* delegate,
const std::string& service_type,
......@@ -111,7 +106,7 @@ class DnsSdRegistry : public DnsSdDelegate {
const std::string& service_name) override;
void ServicesFlushed(const std::string& service_type) override;
DnsSdServiceTypeDataMap service_data_map_;
std::map<std::string, std::unique_ptr<ServiceTypeData>> service_data_map_;
private:
void DispatchApiEvent(const std::string& service_type);
......
......@@ -5,10 +5,10 @@
#include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h"
#include <algorithm>
#include <memory>
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/api/platform_keys/platform_keys_api.h"
#include "chrome/common/extensions/api/platform_keys_internal.h"
......@@ -71,7 +71,8 @@ class VerifyTrustAPI::IOPart {
// One CertVerifier per extension to verify trust. Each verifier is created on
// first usage and deleted when this IOPart is destructed or the respective
// extension is unloaded.
std::map<std::string, linked_ptr<net::CertVerifier>> extension_to_verifier_;
std::map<std::string, std::unique_ptr<net::CertVerifier>>
extension_to_verifier_;
};
// static
......@@ -177,8 +178,7 @@ void VerifyTrustAPI::IOPart::Verify(std::unique_ptr<Params> params,
}
if (!base::ContainsKey(extension_to_verifier_, extension_id)) {
extension_to_verifier_[extension_id] =
make_linked_ptr(net::CertVerifier::CreateDefault().release());
extension_to_verifier_[extension_id] = net::CertVerifier::CreateDefault();
}
net::CertVerifier* verifier = extension_to_verifier_[extension_id].get();
......
......@@ -94,15 +94,13 @@ void SettingsPrivateEventRouter::StartOrStopListeningForPrefsChanges() {
std::string pref_name = it.first;
if (prefs_util_->IsCrosSetting(pref_name)) {
#if defined(OS_CHROMEOS)
std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> observer =
chromeos::CrosSettings::Get()->AddSettingsObserver(
std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
subscription = chromeos::CrosSettings::Get()->AddSettingsObserver(
pref_name.c_str(),
base::Bind(&SettingsPrivateEventRouter::OnPreferenceChanged,
base::Unretained(this), pref_name));
linked_ptr<chromeos::CrosSettings::ObserverSubscription> subscription(
observer.release());
cros_settings_subscription_map_.insert(
make_pair(pref_name, subscription));
make_pair(pref_name, std::move(subscription)));
#endif
} else {
FindRegistrarForPref(it.first)
......
......@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_EVENT_ROUTER_H_
#define CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_EVENT_ROUTER_H_
#include <memory>
#include "base/macros.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/extensions/api/settings_private/prefs_util.h"
......@@ -57,9 +59,9 @@ class SettingsPrivateEventRouter : public KeyedService,
PrefChangeRegistrar* FindRegistrarForPref(const std::string& pref_name);
typedef std::map<std::string,
linked_ptr<chromeos::CrosSettings::ObserverSubscription>>
SubscriptionMap;
using SubscriptionMap =
std::map<std::string,
std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>>;
SubscriptionMap cros_settings_subscription_map_;
content::BrowserContext* context_;
......
......@@ -350,19 +350,20 @@ PolicyValueStore* ManagedValueStoreCache::GetStoreFor(
const std::string& extension_id) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
PolicyValueStoreMap::iterator it = store_map_.find(extension_id);
auto it = store_map_.find(extension_id);
if (it != store_map_.end())
return it->second.get();
// Create the store now, and serve the cached policy until the PolicyService
// sends updated values.
PolicyValueStore* store = new PolicyValueStore(
std::unique_ptr<PolicyValueStore> store(new PolicyValueStore(
extension_id, observers_,
storage_factory_->CreateSettingsStore(settings_namespace::MANAGED,
kManagedModelType, extension_id));
store_map_[extension_id] = make_linked_ptr(store);
kManagedModelType, extension_id)));
PolicyValueStore* raw_store = store.get();
store_map_[extension_id] = std::move(store);
return store;
return raw_store;
}
bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const {
......
......@@ -12,7 +12,6 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_service.h"
......@@ -52,10 +51,6 @@ class ManagedValueStoreCache : public ValueStoreCache,
private:
class ExtensionTracker;
// Maps an extension ID to its PolicyValueStoreMap.
typedef std::map<std::string, linked_ptr<PolicyValueStore> >
PolicyValueStoreMap;
// ValueStoreCache implementation:
void ShutdownOnUI() override;
void RunWithValueStoreForExtension(
......@@ -101,7 +96,7 @@ class ManagedValueStoreCache : public ValueStoreCache,
// All the PolicyValueStores live on the FILE thread, and |store_map_| can be
// accessed only on the FILE thread as well.
PolicyValueStoreMap store_map_;
std::map<std::string, std::unique_ptr<PolicyValueStore>> store_map_;
DISALLOW_COPY_AND_ASSIGN(ManagedValueStoreCache);
};
......
......@@ -81,7 +81,7 @@ SyncableSettingsStorage* SyncStorageBackend::GetOrCreateStorageWithSyncData(
return maybe_storage->second.get();
}
std::unique_ptr<SettingsStorageQuotaEnforcer> storage(
std::unique_ptr<SettingsStorageQuotaEnforcer> settings_storage(
new SettingsStorageQuotaEnforcer(
quota_, storage_factory_->CreateSettingsStore(
settings_namespace::SYNC, ToFactoryModelType(sync_type_),
......@@ -89,18 +89,20 @@ SyncableSettingsStorage* SyncStorageBackend::GetOrCreateStorageWithSyncData(
// It's fine to create the quota enforcer underneath the sync layer, since
// sync will only go ahead if each underlying storage operation succeeds.
linked_ptr<SyncableSettingsStorage> syncable_storage(
new SyncableSettingsStorage(
observers_, extension_id, storage.release(), sync_type_, flare_));
storage_objs_[extension_id] = syncable_storage;
std::unique_ptr<SyncableSettingsStorage> syncable_storage(
new SyncableSettingsStorage(observers_, extension_id,
settings_storage.release(), sync_type_,
flare_));
SyncableSettingsStorage* raw_syncable_storage = syncable_storage.get();
storage_objs_[extension_id] = std::move(syncable_storage);
if (sync_processor_.get()) {
syncer::SyncError error = syncable_storage->StartSyncing(
syncer::SyncError error = raw_syncable_storage->StartSyncing(
std::move(sync_data), CreateSettingsSyncProcessor(extension_id));
if (error.IsSet())
syncable_storage->StopSyncing();
raw_syncable_storage->StopSyncing();
}
return syncable_storage.get();
return raw_syncable_storage;
}
void SyncStorageBackend::DeleteStorage(const std::string& extension_id) {
......
......@@ -13,7 +13,6 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "components/sync/model/syncable_service.h"
#include "extensions/browser/api/storage/settings_observer.h"
......@@ -87,8 +86,8 @@ class SyncStorageBackend : public syncer::SyncableService {
// A cache of ValueStore objects that have already been created.
// Ensure that there is only ever one created per extension.
typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> >
StorageObjMap;
using StorageObjMap =
std::map<std::string, std::unique_ptr<SyncableSettingsStorage>>;
mutable StorageObjMap storage_objs_;
// Current sync model type. Either EXTENSION_SETTINGS or APP_SETTINGS.
......
......@@ -135,7 +135,7 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler(
->DispatchEventToExtension(extension_id, std::move(event));
GURL url = stream->handle->GetURL();
streams_[extension_id][url] = make_linked_ptr(stream->handle.release());
streams_[extension_id][url] = std::move(stream->handle);
}
void StreamsPrivateAPI::AbortStream(const std::string& extension_id,
......
......@@ -62,9 +62,6 @@ class StreamsPrivateAPI : public BrowserContextKeyedAPI,
private:
friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>;
typedef std::map<std::string,
std::map<GURL,
linked_ptr<content::StreamHandle> > > StreamMap;
// ExtensionRegistryObserver implementation.
void OnExtensionUnloaded(content::BrowserContext* browser_context,
......@@ -79,6 +76,9 @@ class StreamsPrivateAPI : public BrowserContextKeyedAPI,
static const bool kServiceRedirectedInIncognito = true;
content::BrowserContext* const browser_context_;
using StreamMap =
std::map<std::string,
std::map<GURL, std::unique_ptr<content::StreamHandle>>>;
StreamMap streams_;
// Listen to extension unloaded notifications.
......
......@@ -85,33 +85,33 @@ void ExtensionActionManager::OnExtensionUnloaded(
namespace {
// Returns map[extension_id] if that entry exists. Otherwise, if
// action_info!=NULL, creates an ExtensionAction from it, fills in the map, and
// returns that. Otherwise (action_info==NULL), returns NULL.
// action_info!=nullptr, creates an ExtensionAction from it, fills in the map,
// and returns that. Otherwise (action_info==nullptr), returns nullptr.
ExtensionAction* GetOrCreateOrNull(
std::map<std::string, linked_ptr<ExtensionAction> >* map,
std::map<std::string, std::unique_ptr<ExtensionAction>>* map,
const Extension& extension,
ActionInfo::Type action_type,
const ActionInfo* action_info,
Profile* profile) {
std::map<std::string, linked_ptr<ExtensionAction> >::const_iterator it =
map->find(extension.id());
auto it = map->find(extension.id());
if (it != map->end())
return it->second.get();
if (!action_info)
return NULL;
return nullptr;
// Only create action info for enabled extensions.
// This avoids bugs where actions are recreated just after being removed
// in response to OnExtensionUnloaded().
if (!ExtensionRegistry::Get(profile)
->enabled_extensions().Contains(extension.id())) {
return NULL;
return nullptr;
}
linked_ptr<ExtensionAction> action(new ExtensionAction(
extension, action_type, *action_info));
(*map)[extension.id()] = action;
return action.get();
std::unique_ptr<ExtensionAction> action(
new ExtensionAction(extension, action_type, *action_info));
ExtensionAction* raw_action = action.get();
(*map)[extension.id()] = std::move(action);
return raw_action;
}
} // namespace
......@@ -143,9 +143,8 @@ std::unique_ptr<ExtensionAction> ExtensionActionManager::GetBestFitAction(
// If no ActionInfo exists for |extension|, create and return a new action
// with a blank ActionInfo.
// Populate any missing values from |extension|'s manifest.
std::unique_ptr<ExtensionAction> new_action(
new ExtensionAction(extension, type, info ? *info : ActionInfo()));
return new_action;
return base::MakeUnique<ExtensionAction>(extension, type,
info ? *info : ActionInfo());
}
ExtensionAction* ExtensionActionManager::GetSystemIndicator(
......@@ -155,7 +154,7 @@ ExtensionAction* ExtensionActionManager::GetSystemIndicator(
// unavailable on the current system. If so, return NULL to signal that
// the system indicator area is unusable.
if (!SystemIndicatorManagerFactory::GetForProfile(profile_))
return NULL;
return nullptr;
return GetOrCreateOrNull(&system_indicators_, extension,
ActionInfo::TYPE_SYSTEM_INDICATOR,
......
......@@ -6,6 +6,7 @@
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_
#include <map>
#include <memory>
#include <string>
#include "base/scoped_observer.h"
......@@ -71,7 +72,8 @@ class ExtensionActionManager : public KeyedService,
// ExtensionAction is first requested, and the entries are removed when the
// extension is unloaded. Not every extension has a page action or browser
// action.
typedef std::map<std::string, linked_ptr<ExtensionAction> > ExtIdToActionMap;
using ExtIdToActionMap =
std::map<std::string, std::unique_ptr<ExtensionAction>>;
mutable ExtIdToActionMap page_actions_;
mutable ExtIdToActionMap browser_actions_;
mutable ExtIdToActionMap system_indicators_;
......
......@@ -184,6 +184,8 @@ class ActiveScriptTester {
testing::AssertionResult Verify();
std::string name() const;
private:
// Returns the ExtensionActionRunner, or null if one does not exist.
ExtensionActionRunner* GetExtensionActionRunner();
......@@ -205,13 +207,10 @@ class ActiveScriptTester {
// asking the user.
RequiresConsent requires_consent_;
// The type of injection this tester uses.
InjectionType type_;
// All of these extensions should inject a script (either through content
// scripts or through chrome.tabs.executeScript()) that sends a message with
// the |kInjectSucceeded| message.
linked_ptr<ExtensionTestMessageListener> inject_success_listener_;
std::unique_ptr<ExtensionTestMessageListener> inject_success_listener_;
};
ActiveScriptTester::ActiveScriptTester(const std::string& name,
......@@ -223,7 +222,6 @@ ActiveScriptTester::ActiveScriptTester(const std::string& name,
extension_(extension),
browser_(browser),
requires_consent_(requires_consent),
type_(type),
inject_success_listener_(
new ExtensionTestMessageListener(kInjectSucceeded,
false /* won't reply */)) {
......@@ -232,6 +230,10 @@ ActiveScriptTester::ActiveScriptTester(const std::string& name,
ActiveScriptTester::~ActiveScriptTester() {}
std::string ActiveScriptTester::name() const {
return name_;
}
testing::AssertionResult ActiveScriptTester::Verify() {
if (!extension_)
return testing::AssertionFailure() << "Could not load extension: " << name_;
......@@ -308,13 +310,6 @@ bool ActiveScriptTester::WantsToRun() {
IN_PROC_BROWSER_TEST_F(ExtensionActionRunnerBrowserTest,
ActiveScriptsAreDisplayedAndDelayExecution) {
base::FilePath active_script_path =
test_data_dir_.AppendASCII("active_script");
const char* const kExtensionNames[] = {
"inject_scripts_all_hosts", "inject_scripts_explicit_hosts",
"content_scripts_all_hosts", "content_scripts_explicit_hosts"};
// First, we load up three extensions:
// - An extension that injects scripts into all hosts,
// - An extension that injects scripts into explicit hosts,
......@@ -322,20 +317,21 @@ IN_PROC_BROWSER_TEST_F(ExtensionActionRunnerBrowserTest,
// - An extension with a content script that runs on explicit hosts.
// The extensions that operate on explicit hosts have permission; the ones
// that request all hosts require user consent.
ActiveScriptTester testers[] = {
ActiveScriptTester(kExtensionNames[0],
CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT), browser(),
REQUIRES_CONSENT, EXECUTE_SCRIPT),
ActiveScriptTester(kExtensionNames[1],
CreateExtension(EXPLICIT_HOSTS, EXECUTE_SCRIPT),
browser(), DOES_NOT_REQUIRE_CONSENT, EXECUTE_SCRIPT),
ActiveScriptTester(kExtensionNames[2],
CreateExtension(ALL_HOSTS, CONTENT_SCRIPT), browser(),
REQUIRES_CONSENT, CONTENT_SCRIPT),
ActiveScriptTester(kExtensionNames[3],
CreateExtension(EXPLICIT_HOSTS, CONTENT_SCRIPT),
browser(), DOES_NOT_REQUIRE_CONSENT, CONTENT_SCRIPT),
};
std::vector<std::unique_ptr<ActiveScriptTester>> testers;
testers.push_back(base::MakeUnique<ActiveScriptTester>(
"inject_scripts_all_hosts", CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT),
browser(), REQUIRES_CONSENT, EXECUTE_SCRIPT));
testers.push_back(base::MakeUnique<ActiveScriptTester>(
"inject_scripts_explicit_hosts",
CreateExtension(EXPLICIT_HOSTS, EXECUTE_SCRIPT), browser(),
DOES_NOT_REQUIRE_CONSENT, EXECUTE_SCRIPT));
testers.push_back(base::MakeUnique<ActiveScriptTester>(
"content_scripts_all_hosts", CreateExtension(ALL_HOSTS, CONTENT_SCRIPT),
browser(), REQUIRES_CONSENT, CONTENT_SCRIPT));
testers.push_back(base::MakeUnique<ActiveScriptTester>(
"content_scripts_explicit_hosts",
CreateExtension(EXPLICIT_HOSTS, CONTENT_SCRIPT), browser(),
DOES_NOT_REQUIRE_CONSENT, CONTENT_SCRIPT));
// Navigate to an URL (which matches the explicit host specified in the
// extension content_scripts_explicit_hosts). All four extensions should
......@@ -344,8 +340,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionActionRunnerBrowserTest,
ui_test_utils::NavigateToURL(
browser(), embedded_test_server()->GetURL("/extensions/test_file.html"));
for (size_t i = 0u; i < arraysize(testers); ++i)
EXPECT_TRUE(testers[i].Verify()) << kExtensionNames[i];
for (const auto& tester : testers)
EXPECT_TRUE(tester->Verify()) << tester->name();
}
// Test that removing an extension with pending injections a) removes the
......@@ -548,24 +544,20 @@ class FlagOffExtensionActionRunnerBrowserTest
IN_PROC_BROWSER_TEST_F(FlagOffExtensionActionRunnerBrowserTest,
ScriptsExecuteWhenFlagAbsent) {
const char* const kExtensionNames[] = {
"content_scripts_all_hosts", "inject_scripts_all_hosts",
};
ActiveScriptTester testers[] = {
ActiveScriptTester(kExtensionNames[0],
CreateExtension(ALL_HOSTS, CONTENT_SCRIPT), browser(),
DOES_NOT_REQUIRE_CONSENT, CONTENT_SCRIPT),
ActiveScriptTester(kExtensionNames[1],
CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT), browser(),
DOES_NOT_REQUIRE_CONSENT, EXECUTE_SCRIPT),
};
std::vector<std::unique_ptr<ActiveScriptTester>> testers;
testers.push_back(base::MakeUnique<ActiveScriptTester>(
"content_scripts_all_hosts", CreateExtension(ALL_HOSTS, CONTENT_SCRIPT),
browser(), DOES_NOT_REQUIRE_CONSENT, CONTENT_SCRIPT));
testers.push_back(base::MakeUnique<ActiveScriptTester>(
"inject_scripts_all_hosts", CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT),
browser(), DOES_NOT_REQUIRE_CONSENT, EXECUTE_SCRIPT));
ASSERT_TRUE(embedded_test_server()->Start());
ui_test_utils::NavigateToURL(
browser(), embedded_test_server()->GetURL("/extensions/test_file.html"));
for (size_t i = 0u; i < arraysize(testers); ++i)
EXPECT_TRUE(testers[i].Verify()) << kExtensionNames[i];
for (const auto& tester : testers)
EXPECT_TRUE(tester->Verify()) << tester->name();
}
} // namespace extensions
......@@ -300,11 +300,11 @@ void InstallVerifier::AddMany(const ExtensionIdSet& ids, OperationType type) {
}
}
InstallVerifier::PendingOperation* operation =
new InstallVerifier::PendingOperation(type);
std::unique_ptr<InstallVerifier::PendingOperation> operation(
new InstallVerifier::PendingOperation(type));
operation->ids.insert(ids.begin(), ids.end());
operation_queue_.push(linked_ptr<PendingOperation>(operation));
operation_queue_.push(std::move(operation));
// If there are no ongoing pending requests, we need to kick one off.
if (operation_queue_.size() == 1)
......@@ -337,11 +337,11 @@ void InstallVerifier::RemoveMany(const ExtensionIdSet& ids) {
if (!found_any)
return;
InstallVerifier::PendingOperation* operation =
new InstallVerifier::PendingOperation(InstallVerifier::REMOVE);
std::unique_ptr<InstallVerifier::PendingOperation> operation(
new InstallVerifier::PendingOperation(InstallVerifier::REMOVE));
operation->ids = ids;
operation_queue_.push(linked_ptr<PendingOperation>(operation));
operation_queue_.push(std::move(operation));
if (operation_queue_.size() == 1)
BeginFetch();
}
......@@ -628,7 +628,8 @@ void GetSignatureResultHistogram(CallbackResult result) {
void InstallVerifier::SignatureCallback(
std::unique_ptr<InstallSignature> signature) {
linked_ptr<PendingOperation> operation = operation_queue_.front();
std::unique_ptr<PendingOperation> operation =
std::move(operation_queue_.front());
operation_queue_.pop();
bool success = false;
......
......@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/management_policy.h"
......@@ -170,7 +169,7 @@ class InstallVerifier : public KeyedService,
std::unique_ptr<InstallSigner> signer_;
// A queue of operations to apply to the current set of allowed ids.
std::queue<linked_ptr<PendingOperation> > operation_queue_;
std::queue<std::unique_ptr<PendingOperation>> operation_queue_;
// A set of ids that have been provisionally added, which we're willing to
// consider allowed until we hear back from the server signature request.
......
......@@ -56,13 +56,14 @@ std::vector<ExtensionAction*> LocationBarController::GetCurrentActions() {
if (existing != active_script_actions_.end()) {
action = existing->second.get();
} else {
linked_ptr<ExtensionAction> active_script_action(
ExtensionActionManager::Get(browser_context_)->
GetBestFitAction(*extension, ActionInfo::TYPE_PAGE).release());
std::unique_ptr<ExtensionAction> active_script_action =
ExtensionActionManager::Get(browser_context_)
->GetBestFitAction(*extension, ActionInfo::TYPE_PAGE);
active_script_action->SetIsVisible(
ExtensionAction::kDefaultTabId, true);
active_script_actions_[extension->id()] = active_script_action;
action = active_script_action.get();
active_script_actions_[extension->id()] =
std::move(active_script_action);
}
}
......
......@@ -6,10 +6,10 @@
#define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_
#include <map>
#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/scoped_observer.h"
#include "extensions/browser/extension_registry_observer.h"
......@@ -58,8 +58,8 @@ class LocationBarController : public ExtensionRegistryObserver {
// Manufactured page actions that have been generated for extensions that want
// to run a script, but were blocked.
typedef std::map<std::string, linked_ptr<ExtensionAction> >
ExtensionActionMap;
using ExtensionActionMap =
std::map<std::string, std::unique_ptr<ExtensionAction>>;
ExtensionActionMap active_script_actions_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
......
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