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_ntp_source.h" | 5 #include "chrome/browser/search/local_ntp_source.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 LocalNtpSource::~LocalNtpSource() { | 57 LocalNtpSource::~LocalNtpSource() { |
58 } | 58 } |
59 | 59 |
60 std::string LocalNtpSource::GetSource() const { | 60 std::string LocalNtpSource::GetSource() const { |
61 return chrome::kChromeSearchLocalNtpHost; | 61 return chrome::kChromeSearchLocalNtpHost; |
62 } | 62 } |
63 | 63 |
64 void LocalNtpSource::StartDataRequest( | 64 void LocalNtpSource::StartDataRequest( |
65 const std::string& path, | 65 const std::string& path, |
66 bool is_incognito, | 66 int render_process_id, |
| 67 int render_view_id, |
67 const content::URLDataSource::GotDataCallback& callback) { | 68 const content::URLDataSource::GotDataCallback& callback) { |
68 const std::string stripped_path = StripParameters(path); | 69 const std::string stripped_path = StripParameters(path); |
69 for (size_t i = 0; i < arraysize(kResources); ++i) { | 70 for (size_t i = 0; i < arraysize(kResources); ++i) { |
70 if (stripped_path == kResources[i].filename) { | 71 if (stripped_path == kResources[i].filename) { |
71 scoped_refptr<base::RefCountedStaticMemory> response( | 72 scoped_refptr<base::RefCountedStaticMemory> response( |
72 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 73 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
73 kResources[i].identifier)); | 74 kResources[i].identifier)); |
74 callback.Run(response); | 75 callback.Run(response); |
75 return; | 76 return; |
76 } | 77 } |
(...skipping 18 matching lines...) Expand all Loading... |
95 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { | 96 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { |
96 DCHECK(StartsWithASCII(request->url().path(), "/", true)); | 97 DCHECK(StartsWithASCII(request->url().path(), "/", true)); |
97 std::string filename = request->url().path().substr(1); | 98 std::string filename = request->url().path().substr(1); |
98 for (size_t i = 0; i < arraysize(kResources); ++i) { | 99 for (size_t i = 0; i < arraysize(kResources); ++i) { |
99 if (filename == kResources[i].filename) | 100 if (filename == kResources[i].filename) |
100 return true; | 101 return true; |
101 } | 102 } |
102 } | 103 } |
103 return false; | 104 return false; |
104 } | 105 } |
OLD | NEW |