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

Side by Side Diff: net/proxy/proxy_resolver_error_observer_mojo.h

Issue 1017453005: Add support for ProxyResolverErrorObserver to ProxyResolverMojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_MOJO_H_
6 #define NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_MOJO_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/single_thread_task_runner.h"
12 #include "net/interfaces/proxy_resolver_service.mojom.h"
13 #include "net/proxy/proxy_resolver_error_observer.h"
14
15 namespace net {
16
17 // An implementation of ProxyResolverErrorObserver that forwards errors to an
18 // interfaces::ProxyResolverErrorObserver mojo interface.
19 class ProxyResolverErrorObserverMojo : public ProxyResolverErrorObserver {
20 public:
21 static scoped_ptr<ProxyResolverErrorObserver> Create(
22 interfaces::ProxyResolverErrorObserverPtr error_observer);
23
24 void OnPACScriptError(int line_number, const base::string16& error) override;
25
26 private:
27 explicit ProxyResolverErrorObserverMojo(
28 interfaces::ProxyResolverErrorObserverPtr error_observer);
29 ~ProxyResolverErrorObserverMojo() override;
30
31 // |error_observer_| may only be accessed when running on |task_runner_|.
32 interfaces::ProxyResolverErrorObserverPtr error_observer_;
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
34
35 // Creating a new WeakPtr is only valid on the original thread, but copying an
36 // existing WeakPtr is valid on any thread so keep |weak_this_| ready to copy.
37 base::WeakPtr<ProxyResolverErrorObserverMojo> weak_this_;
38 base::WeakPtrFactory<ProxyResolverErrorObserverMojo> weak_factory_;
39 };
40
41 } // namespace net
42
43 #endif // NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_MOJO_H_
OLDNEW
« no previous file with comments | « net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc ('k') | net/proxy/proxy_resolver_error_observer_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698