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

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

Issue 1887303002: Collapse whitespace in app names derived from links. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/app_launcher_handler.h" 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "apps/metrics_names.h" 11 #include "apps/metrics_names.h"
12 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/i18n/rtl.h" 16 #include "base/i18n/rtl.h"
17 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/strings/string_util.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
23 #include "chrome/browser/extensions/crx_installer.h" 24 #include "chrome/browser/extensions/crx_installer.h"
24 #include "chrome/browser/extensions/extension_service.h" 25 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/extensions/extension_ui_util.h" 26 #include "chrome/browser/extensions/extension_ui_util.h"
26 #include "chrome/browser/extensions/launch_util.h" 27 #include "chrome/browser/extensions/launch_util.h"
27 #include "chrome/browser/favicon/favicon_service_factory.h" 28 #include "chrome/browser/favicon/favicon_service_factory.h"
28 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 Profile* profile = Profile::FromWebUI(web_ui()); 714 Profile* profile = Profile::FromWebUI(web_ui());
714 favicon::FaviconService* favicon_service = 715 favicon::FaviconService* favicon_service =
715 FaviconServiceFactory::GetForProfile(profile, 716 FaviconServiceFactory::GetForProfile(profile,
716 ServiceAccessType::EXPLICIT_ACCESS); 717 ServiceAccessType::EXPLICIT_ACCESS);
717 if (!favicon_service) { 718 if (!favicon_service) {
718 LOG(ERROR) << "No favicon service"; 719 LOG(ERROR) << "No favicon service";
719 return; 720 return;
720 } 721 }
721 722
722 std::unique_ptr<AppInstallInfo> install_info(new AppInstallInfo()); 723 std::unique_ptr<AppInstallInfo> install_info(new AppInstallInfo());
723 install_info->title = title; 724 install_info->title = base::CollapseWhitespace(
725 title, /* trim_sequences_with_line_breaks=*/false);
Evan Stade 2016/04/15 20:47:41 nit: is the spacing correct inside the /**/?
dcheng 2016/04/15 21:03:13 I couldn't remember what our usual convention is.
724 install_info->app_url = launch_url; 726 install_info->app_url = launch_url;
725 install_info->page_ordinal = page_ordinal; 727 install_info->page_ordinal = page_ordinal;
726 728
727 favicon_service->GetFaviconImageForPageURL( 729 favicon_service->GetFaviconImageForPageURL(
728 launch_url, 730 launch_url,
729 base::Bind(&AppLauncherHandler::OnFaviconForApp, 731 base::Bind(&AppLauncherHandler::OnFaviconForApp,
730 base::Unretained(this), 732 base::Unretained(this),
731 base::Passed(&install_info)), 733 base::Passed(&install_info)),
732 &cancelable_task_tracker_); 734 &cancelable_task_tracker_);
733 } 735 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 base::FundamentalValue(!extension_id_prompting_.empty())); 881 base::FundamentalValue(!extension_id_prompting_.empty()));
880 } 882 }
881 883
882 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { 884 bool AppLauncherHandler::ShouldShow(const Extension* extension) const {
883 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) 885 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app())
884 return false; 886 return false;
885 887
886 Profile* profile = Profile::FromWebUI(web_ui()); 888 Profile* profile = Profile::FromWebUI(web_ui());
887 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); 889 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile);
888 } 890 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698