| 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/popular_sites_internals_ui.h" | 5 #include "chrome/browser/ui/webui/popular_sites_internals_ui.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/webui/popular_sites_internals_message_handler.h" | 8 #include "chrome/browser/ui/webui/popular_sites_internals_message_handler.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "content/public/browser/web_ui.h" | 10 #include "content/public/browser/web_ui.h" |
| 11 #include "content/public/browser/web_ui_data_source.h" | 11 #include "content/public/browser/web_ui_data_source.h" |
| 12 #include "grit/browser_resources.h" | 12 #include "grit/browser_resources.h" |
| 13 | 13 |
| 14 content::WebUIDataSource* CreatePopularSitesInternalsHTMLSource() { | 14 content::WebUIDataSource* CreatePopularSitesInternalsHTMLSource() { |
| 15 content::WebUIDataSource* source = content::WebUIDataSource::Create( | 15 content::WebUIDataSource* source = content::WebUIDataSource::Create( |
| 16 chrome::kChromeUIPopularSitesInternalsHost); | 16 chrome::kChromeUIPopularSitesInternalsHost); |
| 17 | 17 |
| 18 source->AddResourcePath("popular_sites_internals.js", | 18 source->AddResourcePath("popular_sites_internals.js", |
| 19 IDR_POPULAR_SITES_INTERNALS_JS); | 19 IDR_POPULAR_SITES_INTERNALS_JS); |
| 20 source->AddResourcePath("popular_sites_internals.css", | 20 source->AddResourcePath("popular_sites_internals.css", |
| 21 IDR_POPULAR_SITES_INTERNALS_CSS); | 21 IDR_POPULAR_SITES_INTERNALS_CSS); |
| 22 source->SetDefaultResource(IDR_POPULAR_SITES_INTERNALS_HTML); | 22 source->SetDefaultResource(IDR_POPULAR_SITES_INTERNALS_HTML); |
| 23 source->UseGzipForAllPaths(); |
| 23 return source; | 24 return source; |
| 24 } | 25 } |
| 25 | 26 |
| 26 PopularSitesInternalsUI::PopularSitesInternalsUI(content::WebUI* web_ui) | 27 PopularSitesInternalsUI::PopularSitesInternalsUI(content::WebUI* web_ui) |
| 27 : WebUIController(web_ui) { | 28 : WebUIController(web_ui) { |
| 28 Profile* profile = Profile::FromWebUI(web_ui); | 29 Profile* profile = Profile::FromWebUI(web_ui); |
| 29 content::WebUIDataSource::Add(profile, | 30 content::WebUIDataSource::Add(profile, |
| 30 CreatePopularSitesInternalsHTMLSource()); | 31 CreatePopularSitesInternalsHTMLSource()); |
| 31 | 32 |
| 32 web_ui->AddMessageHandler(new PopularSitesInternalsMessageHandler); | 33 web_ui->AddMessageHandler(new PopularSitesInternalsMessageHandler); |
| 33 } | 34 } |
| 34 | 35 |
| 35 PopularSitesInternalsUI::~PopularSitesInternalsUI() {} | 36 PopularSitesInternalsUI::~PopularSitesInternalsUI() {} |
| OLD | NEW |