Convert //content/browser/frame_host from scoped_ptr to std::unique_ptr
BUG=554298
[email protected]
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Review URL: https://codereview.chromium.org/1867313003
Cr-Commit-Position: refs/heads/master@{#386265}
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index ac57709..6732fefb 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -40,6 +40,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h" // Temporary
#include "base/strings/string_util.h"
@@ -130,7 +131,7 @@
// Configure all the NavigationEntries in entries for restore. This resets
// the transition type to reload and makes sure the content state isn't empty.
void ConfigureEntriesForRestore(
- std::vector<scoped_ptr<NavigationEntryImpl>>* entries,
+ std::vector<std::unique_ptr<NavigationEntryImpl>>* entries,
NavigationController::RestoreType type) {
for (size_t i = 0; i < entries->size(); ++i) {
// Use a transition type of reload so that we don't incorrectly increase
@@ -163,13 +164,13 @@
static bool g_check_for_repost = true;
// static
-scoped_ptr<NavigationEntry> NavigationController::CreateNavigationEntry(
- const GURL& url,
- const Referrer& referrer,
- ui::PageTransition transition,
- bool is_renderer_initiated,
- const std::string& extra_headers,
- BrowserContext* browser_context) {
+std::unique_ptr<NavigationEntry> NavigationController::CreateNavigationEntry(
+ const GURL& url,
+ const Referrer& referrer,
+ ui::PageTransition transition,
+ bool is_renderer_initiated,
+ const std::string& extra_headers,
+ BrowserContext* browser_context) {
// Fix up the given URL before letting it be rewritten, so that any minor
// cleanup (e.g., removing leading dots) will not lead to a virtual URL.
GURL dest_url(url);
@@ -198,7 +199,7 @@
entry->set_user_typed_url(dest_url);
entry->set_update_virtual_url_with_url(reverse_on_redirect);
entry->set_extra_headers(extra_headers);
- return make_scoped_ptr(entry);
+ return base::WrapUnique(entry);
}
// static
@@ -263,7 +264,7 @@
void NavigationControllerImpl::Restore(
int selected_navigation,
RestoreType type,
- std::vector<scoped_ptr<NavigationEntry>>* entries) {
+ std::vector<std::unique_ptr<NavigationEntry>>* entries) {
// Verify that this controller is unused and that the input is valid.
DCHECK(GetEntryCount() == 0 && !GetPendingEntry());
DCHECK(selected_navigation >= 0 &&
@@ -453,7 +454,7 @@
}
void NavigationControllerImpl::LoadEntry(
- scoped_ptr<NavigationEntryImpl> entry) {
+ std::unique_ptr<NavigationEntryImpl> entry) {
// When navigating to a new page, we don't know for sure if we will actually
// end up leaving the current page. The new page load could for example
// result in a download or a 'no content' response (e.g., a mailto: URL).
@@ -462,7 +463,7 @@
}
void NavigationControllerImpl::SetPendingEntry(
- scoped_ptr<NavigationEntryImpl> entry) {
+ std::unique_ptr<NavigationEntryImpl> entry) {
DiscardNonCommittedEntriesInternal();
pending_entry_ = entry.release();
NotificationService::current()->Notify(
@@ -567,7 +568,7 @@
}
void NavigationControllerImpl::SetScreenshotManager(
- scoped_ptr<NavigationEntryScreenshotManager> manager) {
+ std::unique_ptr<NavigationEntryScreenshotManager> manager) {
if (manager.get())
screenshot_manager_ = std::move(manager);
else
@@ -715,7 +716,7 @@
break;
}
- scoped_ptr<NavigationEntryImpl> entry;
+ std::unique_ptr<NavigationEntryImpl> entry;
// For subframes, create a pending entry with a corresponding frame entry.
int frame_tree_node_id = params.frame_tree_node_id;
@@ -1067,7 +1068,7 @@
RenderFrameHostImpl* rfh,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
bool replace_entry) {
- scoped_ptr<NavigationEntryImpl> new_entry;
+ std::unique_ptr<NavigationEntryImpl> new_entry;
bool update_virtual_url;
// Only make a copy of the pending entry if it is appropriate for the new page
// that was just loaded. Verify this by checking if the entry corresponds
@@ -1088,7 +1089,7 @@
update_virtual_url = new_entry->update_virtual_url_with_url();
} else {
- new_entry = make_scoped_ptr(new NavigationEntryImpl);
+ new_entry = base::WrapUnique(new NavigationEntryImpl);
// Find out whether the new entry needs to update its virtual URL on URL
// change and set up the entry accordingly. This is needed to correctly
@@ -1260,7 +1261,7 @@
DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee "
<< "that a last committed entry exists.";
- scoped_ptr<NavigationEntryImpl> new_entry;
+ std::unique_ptr<NavigationEntryImpl> new_entry;
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
// Make sure new_entry takes ownership of frame_entry in a scoped_refptr.
FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
@@ -1658,7 +1659,8 @@
}
void NavigationControllerImpl::InsertOrReplaceEntry(
- scoped_ptr<NavigationEntryImpl> entry, bool replace) {
+ std::unique_ptr<NavigationEntryImpl> entry,
+ bool replace) {
DCHECK(entry->GetTransitionType() != ui::PAGE_TRANSITION_AUTO_SUBFRAME);
// If the pending_entry_index_ is -1, the navigation was to a new page, and we
@@ -2011,7 +2013,7 @@
}
void NavigationControllerImpl::SetTransientEntry(
- scoped_ptr<NavigationEntry> entry) {
+ std::unique_ptr<NavigationEntry> entry) {
// Discard any current transient entry, we can only have one at a time.
int index = 0;
if (last_committed_entry_index_ != -1)