| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 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 | 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_bookmarks/md_bookmarks_ui.h" | 5 #include "chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> |
| 8 | 9 |
| 9 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/webui/md_bookmarks/bookmarks_message_handler.h" |
| 11 #include "chrome/common/chrome_features.h" | 13 #include "chrome/common/chrome_features.h" |
| 12 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 13 #include "chrome/grit/browser_resources.h" | 15 #include "chrome/grit/browser_resources.h" |
| 14 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/strings/grit/components_strings.h" | 17 #include "components/strings/grit/components_strings.h" |
| 16 #include "content/public/browser/web_ui.h" | 18 #include "content/public/browser/web_ui.h" |
| 17 #include "content/public/browser/web_ui_data_source.h" | 19 #include "content/public/browser/web_ui_data_source.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 19 | 21 |
| 20 namespace { | 22 namespace { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return source; | 147 return source; |
| 146 } | 148 } |
| 147 | 149 |
| 148 } // namespace | 150 } // namespace |
| 149 | 151 |
| 150 MdBookmarksUI::MdBookmarksUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 152 MdBookmarksUI::MdBookmarksUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 151 // Set up the chrome://bookmarks/ source. | 153 // Set up the chrome://bookmarks/ source. |
| 152 Profile* profile = Profile::FromWebUI(web_ui); | 154 Profile* profile = Profile::FromWebUI(web_ui); |
| 153 content::WebUIDataSource::Add(profile, | 155 content::WebUIDataSource::Add(profile, |
| 154 CreateMdBookmarksUIHTMLSource(profile)); | 156 CreateMdBookmarksUIHTMLSource(profile)); |
| 157 |
| 158 web_ui->AddMessageHandler(base::MakeUnique<BookmarksMessageHandler>()); |
| 155 } | 159 } |
| 156 | 160 |
| 157 // static | 161 // static |
| 158 bool MdBookmarksUI::IsEnabled() { | 162 bool MdBookmarksUI::IsEnabled() { |
| 159 return base::FeatureList::IsEnabled(features::kMaterialDesignBookmarks); | 163 return base::FeatureList::IsEnabled(features::kMaterialDesignBookmarks); |
| 160 } | 164 } |
| OLD | NEW |