| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 int resource_id = | 111 int resource_id = |
| 112 content::DevToolsHttpHandler::GetFrontendResourceId(filename); | 112 content::DevToolsHttpHandler::GetFrontendResourceId(filename); |
| 113 | 113 |
| 114 DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " | 114 DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " |
| 115 << filename << ". If you compiled with debug_devtools=1, try running" | 115 << filename << ". If you compiled with debug_devtools=1, try running" |
| 116 " with --debug-devtools."; | 116 " with --debug-devtools."; |
| 117 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 117 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 118 scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes( | 118 scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes( |
| 119 resource_id)); | 119 resource_id)); |
| 120 callback.Run(bytes); | 120 callback.Run(bytes.get()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { | 123 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { |
| 124 return GetMimeTypeForPath(path); | 124 return GetMimeTypeForPath(path); |
| 125 } | 125 } |
| 126 | 126 |
| 127 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 127 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
| 128 return false; | 128 return false; |
| 129 } | 129 } |
| 130 | 130 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 virtual void StartDataRequest( | 147 virtual void StartDataRequest( |
| 148 const std::string& path, | 148 const std::string& path, |
| 149 int render_process_id, | 149 int render_process_id, |
| 150 int render_view_id, | 150 int render_view_id, |
| 151 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { | 151 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { |
| 152 | 152 |
| 153 GURL url = GURL(kRemoteFrontendBase + path); | 153 GURL url = GURL(kRemoteFrontendBase + path); |
| 154 CHECK_EQ(url.host(), kRemoteFrontendDomain); | 154 CHECK_EQ(url.host(), kRemoteFrontendDomain); |
| 155 new FetchRequest(request_context_, url, callback); | 155 new FetchRequest(request_context_.get(), url, callback); |
| 156 } | 156 } |
| 157 | 157 |
| 158 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { | 158 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { |
| 159 return GetMimeTypeForPath(path); | 159 return GetMimeTypeForPath(path); |
| 160 } | 160 } |
| 161 | 161 |
| 162 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 162 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
| 163 return false; | 163 return false; |
| 164 } | 164 } |
| 165 | 165 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 new BundledDataSource()); | 236 new BundledDataSource()); |
| 237 content::URLDataSource::Add( | 237 content::URLDataSource::Add( |
| 238 profile, | 238 profile, |
| 239 new RemoteDataSource(profile->GetRequestContext())); | 239 new RemoteDataSource(profile->GetRequestContext())); |
| 240 #if defined(DEBUG_DEVTOOLS) | 240 #if defined(DEBUG_DEVTOOLS) |
| 241 content::URLDataSource::Add( | 241 content::URLDataSource::Add( |
| 242 profile, | 242 profile, |
| 243 new LocalhostDataSource(profile->GetRequestContext())); | 243 new LocalhostDataSource(profile->GetRequestContext())); |
| 244 #endif // defined(DEBUG_DEVTOOLS) | 244 #endif // defined(DEBUG_DEVTOOLS) |
| 245 } | 245 } |
| OLD | NEW |