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

Unified Diff: chrome/browser/ui/webui/copresence_ui.cc

Issue 734243003: Adding the chrome://copresence page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@state
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/copresence_ui.h ('k') | chrome/browser/ui/webui/copresence_ui_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/copresence_ui.cc
diff --git a/chrome/browser/ui/webui/copresence_ui.cc b/chrome/browser/ui/webui/copresence_ui.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1180dc86035d97ad0e63178b004d839788d2506c
--- /dev/null
+++ b/chrome/browser/ui/webui/copresence_ui.cc
@@ -0,0 +1,66 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/copresence_ui.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/webui/copresence_ui_handler.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/grit/generated_resources.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_data_source.h"
+#include "grit/browser_resources.h"
+
+using content::WebUIDataSource;
+
+namespace {
+
+scoped_ptr<WebUIDataSource> CreateDataSource() {
+ scoped_ptr<WebUIDataSource> data_source(
+ WebUIDataSource::Create(chrome::kChromeUICopresenceHost));
+
+ data_source->AddLocalizedString("title", IDS_COPRESENCE_TITLE);
+
+ data_source->AddLocalizedString("directives_title",
+ IDS_COPRESENCE_DIRECTIVES_TITLE);
+ data_source->AddLocalizedString("directive_type",
+ IDS_COPRESENCE_DIRECTIVE_TYPE);
+ data_source->AddLocalizedString("token_medium", IDS_COPRESENCE_TOKEN_MEDIUM);
+ data_source->AddLocalizedString("duration", IDS_COPRESENCE_DURATION);
+
+ data_source->AddLocalizedString("transmitted_tokens_title",
+ IDS_COPRESENCE_TRANSMITTED_TOKENS_TITLE);
+ data_source->AddLocalizedString("received_tokens_title",
+ IDS_COPRESENCE_RECEIVED_TOKENS_TITLE);
+ data_source->AddLocalizedString("token_id",
+ IDS_COPRESENCE_TOKEN_ID);
+ data_source->AddLocalizedString("token_status",
+ IDS_COPRESENCE_TOKEN_STATUS);
+ data_source->AddLocalizedString("token_transmit_time",
+ IDS_COPRESENCE_TOKEN_TRANSMIT_TIME);
+ data_source->AddLocalizedString("token_receive_time",
+ IDS_COPRESENCE_TOKEN_RECEIVE_TIME);
+
+ data_source->SetJsonPath("strings.js");
+ data_source->AddResourcePath("copresence.css", IDR_COPRESENCE_CSS);
+ data_source->AddResourcePath("copresence.js", IDR_COPRESENCE_JS);
+ data_source->SetDefaultResource(IDR_COPRESENCE_HTML);
+
+ return data_source.Pass();
+}
+
+} // namespace
+
+CopresenceUI::CopresenceUI(content::WebUI* web_ui)
+ : content::WebUIController(web_ui) {
+ // This call takes ownership of the WebUIMessageHandler.
+ web_ui->AddMessageHandler(new CopresenceUIHandler(web_ui));
+
+ // This call takes ownership of the WebUIDataSource.
+ WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
+ CreateDataSource().release());
+}
+
+CopresenceUI::~CopresenceUI() {}
« no previous file with comments | « chrome/browser/ui/webui/copresence_ui.h ('k') | chrome/browser/ui/webui/copresence_ui_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698