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/search/local_files_ntp_source.h" | 5 #include "chrome/browser/search/local_files_ntp_source.h" |
6 | 6 |
7 #if !defined(GOOGLE_CHROME_BUILD) && !defined(OS_IOS) | 7 #if !defined(GOOGLE_CHROME_BUILD) && !defined(OS_IOS) |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/memory/ref_counted_memory.h" | 13 #include "base/memory/ref_counted_memory.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/url_data_source.h" | 20 #include "content/public/browser/url_data_source.h" |
21 #include "third_party/re2/re2/re2.h" | 21 #include "third_party/re2/src/re2/re2.h" |
22 #include "third_party/re2/re2/stringpiece.h" | 22 #include "third_party/re2/src/re2/stringpiece.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const char kBasePath[] = "chrome/browser/resources/local_ntp"; | 26 const char kBasePath[] = "chrome/browser/resources/local_ntp"; |
27 | 27 |
28 // Matches lines of form '<include src="foo">' and captures 'foo'. | 28 // Matches lines of form '<include src="foo">' and captures 'foo'. |
29 const char kInlineResourceRegex[] = "<include.*?src\\=[\"'](.+?)[\"'].*?>"; | 29 const char kInlineResourceRegex[] = "<include.*?src\\=[\"'](.+?)[\"'].*?>"; |
30 | 30 |
31 void CallbackWithLoadedResource( | 31 void CallbackWithLoadedResource( |
32 const std::string& origin, | 32 const std::string& origin, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 base::Bind(&CheckLocalIncludes, callback); | 118 base::Bind(&CheckLocalIncludes, callback); |
119 base::PostTaskAndReplyWithResult( | 119 base::PostTaskAndReplyWithResult( |
120 content::BrowserThread::GetBlockingPool(), FROM_HERE, | 120 content::BrowserThread::GetBlockingPool(), FROM_HERE, |
121 base::Bind(&ReadFileAndReturn, fullpath), | 121 base::Bind(&ReadFileAndReturn, fullpath), |
122 base::Bind(&CallbackWithLoadedResource, origin, wrapper)); | 122 base::Bind(&CallbackWithLoadedResource, origin, wrapper)); |
123 } | 123 } |
124 | 124 |
125 } // namespace local_ntp | 125 } // namespace local_ntp |
126 | 126 |
127 #endif // !defined(GOOGLE_CHROME_BUILD) && !defined(OS_IOS) | 127 #endif // !defined(GOOGLE_CHROME_BUILD) && !defined(OS_IOS) |
OLD | NEW |