Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(611)

Side by Side Diff: chrome/browser/ui/webui/net_export_ui.cc

Issue 2852133002: Remove PAC-fetching URLRequestContext. (Closed)
Patch Set: More upstream merge conflicts! Fun! Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/ui/webui/net_export_ui.h" 5 #include "chrome/browser/ui/webui/net_export_ui.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #if defined(OS_ANDROID) 44 #if defined(OS_ANDROID)
45 #include "chrome/browser/android/intent_helper.h" 45 #include "chrome/browser/android/intent_helper.h"
46 #endif 46 #endif
47 47
48 using content::BrowserThread; 48 using content::BrowserThread;
49 using content::WebContents; 49 using content::WebContents;
50 using content::WebUIMessageHandler; 50 using content::WebUIMessageHandler;
51 51
52 namespace { 52 namespace {
53 53
54 class ProxyScriptFetcherContextGetter : public net::URLRequestContextGetter {
55 public:
56 explicit ProxyScriptFetcherContextGetter(IOThread* io_thread)
57 : io_thread_(io_thread) {}
58
59 net::URLRequestContext* GetURLRequestContext() override {
60 DCHECK_CURRENTLY_ON(BrowserThread::IO);
61 DCHECK(io_thread_->globals()->proxy_script_fetcher_context.get());
62 return io_thread_->globals()->proxy_script_fetcher_context.get();
63 }
64
65 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
66 const override {
67 return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
68 }
69
70 protected:
71 ~ProxyScriptFetcherContextGetter() override {}
72
73 private:
74 IOThread* const io_thread_; // Owned by BrowserProcess.
75 };
76
77 // May only be accessed on the UI thread 54 // May only be accessed on the UI thread
78 base::LazyInstance<base::FilePath>::Leaky 55 base::LazyInstance<base::FilePath>::Leaky
79 last_save_dir = LAZY_INSTANCE_INITIALIZER; 56 last_save_dir = LAZY_INSTANCE_INITIALIZER;
80 57
81 content::WebUIDataSource* CreateNetExportHTMLSource() { 58 content::WebUIDataSource* CreateNetExportHTMLSource() {
82 content::WebUIDataSource* source = 59 content::WebUIDataSource* source =
83 content::WebUIDataSource::Create(chrome::kChromeUINetExportHost); 60 content::WebUIDataSource::Create(chrome::kChromeUINetExportHost);
84 61
85 source->SetJsonPath("strings.js"); 62 source->SetJsonPath("strings.js");
86 source->AddResourcePath(net_log::kNetExportUIJS, IDR_NET_LOG_NET_EXPORT_JS); 63 source->AddResourcePath(net_log::kNetExportUIJS, IDR_NET_LOG_NET_EXPORT_JS);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 URLRequestContextGetterList context_getters; 369 URLRequestContextGetterList context_getters;
393 370
394 Profile* profile = Profile::FromWebUI(web_ui()); 371 Profile* profile = Profile::FromWebUI(web_ui());
395 372
396 context_getters.push_back(profile->GetRequestContext()); 373 context_getters.push_back(profile->GetRequestContext());
397 context_getters.push_back( 374 context_getters.push_back(
398 content::BrowserContext::GetDefaultStoragePartition(profile) 375 content::BrowserContext::GetDefaultStoragePartition(profile)
399 ->GetMediaURLRequestContext()); 376 ->GetMediaURLRequestContext());
400 context_getters.push_back( 377 context_getters.push_back(
401 g_browser_process->io_thread()->system_url_request_context_getter()); 378 g_browser_process->io_thread()->system_url_request_context_getter());
402 context_getters.push_back(
403 new ProxyScriptFetcherContextGetter(g_browser_process->io_thread()));
404 379
405 return context_getters; 380 return context_getters;
406 } 381 }
407 382
408 } // namespace 383 } // namespace
409 384
410 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) { 385 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) {
411 web_ui->AddMessageHandler(base::MakeUnique<NetExportMessageHandler>()); 386 web_ui->AddMessageHandler(base::MakeUnique<NetExportMessageHandler>());
412 387
413 // Set up the chrome://net-export/ source. 388 // Set up the chrome://net-export/ source.
414 Profile* profile = Profile::FromWebUI(web_ui); 389 Profile* profile = Profile::FromWebUI(web_ui);
415 content::WebUIDataSource::Add(profile, CreateNetExportHTMLSource()); 390 content::WebUIDataSource::Add(profile, CreateNetExportHTMLSource());
416 } 391 }
OLDNEW
« no previous file with comments | « chrome/browser/net/proxy_browsertest.cc ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698