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

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

Issue 11953021: Don't show the apps page on the NTP if the app launcher is installed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move getShouldShowApps message to onLoad. 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/memory/singleton.h" 16 #include "base/memory/singleton.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/string_number_conversions.h" 18 #include "base/string_number_conversions.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "chrome/browser/defaults.h" 21 #include "chrome/browser/defaults.h"
22 #include "chrome/browser/extensions/app_launcher.h"
22 #include "chrome/browser/prefs/pref_service.h" 23 #include "chrome/browser/prefs/pref_service.h"
23 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/sessions/session_types.h" 25 #include "chrome/browser/sessions/session_types.h"
25 #include "chrome/browser/sync/profile_sync_service.h" 26 #include "chrome/browser/sync/profile_sync_service.h"
26 #include "chrome/browser/themes/theme_service.h" 27 #include "chrome/browser/themes/theme_service.h"
27 #include "chrome/browser/themes/theme_service_factory.h" 28 #include "chrome/browser/themes/theme_service_factory.h"
28 #include "chrome/browser/ui/browser.h" 29 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 30 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
30 #include "chrome/browser/ui/webui/metrics_handler.h" 31 #include "chrome/browser/ui/webui/metrics_handler.h"
31 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" 32 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 NewTabPageHandler::RegisterUserPrefs(prefs); 288 NewTabPageHandler::RegisterUserPrefs(prefs);
288 if (NewTabUI::IsDiscoveryInNTPEnabled()) 289 if (NewTabUI::IsDiscoveryInNTPEnabled())
289 SuggestionsHandler::RegisterUserPrefs(prefs); 290 SuggestionsHandler::RegisterUserPrefs(prefs);
290 #endif 291 #endif
291 MostVisitedHandler::RegisterUserPrefs(prefs); 292 MostVisitedHandler::RegisterUserPrefs(prefs);
292 browser_sync::ForeignSessionHandler::RegisterUserPrefs(prefs); 293 browser_sync::ForeignSessionHandler::RegisterUserPrefs(prefs);
293 } 294 }
294 295
295 // static 296 // static
296 bool NewTabUI::ShouldShowApps() { 297 bool NewTabUI::ShouldShowApps() {
297 #if defined(USE_ASH) || defined(OS_ANDROID) 298 #if defined(OS_ANDROID)
298 // Ash shows apps in app list thus should not show apps page in NTP4. 299 // Ash shows apps in app list thus should not show apps page in NTP4.
299 // Android does not have apps. 300 // Android does not have apps.
300 return false; 301 return false;
301 #else 302 #else
302 return !CommandLine::ForCurrentProcess()->HasSwitch( 303 return !extensions::IsAppLauncherEnabled();
303 switches::kShowAppListShortcut);
304 #endif 304 #endif
305 } 305 }
306 306
307 // static 307 // static
308 bool NewTabUI::IsDiscoveryInNTPEnabled() { 308 bool NewTabUI::IsDiscoveryInNTPEnabled() {
309 // TODO(beaudoin): The flag was removed during a clean-up pass. We leave that 309 // TODO(beaudoin): The flag was removed during a clean-up pass. We leave that
310 // here to easily enable it back when we will explore this option again. 310 // here to easily enable it back when we will explore this option again.
311 return false; 311 return false;
312 } 312 }
313 313
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 428 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
429 const char* mime_type, 429 const char* mime_type,
430 int resource_id) { 430 int resource_id) {
431 DCHECK(resource); 431 DCHECK(resource);
432 DCHECK(mime_type); 432 DCHECK(mime_type);
433 resource_map_[std::string(resource)] = 433 resource_map_[std::string(resource)] =
434 std::make_pair(std::string(mime_type), resource_id); 434 std::make_pair(std::string(mime_type), resource_id);
435 } 435 }
436 436
437 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} 437 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_handler.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698