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

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

Issue 11859029: Add a policy to hide the Web Store on new tabs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check that footer exists before removing icon Created 7 years, 11 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 | Annotate | Revision Log
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/ntp_resource_cache.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged, 180 base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged,
181 base::Unretained(this)); 181 base::Unretained(this));
182 182
183 // Watch for pref changes that cause us to need to invalidate the HTML cache. 183 // Watch for pref changes that cause us to need to invalidate the HTML cache.
184 pref_change_registrar_.Init(profile_->GetPrefs()); 184 pref_change_registrar_.Init(profile_->GetPrefs());
185 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, callback); 185 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, callback);
186 pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback); 186 pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback);
187 pref_change_registrar_.Add(prefs::kNtpShownPage, callback); 187 pref_change_registrar_.Add(prefs::kNtpShownPage, callback);
188 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, callback); 188 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, callback);
189 pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback);
189 } 190 }
190 191
191 NTPResourceCache::~NTPResourceCache() {} 192 NTPResourceCache::~NTPResourceCache() {}
192 193
193 bool NTPResourceCache::NewTabCacheNeedsRefresh() { 194 bool NTPResourceCache::NewTabCacheNeedsRefresh() {
194 #if defined(OS_MACOSX) 195 #if defined(OS_MACOSX)
195 // Invalidate if the current value is different from the cached value. 196 // Invalidate if the current value is different from the cached value.
196 bool is_enabled = platform_util::IsSwipeTrackingFromScrollEventsEnabled(); 197 bool is_enabled = platform_util::IsSwipeTrackingFromScrollEventsEnabled();
197 if (is_enabled != is_swipe_tracking_from_scroll_events_enabled_) { 198 if (is_enabled != is_swipe_tracking_from_scroll_events_enabled_) {
198 is_swipe_tracking_from_scroll_events_enabled_ = is_enabled; 199 is_swipe_tracking_from_scroll_events_enabled_ = is_enabled;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 l10n_util::GetStringUTF16(IDS_NEW_TAB_TILE_GRID_ACCESSIBLE_DESCRIPTION)); 400 l10n_util::GetStringUTF16(IDS_NEW_TAB_TILE_GRID_ACCESSIBLE_DESCRIPTION));
400 load_time_data.SetString("page_switcher_change_title", 401 load_time_data.SetString("page_switcher_change_title",
401 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_CHANGE_TITLE)); 402 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_CHANGE_TITLE));
402 load_time_data.SetString("page_switcher_same_title", 403 load_time_data.SetString("page_switcher_same_title",
403 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_SAME_TITLE)); 404 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_SAME_TITLE));
404 // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or 405 // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or
405 // forward gesture. Pass through a flag that indicates whether or not that 406 // forward gesture. Pass through a flag that indicates whether or not that
406 // feature is enabled. 407 // feature is enabled.
407 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled", 408 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled",
408 is_swipe_tracking_from_scroll_events_enabled_); 409 is_swipe_tracking_from_scroll_events_enabled_);
410 load_time_data.SetBoolean("isWebStoreIconHidden",
411 prefs->GetBoolean(prefs::kHideWebStoreIcon));
409 412
410 #if defined(OS_CHROMEOS) 413 #if defined(OS_CHROMEOS)
411 load_time_data.SetString("expandMenu", 414 load_time_data.SetString("expandMenu",
412 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); 415 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND));
413 #endif 416 #endif
414 417
415 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); 418 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data);
416 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); 419 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data);
417 420
418 web_ui_util::SetFontAndTextDirection(&load_time_data); 421 web_ui_util::SetFontAndTextDirection(&load_time_data);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // Get our template. 592 // Get our template.
590 static const base::StringPiece new_tab_theme_css( 593 static const base::StringPiece new_tab_theme_css(
591 ResourceBundle::GetSharedInstance().GetRawDataResource(is_ntp_search ? 594 ResourceBundle::GetSharedInstance().GetRawDataResource(is_ntp_search ?
592 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); 595 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS));
593 596
594 // Create the string from our template and the replacements. 597 // Create the string from our template and the replacements.
595 std::string css_string; 598 std::string css_string;
596 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 599 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
597 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 600 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
598 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698