Chromium Code Reviews| 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); | |
| 33 html_source->AddLocalizedString(physical_web_ui::kScanningMessage, | |
| 34 IDS_PHYSICAL_WEB_UI_SCANNING_MESSAGE); | |
| 
 
mattreynolds
2017/02/23 20:18:42
nit: please fix the line wrapping so the args are
 
Ran
2017/02/23 20:59:46
Done.
 
 | |
| 32 html_source->SetJsonPath("strings.js"); | 35 html_source->SetJsonPath("strings.js"); | 
| 33 html_source->AddResourcePath(physical_web_ui::kPhysicalWebJS, | 36 html_source->AddResourcePath(physical_web_ui::kPhysicalWebJS, | 
| 34 IDR_PHYSICAL_WEB_UI_JS); | 37 IDR_PHYSICAL_WEB_UI_JS); | 
| 35 html_source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, | 38 html_source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, | 
| 36 IDR_PHYSICAL_WEB_UI_CSS); | 39 IDR_PHYSICAL_WEB_UI_CSS); | 
| 37 html_source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); | 40 html_source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); | 
| 38 return html_source; | 41 return html_source; | 
| 39 } | 42 } | 
| 40 | 43 | 
| 41 // Implements all MessageHandler core functionality. This is extends the | 44 // 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) { | 102 : web::WebUIIOSController(web_ui) { | 
| 100 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebDOMHandler>()); | 103 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebDOMHandler>()); | 
| 101 | 104 | 
| 102 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 105 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 
| 103 CreatePhysicalWebUIDataSource()); | 106 CreatePhysicalWebUIDataSource()); | 
| 104 | 107 | 
| 105 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); | 108 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); | 
| 106 } | 109 } | 
| 107 | 110 | 
| 108 PhysicalWebUI::~PhysicalWebUI() {} | 111 PhysicalWebUI::~PhysicalWebUI() {} | 
| OLD | NEW |