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

Side by Side Diff: chrome/browser/extensions/extension_resource_protocols.cc

Issue 690313002: Override IsRedirectResponse in extension protocols (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | extensions/browser/extension_protocols.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/extensions/extension_resource_protocols.h" 5 #include "chrome/browser/extensions/extension_resource_protocols.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 17 matching lines...) Expand all
28 net::NetworkDelegate* network_delegate) 28 net::NetworkDelegate* network_delegate)
29 : net::URLRequestFileJob( 29 : net::URLRequestFileJob(
30 request, network_delegate, base::FilePath(), 30 request, network_delegate, base::FilePath(),
31 content::BrowserThread::GetBlockingPool()-> 31 content::BrowserThread::GetBlockingPool()->
32 GetTaskRunnerWithShutdownBehavior( 32 GetTaskRunnerWithShutdownBehavior(
33 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)), 33 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
34 weak_ptr_factory_(this) {} 34 weak_ptr_factory_(this) {}
35 35
36 virtual void Start() OVERRIDE; 36 virtual void Start() OVERRIDE;
37 37
38 virtual bool IsRedirectResponse(GURL* location,
39 int* http_status_code) override;
40
38 protected: 41 protected:
39 virtual ~ExtensionResourcesJob() {} 42 virtual ~ExtensionResourcesJob() {}
40 43
41 void ResolvePathDone(const base::FilePath& resolved_path); 44 void ResolvePathDone(const base::FilePath& resolved_path);
42 45
43 private: 46 private:
44 base::WeakPtrFactory<ExtensionResourcesJob> weak_ptr_factory_; 47 base::WeakPtrFactory<ExtensionResourcesJob> weak_ptr_factory_;
45 48
46 base::ThreadChecker thread_checker_; 49 base::ThreadChecker thread_checker_;
47 50
48 DISALLOW_COPY_AND_ASSIGN(ExtensionResourcesJob); 51 DISALLOW_COPY_AND_ASSIGN(ExtensionResourcesJob);
49 }; 52 };
50 53
51 void ExtensionResourcesJob::Start() { 54 void ExtensionResourcesJob::Start() {
52 DCHECK(thread_checker_.CalledOnValidThread()); 55 DCHECK(thread_checker_.CalledOnValidThread());
53 content::BrowserThread::PostTaskAndReplyWithResult( 56 content::BrowserThread::PostTaskAndReplyWithResult(
54 content::BrowserThread::FILE, FROM_HERE, 57 content::BrowserThread::FILE, FROM_HERE,
55 base::Bind(&ResolvePath, request()->url()), 58 base::Bind(&ResolvePath, request()->url()),
56 base::Bind(&ExtensionResourcesJob::ResolvePathDone, 59 base::Bind(&ExtensionResourcesJob::ResolvePathDone,
57 weak_ptr_factory_.GetWeakPtr())); 60 weak_ptr_factory_.GetWeakPtr()));
58 } 61 }
59 62
63 bool ExtensionResourcesJob::IsRedirectResponse(GURL* location,
64 int* http_status_code) {
65 return false;
66 }
67
60 void ExtensionResourcesJob::ResolvePathDone( 68 void ExtensionResourcesJob::ResolvePathDone(
61 const base::FilePath& resolved_path) { 69 const base::FilePath& resolved_path) {
62 DCHECK(thread_checker_.CalledOnValidThread()); 70 DCHECK(thread_checker_.CalledOnValidThread());
63 file_path_ = resolved_path; 71 file_path_ = resolved_path;
64 net::URLRequestFileJob::Start(); 72 net::URLRequestFileJob::Start();
65 } 73 }
66 74
67 class ExtensionResourceProtocolHandler 75 class ExtensionResourceProtocolHandler
68 : public net::URLRequestJobFactory::ProtocolHandler { 76 : public net::URLRequestJobFactory::ProtocolHandler {
69 public: 77 public:
(...skipping 14 matching lines...) Expand all
84 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { 92 net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
85 return new ExtensionResourcesJob(request, network_delegate); 93 return new ExtensionResourcesJob(request, network_delegate);
86 } 94 }
87 95
88 } // namespace 96 } // namespace
89 97
90 net::URLRequestJobFactory::ProtocolHandler* 98 net::URLRequestJobFactory::ProtocolHandler*
91 CreateExtensionResourceProtocolHandler() { 99 CreateExtensionResourceProtocolHandler() {
92 return new ExtensionResourceProtocolHandler(); 100 return new ExtensionResourceProtocolHandler();
93 } 101 }
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/extension_protocols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698