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 "chrome/browser/ui/webui/physical_web/physical_web_ui.h" | 5 #include "chrome/browser/ui/webui/physical_web/physical_web_ui.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "chrome/browser/browser_process_impl.h" | 9 #include "chrome/browser/browser_process_impl.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 content::WebUIDataSource* source = content::WebUIDataSource::Create( | 23 content::WebUIDataSource* source = content::WebUIDataSource::Create( |
| 24 chrome::kChromeUIPhysicalWebHost); | 24 chrome::kChromeUIPhysicalWebHost); |
| 25 | 25 |
| 26 source->AddLocalizedString(physical_web_ui::kTitle, | 26 source->AddLocalizedString(physical_web_ui::kTitle, |
| 27 IDS_PHYSICAL_WEB_UI_TITLE); | 27 IDS_PHYSICAL_WEB_UI_TITLE); |
| 28 source->SetJsonPath("strings.js"); | 28 source->SetJsonPath("strings.js"); |
| 29 source->AddResourcePath(physical_web_ui::kPhysicalWebJS, | 29 source->AddResourcePath(physical_web_ui::kPhysicalWebJS, |
| 30 IDR_PHYSICAL_WEB_UI_JS); | 30 IDR_PHYSICAL_WEB_UI_JS); |
| 31 source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, | 31 source->AddResourcePath(physical_web_ui::kPhysicalWebCSS, |
| 32 IDR_PHYSICAL_WEB_UI_CSS); | 32 IDR_PHYSICAL_WEB_UI_CSS); |
| 33 source->AddResourcePath(physical_web_ui::kPhysicalWebLinkIcon, | |
| 34 IDR_PHYSICAL_WEB_UI_LINK_ICON); | |
|
mattreynolds
2017/02/28 22:20:54
Image resources should be added to the components/
| |
| 35 | |
| 33 source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); | 36 source->SetDefaultResource(IDR_PHYSICAL_WEB_UI_HTML); |
| 34 return source; | 37 return source; |
| 35 } | 38 } |
| 36 | 39 |
| 37 // Implements all MessageHandler core functionality. This is extends the | 40 // Implements all MessageHandler core functionality. This is extends the |
| 38 // PhysicalWebBaseMessageHandler and implements functions to manipulate an | 41 // PhysicalWebBaseMessageHandler and implements functions to manipulate an |
| 39 // Android-specific WebUI object. | 42 // Android-specific WebUI object. |
| 40 class MessageHandlerImpl | 43 class MessageHandlerImpl |
| 41 : public physical_web_ui::PhysicalWebBaseMessageHandler { | 44 : public physical_web_ui::PhysicalWebBaseMessageHandler { |
| 42 public: | 45 public: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 | 83 |
| 81 PhysicalWebUI::PhysicalWebUI(content::WebUI* web_ui) | 84 PhysicalWebUI::PhysicalWebUI(content::WebUI* web_ui) |
| 82 : WebUIController(web_ui) { | 85 : WebUIController(web_ui) { |
| 83 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 86 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
| 84 CreatePhysicalWebHTMLSource()); | 87 CreatePhysicalWebHTMLSource()); |
| 85 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebMessageHandler>()); | 88 web_ui->AddMessageHandler(base::MakeUnique<PhysicalWebMessageHandler>()); |
| 86 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); | 89 base::RecordAction(base::UserMetricsAction("PhysicalWeb.WebUI.Open")); |
| 87 } | 90 } |
| 88 | 91 |
| 89 PhysicalWebUI::~PhysicalWebUI() = default; | 92 PhysicalWebUI::~PhysicalWebUI() = default; |
| OLD | NEW |