OLD | NEW |
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 <memory> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 pref_change_registrar_.Init(profile->GetPrefs()); | 83 pref_change_registrar_.Init(profile->GetPrefs()); |
84 pref_change_registrar_.Add(bookmarks::prefs::kShowBookmarkBar, | 84 pref_change_registrar_.Add(bookmarks::prefs::kShowBookmarkBar, |
85 base::Bind(&NewTabUI::OnShowBookmarkBarChanged, | 85 base::Bind(&NewTabUI::OnShowBookmarkBarChanged, |
86 base::Unretained(this))); | 86 base::Unretained(this))); |
87 } | 87 } |
88 | 88 |
89 NewTabUI::~NewTabUI() {} | 89 NewTabUI::~NewTabUI() {} |
90 | 90 |
91 void NewTabUI::OnShowBookmarkBarChanged() { | 91 void NewTabUI::OnShowBookmarkBarChanged() { |
92 base::StringValue attached( | 92 base::Value attached( |
93 GetProfile()->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar) ? | 93 GetProfile()->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar) |
94 "true" : "false"); | 94 ? "true" |
| 95 : "false"); |
95 web_ui()->CallJavascriptFunctionUnsafe("ntp.setBookmarkBarAttached", | 96 web_ui()->CallJavascriptFunctionUnsafe("ntp.setBookmarkBarAttached", |
96 attached); | 97 attached); |
97 } | 98 } |
98 | 99 |
99 // static | 100 // static |
100 void NewTabUI::RegisterProfilePrefs( | 101 void NewTabUI::RegisterProfilePrefs( |
101 user_prefs::PrefRegistrySyncable* registry) { | 102 user_prefs::PrefRegistrySyncable* registry) { |
102 CoreAppLauncherHandler::RegisterProfilePrefs(registry); | 103 CoreAppLauncherHandler::RegisterProfilePrefs(registry); |
103 AppLauncherHandler::RegisterProfilePrefs(registry); | 104 AppLauncherHandler::RegisterProfilePrefs(registry); |
104 } | 105 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 252 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
252 const char* mime_type, | 253 const char* mime_type, |
253 int resource_id) { | 254 int resource_id) { |
254 DCHECK(resource); | 255 DCHECK(resource); |
255 DCHECK(mime_type); | 256 DCHECK(mime_type); |
256 resource_map_[std::string(resource)] = | 257 resource_map_[std::string(resource)] = |
257 std::make_pair(std::string(mime_type), resource_id); | 258 std::make_pair(std::string(mime_type), resource_id); |
258 } | 259 } |
259 | 260 |
260 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} | 261 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} |
OLD | NEW |