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

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

Issue 490123003: Move bookmark_pref_names.* into bookmarks namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 6 years, 3 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 <set> 7 #include <set>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 html_source->AddResource("suggestions_page.css", "text/css", 130 html_source->AddResource("suggestions_page.css", "text/css",
131 NewTabUI::IsDiscoveryInNTPEnabled() ? IDR_SUGGESTIONS_PAGE_CSS : 0); 131 NewTabUI::IsDiscoveryInNTPEnabled() ? IDR_SUGGESTIONS_PAGE_CSS : 0);
132 if (NewTabUI::IsDiscoveryInNTPEnabled()) { 132 if (NewTabUI::IsDiscoveryInNTPEnabled()) {
133 html_source->AddResource("suggestions_page.js", "application/javascript", 133 html_source->AddResource("suggestions_page.js", "application/javascript",
134 IDR_SUGGESTIONS_PAGE_JS); 134 IDR_SUGGESTIONS_PAGE_JS);
135 } 135 }
136 // content::URLDataSource assumes the ownership of the html_source. 136 // content::URLDataSource assumes the ownership of the html_source.
137 content::URLDataSource::Add(profile, html_source.release()); 137 content::URLDataSource::Add(profile, html_source.release());
138 138
139 pref_change_registrar_.Init(profile->GetPrefs()); 139 pref_change_registrar_.Init(profile->GetPrefs());
140 pref_change_registrar_.Add(prefs::kShowBookmarkBar, 140 pref_change_registrar_.Add(bookmarks::prefs::kShowBookmarkBar,
141 base::Bind(&NewTabUI::OnShowBookmarkBarChanged, 141 base::Bind(&NewTabUI::OnShowBookmarkBarChanged,
142 base::Unretained(this))); 142 base::Unretained(this)));
143 } 143 }
144 144
145 NewTabUI::~NewTabUI() { 145 NewTabUI::~NewTabUI() {
146 g_live_new_tabs.Pointer()->erase(this); 146 g_live_new_tabs.Pointer()->erase(this);
147 } 147 }
148 148
149 // The timer callback. If enough time has elapsed since the last paint 149 // The timer callback. If enough time has elapsed since the last paint
150 // message, we say we're done painting; otherwise, we keep waiting. 150 // message, we say we're done painting; otherwise, we keep waiting.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 } 210 }
211 211
212 void NewTabUI::EmitNtpStatistics() { 212 void NewTabUI::EmitNtpStatistics() {
213 NTPUserDataLogger::GetOrCreateFromWebContents( 213 NTPUserDataLogger::GetOrCreateFromWebContents(
214 web_contents())->EmitNtpStatistics(); 214 web_contents())->EmitNtpStatistics();
215 } 215 }
216 216
217 void NewTabUI::OnShowBookmarkBarChanged() { 217 void NewTabUI::OnShowBookmarkBarChanged() {
218 base::StringValue attached( 218 base::StringValue attached(
219 GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? 219 GetProfile()->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar) ?
220 "true" : "false"); 220 "true" : "false");
221 web_ui()->CallJavascriptFunction("ntp.setBookmarkBarAttached", attached); 221 web_ui()->CallJavascriptFunction("ntp.setBookmarkBarAttached", attached);
222 } 222 }
223 223
224 // static 224 // static
225 void NewTabUI::RegisterProfilePrefs( 225 void NewTabUI::RegisterProfilePrefs(
226 user_prefs::PrefRegistrySyncable* registry) { 226 user_prefs::PrefRegistrySyncable* registry) {
227 CoreAppLauncherHandler::RegisterProfilePrefs(registry); 227 CoreAppLauncherHandler::RegisterProfilePrefs(registry);
228 NewTabPageHandler::RegisterProfilePrefs(registry); 228 NewTabPageHandler::RegisterProfilePrefs(registry);
229 if (NewTabUI::IsDiscoveryInNTPEnabled()) 229 if (NewTabUI::IsDiscoveryInNTPEnabled())
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 370 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
371 const char* mime_type, 371 const char* mime_type,
372 int resource_id) { 372 int resource_id) {
373 DCHECK(resource); 373 DCHECK(resource);
374 DCHECK(mime_type); 374 DCHECK(mime_type);
375 resource_map_[std::string(resource)] = 375 resource_map_[std::string(resource)] =
376 std::make_pair(std::string(mime_type), resource_id); 376 std::make_pair(std::string(mime_type), resource_id);
377 } 377 }
378 378
379 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} 379 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698