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

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

Issue 9567027: aura: Remove apps from NTP4 and disable NTP4 intro bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 web_ui->AddMessageHandler(new MostVisitedHandler()); 115 web_ui->AddMessageHandler(new MostVisitedHandler());
116 if (NewTabUI::IsSuggestionsPageEnabled()) 116 if (NewTabUI::IsSuggestionsPageEnabled())
117 web_ui->AddMessageHandler(new SuggestionsHandler()); 117 web_ui->AddMessageHandler(new SuggestionsHandler());
118 web_ui->AddMessageHandler(new RecentlyClosedTabsHandler()); 118 web_ui->AddMessageHandler(new RecentlyClosedTabsHandler());
119 web_ui->AddMessageHandler(new MetricsHandler()); 119 web_ui->AddMessageHandler(new MetricsHandler());
120 #if !defined(OS_ANDROID) 120 #if !defined(OS_ANDROID)
121 // Android doesn't have a sync promo/username on NTP. 121 // Android doesn't have a sync promo/username on NTP.
122 if (GetProfile()->IsSyncAccessible()) 122 if (GetProfile()->IsSyncAccessible())
123 web_ui->AddMessageHandler(new NewTabPageSyncHandler()); 123 web_ui->AddMessageHandler(new NewTabPageSyncHandler());
124 #endif 124 #endif
125 ExtensionService* service = GetProfile()->GetExtensionService(); 125
126 // We might not have an ExtensionService (on ChromeOS when not logged in 126 if (ShouldShowAppsPage()) {
127 // for example). 127 ExtensionService* service = GetProfile()->GetExtensionService();
128 if (service) 128 // We might not have an ExtensionService (on ChromeOS when not logged in
129 web_ui->AddMessageHandler(new AppLauncherHandler(service)); 129 // for example).
130 if (service)
131 web_ui->AddMessageHandler(new AppLauncherHandler(service));
132 }
130 133
131 web_ui->AddMessageHandler(new NewTabPageHandler()); 134 web_ui->AddMessageHandler(new NewTabPageHandler());
132 web_ui->AddMessageHandler(new FaviconWebUIHandler()); 135 web_ui->AddMessageHandler(new FaviconWebUIHandler());
133 } 136 }
134 137
135 if (NTPLoginHandler::ShouldShow(GetProfile())) 138 if (NTPLoginHandler::ShouldShow(GetProfile()))
136 web_ui->AddMessageHandler(new NTPLoginHandler()); 139 web_ui->AddMessageHandler(new NTPLoginHandler());
137 140
138 // Initializing the CSS and HTML can require some CPU, so do it after 141 // Initializing the CSS and HTML can require some CPU, so do it after
139 // we've hooked up the most visited handler. This allows the DB query 142 // we've hooked up the most visited handler. This allows the DB query
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 284 }
282 285
283 // static 286 // static
284 bool NewTabUI::ShouldShowAppInstallHint() { 287 bool NewTabUI::ShouldShowAppInstallHint() {
285 const CommandLine* cli = CommandLine::ForCurrentProcess(); 288 const CommandLine* cli = CommandLine::ForCurrentProcess();
286 return cli->HasSwitch(switches::kNtpAppInstallHint) || 289 return cli->HasSwitch(switches::kNtpAppInstallHint) ||
287 WebStoreLinkExperimentGroupIs(g_hint_group); 290 WebStoreLinkExperimentGroupIs(g_hint_group);
288 } 291 }
289 292
290 // static 293 // static
294 bool NewTabUI::ShouldShowAppsPage() {
295 #if defined(USE_AURA)
296 // Ash shows apps in app list thus should not show apps page in NTP4.
297 return false;
flackr 2012/03/05 21:18:53 Aura compact mode does not have an apps page so we
298 #else
299 return true;
300 #endif
301 }
302
303 // static
291 bool NewTabUI::IsSuggestionsPageEnabled() { 304 bool NewTabUI::IsSuggestionsPageEnabled() {
292 return CommandLine::ForCurrentProcess()->HasSwitch( 305 return CommandLine::ForCurrentProcess()->HasSwitch(
293 switches::kEnableSuggestionsTabPage); 306 switches::kEnableSuggestionsTabPage);
294 } 307 }
295 308
296 // static 309 // static
297 void NewTabUI::SetURLTitleAndDirection(DictionaryValue* dictionary, 310 void NewTabUI::SetURLTitleAndDirection(DictionaryValue* dictionary,
298 const string16& title, 311 const string16& title,
299 const GURL& gurl) { 312 const GURL& gurl) {
300 dictionary->SetString("url", gurl.spec()); 313 dictionary->SetString("url", gurl.spec());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 406 }
394 407
395 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 408 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
396 const char* mime_type, 409 const char* mime_type,
397 int resource_id) { 410 int resource_id) {
398 DCHECK(resource); 411 DCHECK(resource);
399 DCHECK(mime_type); 412 DCHECK(mime_type);
400 resource_map_[std::string(resource)] = 413 resource_map_[std::string(resource)] =
401 std::make_pair(std::string(mime_type), resource_id); 414 std::make_pair(std::string(mime_type), resource_id);
402 } 415 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.h ('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