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

Unified Diff: chrome/browser/ui/webui/uber/uber_ui.cc

Issue 2439273002: Clean up ownership in WebUI creation. (Closed)
Patch Set: Created 4 years, 2 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/webui/uber/uber_ui.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/uber/uber_ui.cc
diff --git a/chrome/browser/ui/webui/uber/uber_ui.cc b/chrome/browser/ui/webui/uber/uber_ui.cc
index e3f1a7765b1ba07431acf2ece38046a01f61c477..c4e542454d9eb540397d39f6a7e5f9f3ff9d6c45 100644
--- a/chrome/browser/ui/webui/uber/uber_ui.cc
+++ b/chrome/browser/ui/webui/uber/uber_ui.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/uber/uber_ui.h"
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
@@ -174,7 +175,6 @@ UberUI::UberUI(content::WebUI* web_ui)
}
UberUI::~UberUI() {
- base::STLDeleteValues(&sub_uis_);
}
void UberUI::RegisterSubpage(const std::string& page_url,
@@ -185,13 +185,12 @@ void UberUI::RegisterSubpage(const std::string& page_url,
content::WebUI* UberUI::GetSubpage(const std::string& page_url) {
if (!base::ContainsKey(sub_uis_, page_url))
- return NULL;
- return sub_uis_[page_url];
+ return nullptr;
+ return sub_uis_[page_url].get();
}
void UberUI::RenderViewCreated(RenderViewHost* render_view_host) {
- for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end();
- ++iter) {
+ for (auto iter = sub_uis_.begin(); iter != sub_uis_.end(); ++iter) {
iter->second->GetController()->RenderViewCreated(render_view_host);
}
}
@@ -200,7 +199,7 @@ bool UberUI::OverrideHandleWebUIMessage(const GURL& source_url,
const std::string& message,
const base::ListValue& args) {
// Find the appropriate subpage and forward the message.
- SubpageMap::iterator subpage = sub_uis_.find(source_url.GetOrigin().spec());
+ auto subpage = sub_uis_.find(source_url.GetOrigin().spec());
if (subpage == sub_uis_.end()) {
// The message was sent from the uber page itself.
DCHECK_EQ(std::string(chrome::kChromeUIUberHost), source_url.host());
« no previous file with comments | « chrome/browser/ui/webui/uber/uber_ui.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698