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

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

Issue 13926002: Always show the NTP apps page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 <set> 7 #include <set>
8 8
9 #include "apps/app_launcher.h" 9 #include "apps/app_launcher.h"
benwells 2013/04/09 05:42:57 Can this header be removed?
calamity 2013/04/09 06:50:01 Done.
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/webui/metrics_handler.h" 17 #include "chrome/browser/ui/webui/metrics_handler.h"
18 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" 18 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h"
19 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h" 19 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h"
(...skipping 25 matching lines...) Expand all
45 #include "chrome/browser/ui/webui/ntp/android/bookmarks_handler.h" 45 #include "chrome/browser/ui/webui/ntp/android/bookmarks_handler.h"
46 #include "chrome/browser/ui/webui/ntp/android/context_menu_handler.h" 46 #include "chrome/browser/ui/webui/ntp/android/context_menu_handler.h"
47 #include "chrome/browser/ui/webui/ntp/android/new_tab_page_ready_handler.h" 47 #include "chrome/browser/ui/webui/ntp/android/new_tab_page_ready_handler.h"
48 #include "chrome/browser/ui/webui/ntp/android/promo_handler.h" 48 #include "chrome/browser/ui/webui/ntp/android/promo_handler.h"
49 #endif 49 #endif
50 50
51 #if defined(ENABLE_THEMES) 51 #if defined(ENABLE_THEMES)
52 #include "chrome/browser/ui/webui/theme_handler.h" 52 #include "chrome/browser/ui/webui/theme_handler.h"
53 #endif 53 #endif
54 54
55 #if defined(USE_ASH)
56 #include "chrome/browser/ui/host_desktop.h"
57 #endif
58
55 using content::BrowserThread; 59 using content::BrowserThread;
56 using content::RenderViewHost; 60 using content::RenderViewHost;
57 using content::WebUIController; 61 using content::WebUIController;
58 62
59 namespace { 63 namespace {
60 64
61 // The amount of time there must be no painting for us to consider painting 65 // The amount of time there must be no painting for us to consider painting
62 // finished. Observed times are in the ~1200ms range on Windows. 66 // finished. Observed times are in the ~1200ms range on Windows.
63 const int kTimeoutMs = 2000; 67 const int kTimeoutMs = 2000;
64 68
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 NewTabPageHandler::RegisterUserPrefs(registry); 239 NewTabPageHandler::RegisterUserPrefs(registry);
236 if (NewTabUI::IsDiscoveryInNTPEnabled()) 240 if (NewTabUI::IsDiscoveryInNTPEnabled())
237 SuggestionsHandler::RegisterUserPrefs(registry); 241 SuggestionsHandler::RegisterUserPrefs(registry);
238 #endif 242 #endif
239 MostVisitedHandler::RegisterUserPrefs(registry); 243 MostVisitedHandler::RegisterUserPrefs(registry);
240 browser_sync::ForeignSessionHandler::RegisterUserPrefs(registry); 244 browser_sync::ForeignSessionHandler::RegisterUserPrefs(registry);
241 } 245 }
242 246
243 // static 247 // static
244 bool NewTabUI::ShouldShowApps() { 248 bool NewTabUI::ShouldShowApps() {
249 // Ash shows apps in app list thus should not show apps page in NTP4.
250 // Android does not have apps.
245 #if defined(OS_ANDROID) 251 #if defined(OS_ANDROID)
246 // Ash shows apps in app list thus should not show apps page in NTP4.
247 // Android does not have apps.
248 return false; 252 return false;
253 #elif defined(USE_ASH)
254 return chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH;
249 #else 255 #else
250 // This needs to be synchronous, so we use the value the last time it 256 return true;
251 // was checked.
252 return !apps::WasAppLauncherEnabled();
253 #endif 257 #endif
254 } 258 }
255 259
256 // static 260 // static
257 bool NewTabUI::IsDiscoveryInNTPEnabled() { 261 bool NewTabUI::IsDiscoveryInNTPEnabled() {
258 // TODO(beaudoin): The flag was removed during a clean-up pass. We leave that 262 // TODO(beaudoin): The flag was removed during a clean-up pass. We leave that
259 // here to easily enable it back when we will explore this option again. 263 // here to easily enable it back when we will explore this option again.
260 return false; 264 return false;
261 } 265 }
262 266
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 381 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
378 const char* mime_type, 382 const char* mime_type,
379 int resource_id) { 383 int resource_id) {
380 DCHECK(resource); 384 DCHECK(resource);
381 DCHECK(mime_type); 385 DCHECK(mime_type);
382 resource_map_[std::string(resource)] = 386 resource_map_[std::string(resource)] =
383 std::make_pair(std::string(mime_type), resource_id); 387 std::make_pair(std::string(mime_type), resource_id);
384 } 388 }
385 389
386 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} 390 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