OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.h" |
| 6 |
| 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/common/chrome_features.h" |
| 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/grit/browser_resources.h" |
| 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/strings/grit/components_strings.h" |
| 13 #include "content/public/browser/web_ui.h" |
| 14 #include "content/public/browser/web_ui_data_source.h" |
| 15 |
| 16 namespace { |
| 17 |
| 18 content::WebUIDataSource* CreateMdBookmarksUIHTMLSource(Profile* profile) { |
| 19 content::WebUIDataSource* source = |
| 20 content::WebUIDataSource::Create(chrome::kChromeUIBookmarksHost); |
| 21 |
| 22 // Localized strings (alphabetical order). |
| 23 source->AddLocalizedString("title", IDS_BOOKMARK_MANAGER_TITLE); |
| 24 |
| 25 source->SetDefaultResource(IDR_MD_BOOKMARKS_BOOKMARKS_HTML); |
| 26 source->SetJsonPath("strings.js"); |
| 27 |
| 28 return source; |
| 29 } |
| 30 |
| 31 } // namespace |
| 32 |
| 33 MdBookmarksUI::MdBookmarksUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 34 // Set up the chrome://bookmarks/ source. |
| 35 Profile* profile = Profile::FromWebUI(web_ui); |
| 36 content::WebUIDataSource::Add(profile, |
| 37 CreateMdBookmarksUIHTMLSource(profile)); |
| 38 } |
| 39 |
| 40 // static |
| 41 bool MdBookmarksUI::IsEnabled() { |
| 42 return base::FeatureList::IsEnabled(features::kMaterialDesignBookmarks); |
| 43 } |
OLD | NEW |