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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/devtools_frontend_host.h" | 17 #include "content/public/browser/devtools_frontend_host.h" |
18 #include "content/public/browser/site_instance.h" | |
19 #include "content/public/browser/storage_partition.h" | |
18 #include "content/public/browser/url_data_source.h" | 20 #include "content/public/browser/url_data_source.h" |
19 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
20 #include "content/public/browser/web_ui.h" | 22 #include "content/public/browser/web_ui.h" |
21 #include "content/public/common/user_agent.h" | 23 #include "content/public/common/user_agent.h" |
22 #include "net/base/escape.h" | 24 #include "net/base/escape.h" |
23 #include "net/base/filename_util.h" | 25 #include "net/base/filename_util.h" |
24 #include "net/base/load_flags.h" | 26 #include "net/base/load_flags.h" |
25 #include "net/base/url_util.h" | 27 #include "net/base/url_util.h" |
26 #include "net/url_request/url_fetcher.h" | 28 #include "net/url_request/url_fetcher.h" |
27 #include "net/url_request/url_fetcher_delegate.h" | 29 #include "net/url_request/url_fetcher_delegate.h" |
28 #include "net/url_request/url_request_context_getter.h" | 30 #include "net/url_request/url_request_context_getter.h" |
31 #include "storage/browser/fileapi/file_system_context.h" | |
29 #include "third_party/WebKit/public/public_features.h" | 32 #include "third_party/WebKit/public/public_features.h" |
30 | 33 |
31 using content::BrowserThread; | 34 using content::BrowserThread; |
32 using content::WebContents; | 35 using content::WebContents; |
33 | 36 |
34 namespace { | 37 namespace { |
35 | 38 |
36 std::string PathWithoutParams(const std::string& path) { | 39 std::string PathWithoutParams(const std::string& path) { |
37 return GURL(std::string("chrome-devtools://devtools/") + path) | 40 return GURL(std::string("chrome-devtools://devtools/") + path) |
38 .path().substr(1); | 41 .path().substr(1); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 | 434 |
432 DevToolsUI::DevToolsUI(content::WebUI* web_ui) | 435 DevToolsUI::DevToolsUI(content::WebUI* web_ui) |
433 : WebUIController(web_ui) { | 436 : WebUIController(web_ui) { |
434 web_ui->SetBindings(0); | 437 web_ui->SetBindings(0); |
435 Profile* profile = Profile::FromWebUI(web_ui); | 438 Profile* profile = Profile::FromWebUI(web_ui); |
436 content::URLDataSource::Add( | 439 content::URLDataSource::Add( |
437 profile, | 440 profile, |
438 new DevToolsDataSource(profile->GetRequestContext())); | 441 new DevToolsDataSource(profile->GetRequestContext())); |
439 | 442 |
440 GURL url = web_ui->GetWebContents()->GetVisibleURL(); | 443 GURL url = web_ui->GetWebContents()->GetVisibleURL(); |
441 if (url.spec() == SanitizeFrontendURL(url).spec()) | 444 if (url.spec() != SanitizeFrontendURL(url).spec()) |
442 bindings_.reset(new DevToolsUIBindings(web_ui->GetWebContents())); | 445 return; |
446 | |
447 if (profile->IsOffTheRecord()) { | |
448 GURL site = content::SiteInstance::GetSiteForURL(profile, url); | |
kinuko
2016/12/09 03:37:15
Just to be extra sure, this URL is going to be dev
dgozman
2016/12/09 05:51:46
Correct. We even sanitize it in line 444.
| |
449 content::BrowserContext::GetStoragePartitionForSite(profile, site)-> | |
450 GetFileSystemContext()->EnableTemporaryFileSystemInIncognito(); | |
451 } | |
452 bindings_.reset(new DevToolsUIBindings(web_ui->GetWebContents())); | |
443 } | 453 } |
444 | 454 |
445 DevToolsUI::~DevToolsUI() { | 455 DevToolsUI::~DevToolsUI() { |
446 } | 456 } |
OLD | NEW |