| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/identity_internals/identity_internals_ui.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/webui/identity_internals/identity_internals_ui_handl
er.h" |
| 11 #include "chrome/common/url_constants.h" |
| 12 #include "content/public/browser/web_ui.h" |
| 13 #include "content/public/browser/web_ui_controller.h" |
| 14 #include "content/public/browser/web_ui_data_source.h" |
| 15 #include "grit/browser_resources.h" |
| 16 #include "grit/generated_resources.h" |
| 17 #include "ui/base/l10n/l10n_util.h" |
| 18 |
| 19 |
| 20 IdentityInternalsUI::IdentityInternalsUI(content::WebUI* web_ui) |
| 21 : MojoWebUIController(web_ui) { |
| 22 // chrome://identity-internals source. |
| 23 content::WebUIDataSource* html_source = |
| 24 content::WebUIDataSource::Create(chrome::kChromeUIIdentityInternalsHost); |
| 25 html_source->SetUseJsonJSFormatV2(); |
| 26 |
| 27 // Localized strings |
| 28 html_source->AddLocalizedString("tokenCacheHeader", |
| 29 IDS_IDENTITY_INTERNALS_TOKEN_CACHE_TEXT); |
| 30 html_source->AddLocalizedString("accessToken", |
| 31 IDS_IDENTITY_INTERNALS_ACCESS_TOKEN); |
| 32 html_source->AddLocalizedString("extensionName", |
| 33 IDS_IDENTITY_INTERNALS_EXTENSION_NAME); |
| 34 html_source->AddLocalizedString("extensionId", |
| 35 IDS_IDENTITY_INTERNALS_EXTENSION_ID); |
| 36 html_source->AddLocalizedString("tokenStatus", |
| 37 IDS_IDENTITY_INTERNALS_TOKEN_STATUS); |
| 38 html_source->AddLocalizedString("expirationTime", |
| 39 IDS_IDENTITY_INTERNALS_EXPIRATION_TIME); |
| 40 html_source->AddLocalizedString("scopes", |
| 41 IDS_IDENTITY_INTERNALS_SCOPES); |
| 42 html_source->AddLocalizedString("revoke", |
| 43 IDS_IDENTITY_INTERNALS_REVOKE); |
| 44 html_source->SetJsonPath("strings.js"); |
| 45 |
| 46 // Required resources |
| 47 html_source->AddResourcePath("identity_internals.css", |
| 48 IDR_IDENTITY_INTERNALS_CSS); |
| 49 html_source->AddResourcePath("identity_internals.js", |
| 50 IDR_IDENTITY_INTERNALS_JS); |
| 51 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML); |
| 52 |
| 53 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); |
| 54 |
| 55 AddMojoResourcePath( |
| 56 "chrome/browser/ui/webui/identity_internals/identity_internals.mojom", |
| 57 IDR_IDENTITY_INTERNALS_MOJO_JS); |
| 58 } |
| 59 |
| 60 IdentityInternalsUI::~IdentityInternalsUI() {} |
| 61 |
| 62 scoped_ptr<MojoWebUIHandler> IdentityInternalsUI::CreateUIHandler( |
| 63 mojo::ScopedMessagePipeHandle handle_to_page) { |
| 64 return scoped_ptr<MojoWebUIHandler>(mojo::BindToPipe( |
| 65 new IdentityInternalsUIHandler(Profile::FromWebUI(web_ui())), |
| 66 handle_to_page.Pass())); |
| 67 } |
| OLD | NEW |