OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 9 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
10 #include "chrome/common/devtools_messages.h" | 10 #include "chrome/common/devtools_messages.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 .path().substr(1); | 21 .path().substr(1); |
22 } | 22 } |
23 | 23 |
24 } | 24 } |
25 | 25 |
26 class DevToolsDataSource : public ChromeURLDataManager::DataSource { | 26 class DevToolsDataSource : public ChromeURLDataManager::DataSource { |
27 public: | 27 public: |
28 DevToolsDataSource(); | 28 DevToolsDataSource(); |
29 | 29 |
30 virtual void StartDataRequest(const std::string& path, | 30 virtual void StartDataRequest(const std::string& path, |
31 bool is_off_the_record, | 31 bool is_incognito, |
32 int request_id); | 32 int request_id); |
33 virtual std::string GetMimeType(const std::string& path) const; | 33 virtual std::string GetMimeType(const std::string& path) const; |
34 | 34 |
35 private: | 35 private: |
36 ~DevToolsDataSource() {} | 36 ~DevToolsDataSource() {} |
37 DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource); | 37 DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource); |
38 }; | 38 }; |
39 | 39 |
40 | 40 |
41 DevToolsDataSource::DevToolsDataSource() | 41 DevToolsDataSource::DevToolsDataSource() |
42 : DataSource(chrome::kChromeUIDevToolsHost, MessageLoop::current()) { | 42 : DataSource(chrome::kChromeUIDevToolsHost, MessageLoop::current()) { |
43 } | 43 } |
44 | 44 |
45 void DevToolsDataSource::StartDataRequest(const std::string& path, | 45 void DevToolsDataSource::StartDataRequest(const std::string& path, |
46 bool is_off_the_record, | 46 bool is_incognito, |
47 int request_id) { | 47 int request_id) { |
48 std::string filename = PathWithoutParams(path); | 48 std::string filename = PathWithoutParams(path); |
49 | 49 |
50 int resource_id = -1; | 50 int resource_id = -1; |
51 for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { | 51 for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { |
52 if (filename == kDevtoolsResources[i].name) { | 52 if (filename == kDevtoolsResources[i].name) { |
53 resource_id = kDevtoolsResources[i].value; | 53 resource_id = kDevtoolsResources[i].value; |
54 break; | 54 break; |
55 } | 55 } |
56 } | 56 } |
(...skipping 27 matching lines...) Expand all Loading... |
84 | 84 |
85 DevToolsUI::DevToolsUI(TabContents* contents) : WebUI(contents) { | 85 DevToolsUI::DevToolsUI(TabContents* contents) : WebUI(contents) { |
86 DevToolsDataSource* data_source = new DevToolsDataSource(); | 86 DevToolsDataSource* data_source = new DevToolsDataSource(); |
87 contents->profile()->GetChromeURLDataManager()->AddDataSource(data_source); | 87 contents->profile()->GetChromeURLDataManager()->AddDataSource(data_source); |
88 } | 88 } |
89 | 89 |
90 void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) { | 90 void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) { |
91 render_view_host->Send(new DevToolsMsg_SetupDevToolsClient( | 91 render_view_host->Send(new DevToolsMsg_SetupDevToolsClient( |
92 render_view_host->routing_id())); | 92 render_view_host->routing_id())); |
93 } | 93 } |
OLD | NEW |