| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/copresence_ui.h" | 5 #include "chrome/browser/ui/webui/copresence_ui.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
| 8 #include "chrome/browser/ui/webui/copresence_ui_handler.h" | 9 #include "chrome/browser/ui/webui/copresence_ui_handler.h" |
| 9 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
| 11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/browser/web_ui.h" | 13 #include "content/public/browser/web_ui.h" |
| 13 #include "content/public/browser/web_ui_data_source.h" | 14 #include "content/public/browser/web_ui_data_source.h" |
| 14 #include "grit/browser_resources.h" | 15 #include "grit/browser_resources.h" |
| 15 | 16 |
| 16 using content::WebUIDataSource; | 17 using content::WebUIDataSource; |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 scoped_ptr<WebUIDataSource> CreateDataSource() { | 21 std::unique_ptr<WebUIDataSource> CreateDataSource() { |
| 21 scoped_ptr<WebUIDataSource> data_source( | 22 std::unique_ptr<WebUIDataSource> data_source( |
| 22 WebUIDataSource::Create(chrome::kChromeUICopresenceHost)); | 23 WebUIDataSource::Create(chrome::kChromeUICopresenceHost)); |
| 23 | 24 |
| 24 data_source->AddLocalizedString("title", IDS_COPRESENCE_TITLE); | 25 data_source->AddLocalizedString("title", IDS_COPRESENCE_TITLE); |
| 25 | 26 |
| 26 data_source->AddLocalizedString("directives_title", | 27 data_source->AddLocalizedString("directives_title", |
| 27 IDS_COPRESENCE_DIRECTIVES_TITLE); | 28 IDS_COPRESENCE_DIRECTIVES_TITLE); |
| 28 data_source->AddLocalizedString("directive_type", | 29 data_source->AddLocalizedString("directive_type", |
| 29 IDS_COPRESENCE_DIRECTIVE_TYPE); | 30 IDS_COPRESENCE_DIRECTIVE_TYPE); |
| 30 data_source->AddLocalizedString("token_medium", IDS_COPRESENCE_TOKEN_MEDIUM); | 31 data_source->AddLocalizedString("token_medium", IDS_COPRESENCE_TOKEN_MEDIUM); |
| 31 data_source->AddLocalizedString("duration", IDS_COPRESENCE_DURATION); | 32 data_source->AddLocalizedString("duration", IDS_COPRESENCE_DURATION); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 62 : content::WebUIController(web_ui) { | 63 : content::WebUIController(web_ui) { |
| 63 // This call takes ownership of the WebUIMessageHandler. | 64 // This call takes ownership of the WebUIMessageHandler. |
| 64 web_ui->AddMessageHandler(new CopresenceUIHandler(web_ui)); | 65 web_ui->AddMessageHandler(new CopresenceUIHandler(web_ui)); |
| 65 | 66 |
| 66 // This call takes ownership of the WebUIDataSource. | 67 // This call takes ownership of the WebUIDataSource. |
| 67 WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 68 WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 68 CreateDataSource().release()); | 69 CreateDataSource().release()); |
| 69 } | 70 } |
| 70 | 71 |
| 71 CopresenceUI::~CopresenceUI() {} | 72 CopresenceUI::~CopresenceUI() {} |
| OLD | NEW |