| 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 17 matching lines...) Expand all Loading... |
| 28 WebUIDataSource* mojo_source = Create("mojo"); | 28 WebUIDataSource* mojo_source = Create("mojo"); |
| 29 | 29 |
| 30 static const struct { | 30 static const struct { |
| 31 const char* path; | 31 const char* path; |
| 32 int id; | 32 int id; |
| 33 } resources[] = { | 33 } resources[] = { |
| 34 { mojo::kCodecModuleName, IDR_MOJO_CODEC_JS }, | 34 { mojo::kCodecModuleName, IDR_MOJO_CODEC_JS }, |
| 35 { mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS }, | 35 { mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS }, |
| 36 { mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS }, | 36 { mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS }, |
| 37 { mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS }, | 37 { mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS }, |
| 38 { mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS }, |
| 38 }; | 39 }; |
| 39 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) | 40 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) |
| 40 mojo_source->AddResourcePath(resources[i].path, resources[i].id); | 41 mojo_source->AddResourcePath(resources[i].path, resources[i].id); |
| 41 | 42 |
| 42 URLDataManager::AddWebUIDataSource(browser_context, mojo_source); | 43 URLDataManager::AddWebUIDataSource(browser_context, mojo_source); |
| 43 return mojo_source; | 44 return mojo_source; |
| 44 } | 45 } |
| 45 | 46 |
| 46 // static | 47 // static |
| 47 void WebUIDataSource::Add(BrowserContext* browser_context, | 48 void WebUIDataSource::Add(BrowserContext* browser_context, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 250 } |
| 250 | 251 |
| 251 void WebUIDataSourceImpl::SendFromResourceBundle( | 252 void WebUIDataSourceImpl::SendFromResourceBundle( |
| 252 const URLDataSource::GotDataCallback& callback, int idr) { | 253 const URLDataSource::GotDataCallback& callback, int idr) { |
| 253 scoped_refptr<base::RefCountedStaticMemory> response( | 254 scoped_refptr<base::RefCountedStaticMemory> response( |
| 254 GetContentClient()->GetDataResourceBytes(idr)); | 255 GetContentClient()->GetDataResourceBytes(idr)); |
| 255 callback.Run(response.get()); | 256 callback.Run(response.get()); |
| 256 } | 257 } |
| 257 | 258 |
| 258 } // namespace content | 259 } // namespace content |
| OLD | NEW |