OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/app_list/start_page_ui.h" | 5 #include "chrome/browser/ui/webui/app_list/start_page_ui.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
9 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/webui/app_list/start_page_handler.h" | 15 #include "chrome/browser/ui/webui/app_list/start_page_handler.h" |
15 #include "chrome/common/extensions/extension_constants.h" | 16 #include "chrome/common/extensions/extension_constants.h" |
16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
19 #include "content/public/browser/web_ui_data_source.h" | 20 #include "content/public/browser/web_ui_data_source.h" |
20 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
21 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
22 #include "grit/browser_resources.h" | 23 #include "grit/browser_resources.h" |
23 | 24 |
24 namespace app_list { | 25 namespace app_list { |
25 | 26 |
26 StartPageUI::StartPageUI(content::WebUI* web_ui) | 27 StartPageUI::StartPageUI(content::WebUI* web_ui) |
27 : content::WebUIController(web_ui) { | 28 : content::WebUIController(web_ui) { |
28 web_ui->AddMessageHandler(new StartPageHandler); | 29 web_ui->AddMessageHandler(new StartPageHandler); |
29 InitDataSource(); | 30 InitDataSource(); |
30 } | 31 } |
31 | 32 |
32 StartPageUI::~StartPageUI() {} | 33 StartPageUI::~StartPageUI() {} |
33 | 34 |
34 void StartPageUI::InitDataSource() { | 35 void StartPageUI::InitDataSource() { |
35 scoped_ptr<content::WebUIDataSource> source( | 36 std::unique_ptr<content::WebUIDataSource> source( |
36 content::WebUIDataSource::Create(chrome::kChromeUIAppListStartPageHost)); | 37 content::WebUIDataSource::Create(chrome::kChromeUIAppListStartPageHost)); |
37 | 38 |
38 source->SetJsonPath("strings.js"); | 39 source->SetJsonPath("strings.js"); |
39 | 40 |
40 source->AddResourcePath("start_page.css", IDR_APP_LIST_START_PAGE_CSS); | 41 source->AddResourcePath("start_page.css", IDR_APP_LIST_START_PAGE_CSS); |
41 source->AddResourcePath("start_page.js", IDR_APP_LIST_START_PAGE_JS); | 42 source->AddResourcePath("start_page.js", IDR_APP_LIST_START_PAGE_JS); |
42 source->SetDefaultResource(IDR_APP_LIST_START_PAGE_HTML); | 43 source->SetDefaultResource(IDR_APP_LIST_START_PAGE_HTML); |
43 | 44 |
44 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui()), source.release()); | 45 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui()), source.release()); |
45 } | 46 } |
46 | 47 |
47 } // namespace app_list | 48 } // namespace app_list |
OLD | NEW |