| 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 17 matching lines...) Expand all Loading... |
| 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 html_source->AddLocalizedString(physical_web_ui::kEmptyMessage, | 31 html_source->AddLocalizedString(physical_web_ui::kEmptyMessage, |
| 32 IDS_PHYSICAL_WEB_UI_EMPTY_MESSAGE); | 32 IDS_PHYSICAL_WEB_UI_EMPTY_MESSAGE); |
| 33 html_source->SetJsonPath("strings.js"); | 33 html_source->SetJsonPath("strings.js"); |
| 34 html_source->AddResourcePath(physical_web_ui::kPhysicalWebJS, | 34 html_source->AddResourcePath(physical_web_ui::kPhysicalWebJS, |
| 35 IDR_PHYSICAL_WEB_UI_JS); | 35 IDR_PHYSICAL_WEB_UI_JS); |
| 36 html_source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, | 36 html_source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, |
| 37 IDR_PHYSICAL_WEB_UI_CSS); | 37 IDR_PHYSICAL_WEB_UI_CSS); |
| 38 html_source->AddResourcePath(physical_web_ui::kPhysicalWebLinkIcon, |
| 39 IDR_PHYSICAL_WEB_UI_LINK_ICON); |
| 38 html_source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); | 40 html_source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); |
| 39 return html_source; | 41 return html_source; |
| 40 } | 42 } |
| 41 | 43 |
| 42 // Implements all MessageHandler core functionality. This is extends the | 44 // Implements all MessageHandler core functionality. This is extends the |
| 43 // PhysicalWebBaseMessageHandler and implements functions to manipulate an | 45 // PhysicalWebBaseMessageHandler and implements functions to manipulate an |
| 44 // iOS-specific WebUI object. | 46 // iOS-specific WebUI object. |
| 45 class MessageHandlerImpl | 47 class MessageHandlerImpl |
| 46 : public physical_web_ui::PhysicalWebBaseMessageHandler { | 48 : public physical_web_ui::PhysicalWebBaseMessageHandler { |
| 47 public: | 49 public: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 : web::WebUIIOSController(web_ui) { | 102 : web::WebUIIOSController(web_ui) { |
| 101 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebDOMHandler>()); | 103 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebDOMHandler>()); |
| 102 | 104 |
| 103 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 105 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), |
| 104 CreatePhysicalWebUIDataSource()); | 106 CreatePhysicalWebUIDataSource()); |
| 105 | 107 |
| 106 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); | 108 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); |
| 107 } | 109 } |
| 108 | 110 |
| 109 PhysicalWebUI::~PhysicalWebUI() {} | 111 PhysicalWebUI::~PhysicalWebUI() {} |
| OLD | NEW |