OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/webui/web_ui_data_source_impl.h" | 5 #include "content/browser/webui/web_ui_data_source_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 int id; | 32 int id; |
33 } resources[] = { | 33 } resources[] = { |
34 { mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS }, | 34 { mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS }, |
35 { mojo::kCodecModuleName, IDR_MOJO_CODEC_JS }, | 35 { mojo::kCodecModuleName, IDR_MOJO_CODEC_JS }, |
36 { mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS }, | 36 { mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS }, |
37 { mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS }, | 37 { mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS }, |
38 { mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS }, | 38 { mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS }, |
39 { mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS }, | 39 { mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS }, |
40 { mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS }, | 40 { mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS }, |
41 }; | 41 }; |
42 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) | 42 for (size_t i = 0; i < arraysize(resources); ++i) |
43 mojo_source->AddResourcePath(resources[i].path, resources[i].id); | 43 mojo_source->AddResourcePath(resources[i].path, resources[i].id); |
44 | 44 |
45 URLDataManager::AddWebUIDataSource(browser_context, mojo_source); | 45 URLDataManager::AddWebUIDataSource(browser_context, mojo_source); |
46 return mojo_source; | 46 return mojo_source; |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 void WebUIDataSource::Add(BrowserContext* browser_context, | 50 void WebUIDataSource::Add(BrowserContext* browser_context, |
51 WebUIDataSource* source) { | 51 WebUIDataSource* source) { |
52 URLDataManager::AddWebUIDataSource(browser_context, source); | 52 URLDataManager::AddWebUIDataSource(browser_context, source); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 | 244 |
245 void WebUIDataSourceImpl::SendFromResourceBundle( | 245 void WebUIDataSourceImpl::SendFromResourceBundle( |
246 const URLDataSource::GotDataCallback& callback, int idr) { | 246 const URLDataSource::GotDataCallback& callback, int idr) { |
247 scoped_refptr<base::RefCountedStaticMemory> response( | 247 scoped_refptr<base::RefCountedStaticMemory> response( |
248 GetContentClient()->GetDataResourceBytes(idr)); | 248 GetContentClient()->GetDataResourceBytes(idr)); |
249 callback.Run(response.get()); | 249 callback.Run(response.get()); |
250 } | 250 } |
251 | 251 |
252 } // namespace content | 252 } // namespace content |
OLD | NEW |