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

Side by Side Diff: chrome/browser/ui/webui/md_history_ui.cc

Issue 2318643003: MD History: truncate title to 300 chars in C++ instead of JS (Closed)
Patch Set: more !android Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/md_history_ui.h" 5 #include "chrome/browser/ui/webui/md_history_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 // static 209 // static
210 bool MdHistoryUI::IsEnabled(Profile* profile) { 210 bool MdHistoryUI::IsEnabled(Profile* profile) {
211 return base::FeatureList::IsEnabled(features::kMaterialDesignHistory) && 211 return base::FeatureList::IsEnabled(features::kMaterialDesignHistory) &&
212 !base::CommandLine::ForCurrentProcess()->HasSwitch( 212 !base::CommandLine::ForCurrentProcess()->HasSwitch(
213 switches::kHistoryEnableGroupByDomain) && 213 switches::kHistoryEnableGroupByDomain) &&
214 !profile->IsSupervised(); 214 !profile->IsSupervised();
215 } 215 }
216 216
217 // static 217 // static
218 void MdHistoryUI::DisableForTesting() { 218 void MdHistoryUI::SetEnabledForTesting(bool enabled) {
219 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 219 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
220 feature_list->InitializeFromCommandLine( 220
221 std::string(), features::kMaterialDesignHistory.name); 221 const std::string& name = features::kMaterialDesignHistory.name;
222 feature_list->InitializeFromCommandLine(enabled ? name : "",
223 enabled ? "" : name);
222 base::FeatureList::ClearInstanceForTesting(); 224 base::FeatureList::ClearInstanceForTesting();
223 base::FeatureList::SetInstance(std::move(feature_list)); 225 base::FeatureList::SetInstance(std::move(feature_list));
224 } 226 }
225 227
226 // static 228 // static
227 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( 229 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes(
228 ui::ScaleFactor scale_factor) { 230 ui::ScaleFactor scale_factor) {
229 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 231 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
230 IDR_HISTORY_FAVICON, scale_factor); 232 IDR_HISTORY_FAVICON, scale_factor);
231 } 233 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/md_history_ui.h ('k') | chrome/browser/ui/webui/uber/uber_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698