| OLD | NEW |
| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 web_ui->RegisterMessageCallback("menuPromoShown", | 237 web_ui->RegisterMessageCallback("menuPromoShown", |
| 238 base::Bind(&MdHistoryUI::HandleMenuPromoShown, base::Unretained(this))); | 238 base::Bind(&MdHistoryUI::HandleMenuPromoShown, base::Unretained(this))); |
| 239 } | 239 } |
| 240 | 240 |
| 241 MdHistoryUI::~MdHistoryUI() {} | 241 MdHistoryUI::~MdHistoryUI() {} |
| 242 | 242 |
| 243 // static | 243 // static |
| 244 bool MdHistoryUI::IsEnabled(Profile* profile) { | 244 bool MdHistoryUI::IsEnabled(Profile* profile) { |
| 245 return base::FeatureList::IsEnabled(features::kMaterialDesignHistory) && | 245 return base::FeatureList::IsEnabled(features::kMaterialDesignHistory) && |
| 246 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 247 switches::kHistoryEnableGroupByDomain) && | |
| 248 !profile->IsSupervised(); | 246 !profile->IsSupervised(); |
| 249 } | 247 } |
| 250 | 248 |
| 251 // static | 249 // static |
| 252 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( | 250 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( |
| 253 ui::ScaleFactor scale_factor) { | 251 ui::ScaleFactor scale_factor) { |
| 254 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 252 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 255 IDR_HISTORY_FAVICON, scale_factor); | 253 IDR_HISTORY_FAVICON, scale_factor); |
| 256 } | 254 } |
| 257 | 255 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 272 | 270 |
| 273 content::WebUIDataSource::Update(profile, chrome::kChromeUIHistoryHost, | 271 content::WebUIDataSource::Update(profile, chrome::kChromeUIHistoryHost, |
| 274 std::move(update)); | 272 std::move(update)); |
| 275 } | 273 } |
| 276 | 274 |
| 277 void MdHistoryUI::HandleMenuPromoShown(const base::ListValue* args) { | 275 void MdHistoryUI::HandleMenuPromoShown(const base::ListValue* args) { |
| 278 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean( | 276 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean( |
| 279 prefs::kMdHistoryMenuPromoShown, true); | 277 prefs::kMdHistoryMenuPromoShown, true); |
| 280 UpdateDataSource(); | 278 UpdateDataSource(); |
| 281 } | 279 } |
| OLD | NEW |