| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/version_ui.h" | 5 #include "chrome/browser/ui/webui/version_ui.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #if defined(ENABLE_THEMES) | 31 #if defined(ENABLE_THEMES) |
| 32 #include "chrome/browser/ui/webui/theme_source.h" | 32 #include "chrome/browser/ui/webui/theme_source.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 36 #include "base/android/build_info.h" | 36 #include "base/android/build_info.h" |
| 37 #include "chrome/browser/ui/android/android_about_app_info.h" | 37 #include "chrome/browser/ui/android/android_about_app_info.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 #if defined(OS_CHROMEOS) | |
| 41 #include "chrome/browser/ui/webui/version_handler_chromeos.h" | |
| 42 #endif | |
| 43 | |
| 44 using content::WebUIDataSource; | 40 using content::WebUIDataSource; |
| 45 | 41 |
| 46 namespace { | 42 namespace { |
| 47 | 43 |
| 48 WebUIDataSource* CreateVersionUIDataSource() { | 44 WebUIDataSource* CreateVersionUIDataSource() { |
| 49 WebUIDataSource* html_source = | 45 WebUIDataSource* html_source = |
| 50 WebUIDataSource::Create(chrome::kChromeUIVersionHost); | 46 WebUIDataSource::Create(chrome::kChromeUIVersionHost); |
| 51 | 47 |
| 52 // Localized and data strings. | 48 // Localized and data strings. |
| 53 html_source->AddLocalizedString(version_ui::kTitle, IDS_VERSION_UI_TITLE); | 49 html_source->AddLocalizedString(version_ui::kTitle, IDS_VERSION_UI_TITLE); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 #else | 142 #else |
| 147 html_source->AddString("compiler", "Unknown"); | 143 html_source->AddString("compiler", "Unknown"); |
| 148 #endif | 144 #endif |
| 149 #endif // defined(OS_WIN) | 145 #endif // defined(OS_WIN) |
| 150 | 146 |
| 151 html_source->SetJsonPath("strings.js"); | 147 html_source->SetJsonPath("strings.js"); |
| 152 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); | 148 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS); |
| 153 html_source->AddResourcePath(version_ui::kAboutVersionCSS, | 149 html_source->AddResourcePath(version_ui::kAboutVersionCSS, |
| 154 IDR_VERSION_UI_CSS); | 150 IDR_VERSION_UI_CSS); |
| 155 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); | 151 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); |
| 152 |
| 153 html_source->AddResourcePath("chrome/browser/ui/webui/version.mojom", |
| 154 IDR_VERSION_MOJO_JS); |
| 155 |
| 156 return html_source; | 156 return html_source; |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace | 159 } // namespace |
| 160 | 160 |
| 161 VersionUI::VersionUI(content::WebUI* web_ui) | 161 VersionUI::VersionUI(content::WebUI* web_ui) : MojoWebUIController(web_ui) { |
| 162 : content::WebUIController(web_ui) { | |
| 163 Profile* profile = Profile::FromWebUI(web_ui); | 162 Profile* profile = Profile::FromWebUI(web_ui); |
| 164 | 163 |
| 165 #if defined(OS_CHROMEOS) | |
| 166 web_ui->AddMessageHandler(new VersionHandlerChromeOS()); | |
| 167 #else | |
| 168 web_ui->AddMessageHandler(new VersionHandler()); | |
| 169 #endif | |
| 170 | |
| 171 #if defined(ENABLE_THEMES) | 164 #if defined(ENABLE_THEMES) |
| 172 // Set up the chrome://theme/ source. | 165 // Set up the chrome://theme/ source. |
| 173 ThemeSource* theme = new ThemeSource(profile); | 166 ThemeSource* theme = new ThemeSource(profile); |
| 174 content::URLDataSource::Add(profile, theme); | 167 content::URLDataSource::Add(profile, theme); |
| 175 #endif | 168 #endif |
| 176 | 169 |
| 177 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); | 170 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); |
| 178 } | 171 } |
| 179 | 172 |
| 180 VersionUI::~VersionUI() { | 173 VersionUI::~VersionUI() {} |
| 174 |
| 175 void VersionUI::BindUIHandler( |
| 176 mojo::InterfaceRequest<mojom::VersionPageHandler> request) { |
| 177 version_handler_.reset(new VersionHandler(web_ui(), std::move(request))); |
| 181 } | 178 } |
| OLD | NEW |