OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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/snippets_internals_ui.h" | 5 #include "chrome/browser/ui/webui/snippets_internals_ui.h" |
6 | 6 |
7 #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" | 7 #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/webui/snippets_internals_message_handler.h" | 9 #include "chrome/browser/ui/webui/snippets_internals_message_handler.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "chrome/grit/browser_resources.h" | 11 #include "chrome/grit/browser_resources.h" |
12 #include "content/public/browser/web_ui.h" | 12 #include "content/public/browser/web_ui.h" |
13 #include "content/public/browser/web_ui_data_source.h" | 13 #include "content/public/browser/web_ui_data_source.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 content::WebUIDataSource* CreateSnippetsInternalsHTMLSource() { | 17 content::WebUIDataSource* CreateSnippetsInternalsHTMLSource() { |
18 content::WebUIDataSource* source = | 18 content::WebUIDataSource* source = |
19 content::WebUIDataSource::Create(chrome::kChromeUISnippetsInternalsHost); | 19 content::WebUIDataSource::Create(chrome::kChromeUISnippetsInternalsHost); |
20 | 20 |
21 source->AddResourcePath("snippets_internals.js", IDR_SNIPPETS_INTERNALS_JS); | 21 source->AddResourcePath("snippets_internals.js", IDR_SNIPPETS_INTERNALS_JS); |
22 source->AddResourcePath("snippets_internals.css", IDR_SNIPPETS_INTERNALS_CSS); | 22 source->AddResourcePath("snippets_internals.css", IDR_SNIPPETS_INTERNALS_CSS); |
23 source->SetDefaultResource(IDR_SNIPPETS_INTERNALS_HTML); | 23 source->SetDefaultResource(IDR_SNIPPETS_INTERNALS_HTML); |
24 source->DisableI18nAndUseGzipForAllPaths(); | 24 source->UseGzip(std::unordered_set<std::string>()); |
25 return source; | 25 return source; |
26 } | 26 } |
27 | 27 |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 SnippetsInternalsUI::SnippetsInternalsUI(content::WebUI* web_ui) | 30 SnippetsInternalsUI::SnippetsInternalsUI(content::WebUI* web_ui) |
31 : WebUIController(web_ui) { | 31 : WebUIController(web_ui) { |
32 Profile* profile = Profile::FromWebUI(web_ui); | 32 Profile* profile = Profile::FromWebUI(web_ui); |
33 content::WebUIDataSource::Add(profile, CreateSnippetsInternalsHTMLSource()); | 33 content::WebUIDataSource::Add(profile, CreateSnippetsInternalsHTMLSource()); |
34 | 34 |
35 web_ui->AddMessageHandler(new SnippetsInternalsMessageHandler( | 35 web_ui->AddMessageHandler(new SnippetsInternalsMessageHandler( |
36 ContentSuggestionsServiceFactory::GetInstance()->GetForProfile(profile), | 36 ContentSuggestionsServiceFactory::GetInstance()->GetForProfile(profile), |
37 profile->GetPrefs())); | 37 profile->GetPrefs())); |
38 } | 38 } |
39 | 39 |
40 SnippetsInternalsUI::~SnippetsInternalsUI() {} | 40 SnippetsInternalsUI::~SnippetsInternalsUI() {} |
OLD | NEW |