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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 5 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
6 6
7 #include <memory>
7 #include <set> 8 #include <set>
8 9
9 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
10 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
11 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/webui/metrics_handler.h" 16 #include "chrome/browser/ui/webui/metrics_handler.h"
17 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 17 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
18 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" 18 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
19 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" 19 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h"
20 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" 20 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
21 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" 21 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // for example). 76 // for example).
77 if (service) 77 if (service)
78 web_ui->AddMessageHandler(new AppLauncherHandler(service)); 78 web_ui->AddMessageHandler(new AppLauncherHandler(service));
79 } 79 }
80 80
81 #if defined(ENABLE_THEMES) 81 #if defined(ENABLE_THEMES)
82 if (!profile->IsGuestSession()) 82 if (!profile->IsGuestSession())
83 web_ui->AddMessageHandler(new ThemeHandler()); 83 web_ui->AddMessageHandler(new ThemeHandler());
84 #endif 84 #endif
85 85
86 scoped_ptr<NewTabHTMLSource> html_source( 86 std::unique_ptr<NewTabHTMLSource> html_source(
87 new NewTabHTMLSource(profile->GetOriginalProfile())); 87 new NewTabHTMLSource(profile->GetOriginalProfile()));
88 88
89 // content::URLDataSource assumes the ownership of the html_source. 89 // content::URLDataSource assumes the ownership of the html_source.
90 content::URLDataSource::Add(profile, html_source.release()); 90 content::URLDataSource::Add(profile, html_source.release());
91 91
92 pref_change_registrar_.Init(profile->GetPrefs()); 92 pref_change_registrar_.Init(profile->GetPrefs());
93 pref_change_registrar_.Add(bookmarks::prefs::kShowBookmarkBar, 93 pref_change_registrar_.Add(bookmarks::prefs::kShowBookmarkBar,
94 base::Bind(&NewTabUI::OnShowBookmarkBarChanged, 94 base::Bind(&NewTabUI::OnShowBookmarkBarChanged,
95 base::Unretained(this))); 95 base::Unretained(this)));
96 } 96 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 244 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
245 const char* mime_type, 245 const char* mime_type,
246 int resource_id) { 246 int resource_id) {
247 DCHECK(resource); 247 DCHECK(resource);
248 DCHECK(mime_type); 248 DCHECK(mime_type);
249 resource_map_[std::string(resource)] = 249 resource_map_[std::string(resource)] =
250 std::make_pair(std::string(mime_type), resource_id); 250 std::make_pair(std::string(mime_type), resource_id);
251 } 251 }
252 252
253 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} 253 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/favicon_webui_handler.cc ('k') | chrome/browser/ui/webui/omnibox/omnibox_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698