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

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: !android in tests as well 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 // static 207 // static
208 bool MdHistoryUI::IsEnabled(Profile* profile) { 208 bool MdHistoryUI::IsEnabled(Profile* profile) {
209 return base::FeatureList::IsEnabled(features::kMaterialDesignHistory) && 209 return base::FeatureList::IsEnabled(features::kMaterialDesignHistory) &&
210 !base::CommandLine::ForCurrentProcess()->HasSwitch( 210 !base::CommandLine::ForCurrentProcess()->HasSwitch(
211 switches::kHistoryEnableGroupByDomain) && 211 switches::kHistoryEnableGroupByDomain) &&
212 !profile->IsSupervised(); 212 !profile->IsSupervised();
213 } 213 }
214 214
215 // static 215 // static
216 void MdHistoryUI::DisableForTesting() { 216 void MdHistoryUI::SetEnabledForTesting(bool enabled) {
217 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 217 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
218 feature_list->InitializeFromCommandLine( 218
219 std::string(), features::kMaterialDesignHistory.name); 219 const std::string& name = features::kMaterialDesignHistory.name;
220 feature_list->InitializeFromCommandLine(enabled ? name : "",
221 enabled ? "" : name);
220 base::FeatureList::ClearInstanceForTesting(); 222 base::FeatureList::ClearInstanceForTesting();
221 base::FeatureList::SetInstance(std::move(feature_list)); 223 base::FeatureList::SetInstance(std::move(feature_list));
222 } 224 }
223 225
224 // static 226 // static
225 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( 227 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes(
226 ui::ScaleFactor scale_factor) { 228 ui::ScaleFactor scale_factor) {
227 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 229 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
228 IDR_HISTORY_FAVICON, scale_factor); 230 IDR_HISTORY_FAVICON, scale_factor);
229 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698