| 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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 web_ui->AddMessageHandler(new StartPageHandler); | 70 web_ui->AddMessageHandler(new StartPageHandler); |
| 71 InitDataSource(); | 71 InitDataSource(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 StartPageUI::~StartPageUI() {} | 74 StartPageUI::~StartPageUI() {} |
| 75 | 75 |
| 76 void StartPageUI::InitDataSource() { | 76 void StartPageUI::InitDataSource() { |
| 77 scoped_ptr<content::WebUIDataSource> source( | 77 scoped_ptr<content::WebUIDataSource> source( |
| 78 content::WebUIDataSource::Create(chrome::kChromeUIAppListStartPageHost)); | 78 content::WebUIDataSource::Create(chrome::kChromeUIAppListStartPageHost)); |
| 79 | 79 |
| 80 source->SetUseJsonJSFormatV2(); | |
| 81 source->SetJsonPath("strings.js"); | 80 source->SetJsonPath("strings.js"); |
| 82 | 81 |
| 83 source->AddResourcePath("start_page.css", IDR_APP_LIST_START_PAGE_CSS); | 82 source->AddResourcePath("start_page.css", IDR_APP_LIST_START_PAGE_CSS); |
| 84 source->AddResourcePath("start_page.js", IDR_APP_LIST_START_PAGE_JS); | 83 source->AddResourcePath("start_page.js", IDR_APP_LIST_START_PAGE_JS); |
| 85 source->AddResourcePath("hotword_nacl.nmf", IDR_APP_LIST_HOTWORD_NACL_NMF); | 84 source->AddResourcePath("hotword_nacl.nmf", IDR_APP_LIST_HOTWORD_NACL_NMF); |
| 86 source->SetDefaultResource(IDR_APP_LIST_START_PAGE_HTML); | 85 source->SetDefaultResource(IDR_APP_LIST_START_PAGE_HTML); |
| 87 | 86 |
| 88 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
| 89 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self' data:;"); | 88 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self' data:;"); |
| 90 if (base::SysInfo::IsRunningOnChromeOS()) | 89 if (base::SysInfo::IsRunningOnChromeOS()) |
| 91 source->SetRequestFilter(base::Bind(&HandleHotwordFilesResourceFilter, | 90 source->SetRequestFilter(base::Bind(&HandleHotwordFilesResourceFilter, |
| 92 Profile::FromWebUI(web_ui()))); | 91 Profile::FromWebUI(web_ui()))); |
| 93 #endif | 92 #endif |
| 94 | 93 |
| 95 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui()), source.release()); | 94 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui()), source.release()); |
| 96 } | 95 } |
| 97 | 96 |
| 98 } // namespace app_list | 97 } // namespace app_list |
| OLD | NEW |