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/engagement/site_engagement_ui.h" | 5 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui) | 79 SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui) |
80 : MojoWebUIController<mojom::SiteEngagementUIHandler>(web_ui) { | 80 : MojoWebUIController<mojom::SiteEngagementUIHandler>(web_ui) { |
81 // Incognito profiles will not have a site engagement service. | 81 // Incognito profiles will not have a site engagement service. |
82 Profile* profile = Profile::FromWebUI(web_ui); | 82 Profile* profile = Profile::FromWebUI(web_ui); |
83 if (!SiteEngagementService::Get(profile)) | 83 if (!SiteEngagementService::Get(profile)) |
84 return; | 84 return; |
85 | 85 |
86 // Set up the chrome://site-engagement/ source. | 86 // Set up the chrome://site-engagement/ source. |
87 scoped_ptr<content::WebUIDataSource> source( | 87 std::unique_ptr<content::WebUIDataSource> source( |
88 content::WebUIDataSource::Create(chrome::kChromeUISiteEngagementHost)); | 88 content::WebUIDataSource::Create(chrome::kChromeUISiteEngagementHost)); |
89 source->AddResourcePath("site_engagement.js", IDR_SITE_ENGAGEMENT_JS); | 89 source->AddResourcePath("site_engagement.js", IDR_SITE_ENGAGEMENT_JS); |
90 source->AddResourcePath( | 90 source->AddResourcePath( |
91 "chrome/browser/ui/webui/engagement/site_engagement.mojom", | 91 "chrome/browser/ui/webui/engagement/site_engagement.mojom", |
92 IDR_SITE_ENGAGEMENT_MOJO_JS); | 92 IDR_SITE_ENGAGEMENT_MOJO_JS); |
93 source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML); | 93 source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML); |
94 content::WebUIDataSource::Add(profile, source.release()); | 94 content::WebUIDataSource::Add(profile, source.release()); |
95 } | 95 } |
96 | 96 |
97 SiteEngagementUI::~SiteEngagementUI() {} | 97 SiteEngagementUI::~SiteEngagementUI() {} |
98 | 98 |
99 void SiteEngagementUI::BindUIHandler( | 99 void SiteEngagementUI::BindUIHandler( |
100 mojo::InterfaceRequest<mojom::SiteEngagementUIHandler> request) { | 100 mojo::InterfaceRequest<mojom::SiteEngagementUIHandler> request) { |
101 ui_handler_.reset(new SiteEngagementUIHandlerImpl( | 101 ui_handler_.reset(new SiteEngagementUIHandlerImpl( |
102 Profile::FromWebUI(web_ui()), std::move(request))); | 102 Profile::FromWebUI(web_ui()), std::move(request))); |
103 } | 103 } |
OLD | NEW |