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 "ios/chrome/browser/ui/webui/physical_web_ui.h" | 5 #include "ios/chrome/browser/ui/webui/physical_web_ui.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
10 #include "components/grit/components_resources.h" | 10 #include "components/grit/components_resources.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 web::WebUIIOSDataSource* CreatePhysicalWebUIDataSource() { | 24 web::WebUIIOSDataSource* CreatePhysicalWebUIDataSource() { |
25 web::WebUIIOSDataSource* html_source = | 25 web::WebUIIOSDataSource* html_source = |
26 web::WebUIIOSDataSource::Create(kChromeUIPhysicalWebHost); | 26 web::WebUIIOSDataSource::Create(kChromeUIPhysicalWebHost); |
27 | 27 |
28 // Localized and data strings. | 28 // Localized and data strings. |
29 html_source->AddLocalizedString(physical_web_ui::kTitle, | 29 html_source->AddLocalizedString(physical_web_ui::kTitle, |
30 IDS_PHYSICAL_WEB_UI_TITLE); | 30 IDS_PHYSICAL_WEB_UI_TITLE); |
31 | 31 html_source->AddLocalizedString(physical_web_ui::kEmptyMessage, |
| 32 IDS_PHYSICAL_WEB_UI_EMPTY_MESSAGE); |
32 html_source->SetJsonPath("strings.js"); | 33 html_source->SetJsonPath("strings.js"); |
33 html_source->AddResourcePath(physical_web_ui::kPhysicalWebJS, | 34 html_source->AddResourcePath(physical_web_ui::kPhysicalWebJS, |
34 IDR_PHYSICAL_WEB_UI_JS); | 35 IDR_PHYSICAL_WEB_UI_JS); |
35 html_source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, | 36 html_source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, |
36 IDR_PHYSICAL_WEB_UI_CSS); | 37 IDR_PHYSICAL_WEB_UI_CSS); |
37 html_source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); | 38 html_source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); |
38 return html_source; | 39 return html_source; |
39 } | 40 } |
40 | 41 |
41 // Implements all MessageHandler core functionality. This is extends the | 42 // Implements all MessageHandler core functionality. This is extends the |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 : web::WebUIIOSController(web_ui) { | 100 : web::WebUIIOSController(web_ui) { |
100 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebDOMHandler>()); | 101 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebDOMHandler>()); |
101 | 102 |
102 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 103 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), |
103 CreatePhysicalWebUIDataSource()); | 104 CreatePhysicalWebUIDataSource()); |
104 | 105 |
105 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); | 106 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); |
106 } | 107 } |
107 | 108 |
108 PhysicalWebUI::~PhysicalWebUI() {} | 109 PhysicalWebUI::~PhysicalWebUI() {} |
OLD | NEW |