Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(684)

Side by Side Diff: ios/chrome/browser/ui/webui/version_ui.mm

Issue 2041603002: [ios Mojo] Implemented chrome://version. Base URL: https://chromium.googlesource.com/chromium/src.git@mojo_version
Patch Set: Self review Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/webui/version_ui.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/version_ui.h" 5 #include "ios/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 "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "components/grit/components_resources.h" 11 #include "components/grit/components_resources.h"
12 #include "components/strings/grit/components_chromium_strings.h" 12 #include "components/strings/grit/components_chromium_strings.h"
13 #include "components/strings/grit/components_google_chrome_strings.h" 13 #include "components/strings/grit/components_google_chrome_strings.h"
14 #include "components/strings/grit/components_strings.h" 14 #include "components/strings/grit/components_strings.h"
15 #include "components/version_info/version_info.h" 15 #include "components/version_info/version_info.h"
16 #include "components/version_ui/version_ui_constants.h" 16 #include "components/version_ui/version_ui_constants.h"
17 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 17 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
18 #include "ios/chrome/browser/chrome_url_constants.h" 18 #include "ios/chrome/browser/chrome_url_constants.h"
19 #include "ios/chrome/browser/ui/ui_util.h" 19 #include "ios/chrome/browser/ui/ui_util.h"
20 #include "ios/chrome/browser/ui/webui/version_handler.h" 20 #include "ios/chrome/browser/ui/webui/version_handler.h"
21 #include "ios/chrome/common/channel_info.h" 21 #include "ios/chrome/common/channel_info.h"
22 #include "ios/chrome/grit/ios_chromium_strings.h" 22 #include "ios/chrome/grit/ios_chromium_strings.h"
23 #include "ios/chrome/grit/ios_google_chrome_strings.h" 23 #include "ios/chrome/grit/ios_google_chrome_strings.h"
24 #include "ios/chrome/grit/ios_strings.h" 24 #include "ios/chrome/grit/ios_strings.h"
25 #include "ios/web/public/web_client.h" 25 #include "ios/web/public/web_client.h"
26 #import "ios/web/public/web_state/web_state.h"
26 #include "ios/web/public/web_ui_ios_data_source.h" 27 #include "ios/web/public/web_ui_ios_data_source.h"
27 #include "ios/web/public/webui/web_ui_ios.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 29
30 namespace { 30 namespace {
31 31
32 web::WebUIIOSDataSource* CreateVersionUIDataSource() { 32 web::WebUIIOSDataSource* CreateVersionUIDataSource() {
33 web::WebUIIOSDataSource* html_source = 33 web::WebUIIOSDataSource* html_source =
34 web::WebUIIOSDataSource::Create(kChromeUIVersionHost); 34 web::WebUIIOSDataSource::Create(kChromeUIVersionHost);
35 35
36 // Localized and data strings. 36 // Localized and data strings.
37 html_source->AddLocalizedString(version_ui::kTitle, IDS_VERSION_UI_TITLE); 37 html_source->AddLocalizedString(version_ui::kTitle, IDS_VERSION_UI_TITLE);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 for (ArgvList::const_iterator iter = argv.begin(); iter != argv.end(); iter++) 88 for (ArgvList::const_iterator iter = argv.begin(); iter != argv.end(); iter++)
89 command_line += " " + *iter; 89 command_line += " " + *iter;
90 // TODO(viettrungluu): |command_line| could really have any encoding, whereas 90 // TODO(viettrungluu): |command_line| could really have any encoding, whereas
91 // below we assumes it's UTF-8. 91 // below we assumes it's UTF-8.
92 html_source->AddString(version_ui::kCommandLine, command_line); 92 html_source->AddString(version_ui::kCommandLine, command_line);
93 93
94 html_source->AddLocalizedString(version_ui::kVariationsName, 94 html_source->AddLocalizedString(version_ui::kVariationsName,
95 IDS_VERSION_UI_VARIATIONS); 95 IDS_VERSION_UI_VARIATIONS);
96 96
97 html_source->SetJsonPath("strings.js"); 97 html_source->SetJsonPath("strings.js");
98 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_IOS_JS); 98 html_source->AddResourcePath(version_ui::kVersionJS, IDR_VERSION_UI_JS);
99 html_source->AddResourcePath(version_ui::kAboutVersionCSS, 99 html_source->AddResourcePath(version_ui::kAboutVersionCSS,
100 IDR_VERSION_UI_CSS); 100 IDR_VERSION_UI_CSS);
101 html_source->AddResourcePath("components/version_ui/version.mojom",
102 IDR_VERSION_MOJO_JS);
101 html_source->SetDefaultResource(IDR_VERSION_UI_HTML); 103 html_source->SetDefaultResource(IDR_VERSION_UI_HTML);
102 return html_source; 104 return html_source;
103 } 105 }
104 106
105 } // namespace 107 } // namespace
106 108
107 VersionUI::VersionUI(web::WebUIIOS* web_ui) : web::WebUIIOSController(web_ui) { 109 VersionUI::VersionUI(web::WebUIIOS* web_ui) : MojoWebUIIOSController(web_ui) {
108 web_ui->AddMessageHandler(new VersionHandler());
109 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), 110 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui),
110 CreateVersionUIDataSource()); 111 CreateVersionUIDataSource());
111 } 112 }
112 113
113 VersionUI::~VersionUI() {} 114 VersionUI::~VersionUI() {}
115
116 void VersionUI::BindUIHandler(
117 mojo::InterfaceRequest<mojom::VersionPageHandler> request) {
118 version_handler_.reset(new VersionHandler(std::move(request)));
119 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/webui/version_ui.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698