Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / net / proxy / proxy_resolver_error_observer_mojo.h
blob95a8ff9b15425f7302ad9a77e81db081fb77ee87
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.
5 #ifndef NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_MOJO_H_
6 #define NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_MOJO_H_
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"
15 namespace net {
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);
24 void OnPACScriptError(int line_number, const base::string16& error) override;
26 private:
27 explicit ProxyResolverErrorObserverMojo(
28 interfaces::ProxyResolverErrorObserverPtr error_observer);
29 ~ProxyResolverErrorObserverMojo() override;
31 // |error_observer_| may only be accessed when running on |task_runner_|.
32 interfaces::ProxyResolverErrorObserverPtr error_observer_;
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
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_;
41 } // namespace net
43 #endif // NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_MOJO_H_