OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" |
| 6 |
| 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/webui/engagement/site_engagement_ui_handler.h" |
| 9 #include "chrome/common/url_constants.h" |
| 10 #include "content/public/browser/web_ui.h" |
| 11 #include "content/public/browser/web_ui_controller.h" |
| 12 #include "content/public/browser/web_ui_data_source.h" |
| 13 #include "grit/browser_resources.h" |
| 14 |
| 15 SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui) |
| 16 : MojoWebUIController<SiteEngagementUIHandlerMojo>(web_ui) { |
| 17 // Set up the chrome://site-engagement/ source. |
| 18 scoped_ptr<content::WebUIDataSource> source( |
| 19 content::WebUIDataSource::Create(chrome::kChromeUISiteEngagementHost)); |
| 20 source->AddResourcePath("engagement_table.html", |
| 21 IDR_SITE_ENGAGEMENT_ENGAGEMENT_TABLE_HTML); |
| 22 source->AddResourcePath("engagement_table.css", |
| 23 IDR_SITE_ENGAGEMENT_ENGAGEMENT_TABLE_CSS); |
| 24 source->AddResourcePath("engagement_table.js", |
| 25 IDR_SITE_ENGAGEMENT_ENGAGEMENT_TABLE_JS); |
| 26 source->AddResourcePath("site_engagement.js", IDR_SITE_ENGAGEMENT_JS); |
| 27 source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML); |
| 28 |
| 29 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release()); |
| 30 |
| 31 AddMojoResourcePath( |
| 32 "chrome/browser/ui/webui/engagement/site_engagement.mojom", |
| 33 IDR_SITE_ENGAGEMENT_MOJO_JS); |
| 34 } |
| 35 |
| 36 SiteEngagementUI::~SiteEngagementUI() {} |
| 37 |
| 38 void SiteEngagementUI::BindUIHandler( |
| 39 mojo::InterfaceRequest<SiteEngagementUIHandlerMojo> request) { |
| 40 // SiteEngagementUIHandler deletes itself when the pipe is closed. |
| 41 new SiteEngagementUIHandler(Profile::FromWebUI(web_ui()), request.Pass()); |
| 42 } |
OLD | NEW |