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 "chrome/browser/ui/webui/devtools_ui.h" | 5 #include "chrome/browser/ui/webui/devtools_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 NOTREACHED(); | 90 NOTREACHED(); |
91 return "text/plain"; | 91 return "text/plain"; |
92 } | 92 } |
93 | 93 |
94 class BundledDataSource : public content::URLDataSource { | 94 class BundledDataSource : public content::URLDataSource { |
95 public: | 95 public: |
96 explicit BundledDataSource() { | 96 explicit BundledDataSource() { |
97 } | 97 } |
98 | 98 |
99 // content::URLDataSource implementation. | 99 // content::URLDataSource implementation. |
100 virtual std::string GetSource() OVERRIDE { | 100 virtual std::string GetSource() const OVERRIDE { |
101 return chrome::kChromeUIDevToolsBundledHost; | 101 return chrome::kChromeUIDevToolsBundledHost; |
102 } | 102 } |
103 | 103 |
104 virtual void StartDataRequest( | 104 virtual void StartDataRequest( |
105 const std::string& path, | 105 const std::string& path, |
106 bool is_incognito, | 106 bool is_incognito, |
107 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { | 107 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { |
108 std::string filename = PathWithoutParams(path); | 108 std::string filename = PathWithoutParams(path); |
109 | 109 |
110 int resource_id = | 110 int resource_id = |
(...skipping 21 matching lines...) Expand all Loading... |
132 DISALLOW_COPY_AND_ASSIGN(BundledDataSource); | 132 DISALLOW_COPY_AND_ASSIGN(BundledDataSource); |
133 }; | 133 }; |
134 | 134 |
135 class RemoteDataSource : public content::URLDataSource { | 135 class RemoteDataSource : public content::URLDataSource { |
136 public: | 136 public: |
137 explicit RemoteDataSource(net::URLRequestContextGetter* | 137 explicit RemoteDataSource(net::URLRequestContextGetter* |
138 request_context) : request_context_(request_context) { | 138 request_context) : request_context_(request_context) { |
139 } | 139 } |
140 | 140 |
141 // content::URLDataSource implementation. | 141 // content::URLDataSource implementation. |
142 virtual std::string GetSource() OVERRIDE { | 142 virtual std::string GetSource() const OVERRIDE { |
143 return chrome::kChromeUIDevToolsRemoteHost; | 143 return chrome::kChromeUIDevToolsRemoteHost; |
144 } | 144 } |
145 | 145 |
146 virtual void StartDataRequest( | 146 virtual void StartDataRequest( |
147 const std::string& path, | 147 const std::string& path, |
148 bool is_incognito, | 148 bool is_incognito, |
149 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { | 149 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { |
150 | 150 |
151 GURL url = GURL(kRemoteFrontendBase + path); | 151 GURL url = GURL(kRemoteFrontendBase + path); |
152 CHECK_EQ(url.host(), kRemoteFrontendDomain); | 152 CHECK_EQ(url.host(), kRemoteFrontendDomain); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 new BundledDataSource()); | 232 new BundledDataSource()); |
233 content::URLDataSource::Add( | 233 content::URLDataSource::Add( |
234 profile, | 234 profile, |
235 new RemoteDataSource(profile->GetRequestContext())); | 235 new RemoteDataSource(profile->GetRequestContext())); |
236 #if defined(DEBUG_DEVTOOLS) | 236 #if defined(DEBUG_DEVTOOLS) |
237 content::URLDataSource::Add( | 237 content::URLDataSource::Add( |
238 profile, | 238 profile, |
239 new LocalhostDataSource(profile->GetRequestContext())); | 239 new LocalhostDataSource(profile->GetRequestContext())); |
240 #endif // defined(DEBUG_DEVTOOLS) | 240 #endif // defined(DEBUG_DEVTOOLS) |
241 } | 241 } |
OLD | NEW |