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

Side by Side Diff: net/proxy/proxy_resolver_factory_mojo.cc

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 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
« no previous file with comments | « net/proxy/proxy_list.cc ('k') | net/proxy/proxy_resolver_factory_mojo_unittest.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 2015 The Chromium Authors. All rights reserved. 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 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 "net/proxy/proxy_resolver_factory_mojo.h" 5 #include "net/proxy/proxy_resolver_factory_mojo.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "mojo/common/common_type_converters.h" 17 #include "mojo/common/common_type_converters.h"
18 #include "mojo/public/cpp/bindings/binding.h" 18 #include "mojo/public/cpp/bindings/binding.h"
19 #include "net/base/load_states.h" 19 #include "net/base/load_states.h"
20 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
21 #include "net/dns/mojo_host_resolver_impl.h" 21 #include "net/dns/mojo_host_resolver_impl.h"
22 #include "net/interfaces/host_resolver_service.mojom.h" 22 #include "net/interfaces/host_resolver_service.mojom.h"
23 #include "net/interfaces/proxy_resolver_service.mojom.h" 23 #include "net/interfaces/proxy_resolver_service.mojom.h"
24 #include "net/log/net_log_event_type.h"
24 #include "net/proxy/mojo_proxy_resolver_factory.h" 25 #include "net/proxy/mojo_proxy_resolver_factory.h"
25 #include "net/proxy/mojo_proxy_type_converters.h" 26 #include "net/proxy/mojo_proxy_type_converters.h"
26 #include "net/proxy/proxy_info.h" 27 #include "net/proxy/proxy_info.h"
27 #include "net/proxy/proxy_resolver.h" 28 #include "net/proxy/proxy_resolver.h"
28 #include "net/proxy/proxy_resolver_error_observer.h" 29 #include "net/proxy/proxy_resolver_error_observer.h"
29 #include "net/proxy/proxy_resolver_script_data.h" 30 #include "net/proxy/proxy_resolver_script_data.h"
30 31
31 namespace net { 32 namespace net {
32 namespace { 33 namespace {
33 34
(...skipping 19 matching lines...) Expand all
53 const BoundNetLog& bound_net_log) 54 const BoundNetLog& bound_net_log)
54 : host_resolver_(host_resolver, bound_net_log), 55 : host_resolver_(host_resolver, bound_net_log),
55 error_observer_(error_observer), 56 error_observer_(error_observer),
56 net_log_(net_log), 57 net_log_(net_log),
57 bound_net_log_(bound_net_log) {} 58 bound_net_log_(bound_net_log) {}
58 59
59 // Overridden from ClientInterface: 60 // Overridden from ClientInterface:
60 void Alert(const mojo::String& message) override { 61 void Alert(const mojo::String& message) override {
61 base::string16 message_str = message.To<base::string16>(); 62 base::string16 message_str = message.To<base::string16>();
62 auto callback = NetLog::StringCallback("message", &message_str); 63 auto callback = NetLog::StringCallback("message", &message_str);
63 bound_net_log_.AddEvent(NetLog::TYPE_PAC_JAVASCRIPT_ALERT, callback); 64 bound_net_log_.AddEvent(NetLogEventType::PAC_JAVASCRIPT_ALERT, callback);
64 if (net_log_) 65 if (net_log_)
65 net_log_->AddGlobalEntry(NetLog::TYPE_PAC_JAVASCRIPT_ALERT, callback); 66 net_log_->AddGlobalEntry(NetLogEventType::PAC_JAVASCRIPT_ALERT, callback);
66 } 67 }
67 68
68 void OnError(int32_t line_number, const mojo::String& message) override { 69 void OnError(int32_t line_number, const mojo::String& message) override {
69 base::string16 message_str = message.To<base::string16>(); 70 base::string16 message_str = message.To<base::string16>();
70 auto callback = base::Bind(&NetLogErrorCallback, line_number, &message_str); 71 auto callback = base::Bind(&NetLogErrorCallback, line_number, &message_str);
71 bound_net_log_.AddEvent(NetLog::TYPE_PAC_JAVASCRIPT_ERROR, callback); 72 bound_net_log_.AddEvent(NetLogEventType::PAC_JAVASCRIPT_ERROR, callback);
72 if (net_log_) 73 if (net_log_)
73 net_log_->AddGlobalEntry(NetLog::TYPE_PAC_JAVASCRIPT_ERROR, callback); 74 net_log_->AddGlobalEntry(NetLogEventType::PAC_JAVASCRIPT_ERROR, callback);
74 if (error_observer_) 75 if (error_observer_)
75 error_observer_->OnPACScriptError(line_number, message_str); 76 error_observer_->OnPACScriptError(line_number, message_str);
76 } 77 }
77 78
78 void ResolveDns(interfaces::HostResolverRequestInfoPtr request_info, 79 void ResolveDns(interfaces::HostResolverRequestInfoPtr request_info,
79 interfaces::HostResolverRequestClientPtr client) override { 80 interfaces::HostResolverRequestClientPtr client) override {
80 host_resolver_.Resolve(std::move(request_info), std::move(client)); 81 host_resolver_.Resolve(std::move(request_info), std::move(client));
81 } 82 }
82 83
83 protected: 84 protected:
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 return ERR_PAC_SCRIPT_FAILED; 401 return ERR_PAC_SCRIPT_FAILED;
401 } 402 }
402 request->reset(new Job(this, pac_script, resolver, callback, 403 request->reset(new Job(this, pac_script, resolver, callback,
403 error_observer_factory_.is_null() 404 error_observer_factory_.is_null()
404 ? nullptr 405 ? nullptr
405 : error_observer_factory_.Run())); 406 : error_observer_factory_.Run()));
406 return ERR_IO_PENDING; 407 return ERR_IO_PENDING;
407 } 408 }
408 409
409 } // namespace net 410 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_list.cc ('k') | net/proxy/proxy_resolver_factory_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698