diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-02-21 12:16:55 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-02-21 12:16:55 +0000 |
commit | 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7 (patch) | |
tree | 5d4ae202b870bd86673f596f0d424bc4b3e55ebe /cloud_print | |
parent | e862bac9c33104a29d98631d62668ae7b6676510 (diff) | |
download | chromium_org-5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7.tar.gz |
Merge from Chromium at DEPS revision 251904
This commit was generated by merge_to_master.py.
Change-Id: I1f9543259d7d2a57d81aa41a1b84f85837439d21
Diffstat (limited to 'cloud_print')
-rw-r--r-- | cloud_print/gcp20/prototype/cloud_print_requester.cc | 2 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/dns_response_builder.cc | 68 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/dns_response_builder.h | 40 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/dns_sd_server.cc | 49 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/gcp20_device.cc | 3 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/printer.cc | 16 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/printer_state.cc | 4 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/privet_http_server.cc | 6 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/service_parameters.cc | 2 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/service_parameters.h | 2 | ||||
-rw-r--r-- | cloud_print/service/common-controls.manifest | 8 | ||||
-rw-r--r-- | cloud_print/service/service.gyp | 12 | ||||
-rw-r--r-- | cloud_print/service/service_state.cc | 6 | ||||
-rw-r--r-- | cloud_print/service/win/chrome_launcher.cc | 2 | ||||
-rw-r--r-- | cloud_print/service/win/cloud_print_service_config.cc | 45 | ||||
-rw-r--r-- | cloud_print/virtual_driver/win/virtual_driver64.gyp | 2 |
16 files changed, 182 insertions, 85 deletions
diff --git a/cloud_print/gcp20/prototype/cloud_print_requester.cc b/cloud_print/gcp20/prototype/cloud_print_requester.cc index ade85efccd..d46fdf4acc 100644 --- a/cloud_print/gcp20/prototype/cloud_print_requester.cc +++ b/cloud_print/gcp20/prototype/cloud_print_requester.cc @@ -78,7 +78,7 @@ GURL CreateUpdateUrl(const std::string& device_id) { std::string LocalSettingsToJson(const LocalSettings& settings) { base::DictionaryValue dictionary; - scoped_ptr<base::DictionaryValue> current(new DictionaryValue); + scoped_ptr<base::DictionaryValue> current(new base::DictionaryValue); // TODO(maksymb): Formalize text as constants. current->SetBoolean("local_discovery", settings.local_discovery); diff --git a/cloud_print/gcp20/prototype/dns_response_builder.cc b/cloud_print/gcp20/prototype/dns_response_builder.cc index c5ad6029ef..23cc866d2b 100644 --- a/cloud_print/gcp20/prototype/dns_response_builder.cc +++ b/cloud_print/gcp20/prototype/dns_response_builder.cc @@ -37,19 +37,24 @@ DnsResponseBuilder::DnsResponseBuilder(uint16 id) { DnsResponseBuilder::~DnsResponseBuilder() { } -void DnsResponseBuilder::AppendPtr(const std::string& service_type, uint32 ttl, - const std::string& service_name) { +void DnsResponseBuilder::AppendPtr(const std::string& service_type, + uint32 ttl, + const std::string& service_name, + bool answer) { std::string rdata; bool success = net::DNSDomainFromDot(service_name, &rdata); DCHECK(success); - AddResponse(service_type, net::dns_protocol::kTypePTR, ttl, rdata); + AddResponse(service_type, net::dns_protocol::kTypePTR, ttl, rdata, answer); } -void DnsResponseBuilder::AppendSrv(const std::string& service_name, uint32 ttl, - uint16 priority, uint16 weight, +void DnsResponseBuilder::AppendSrv(const std::string& service_name, + uint32 ttl, + uint16 priority, + uint16 weight, uint16 http_port, - const std::string& service_domain_name) { + const std::string& service_domain_name, + bool answer) { std::string domain_name; bool success = net::DNSDomainFromDot(service_domain_name, &domain_name); DCHECK(success); @@ -65,11 +70,13 @@ void DnsResponseBuilder::AppendSrv(const std::string& service_name, uint32 ttl, DCHECK_EQ(writer.remaining(), 0); // For warranty of correct size allocation. AddResponse(service_name, net::dns_protocol::kTypeSRV, ttl, - std::string(rdata.begin(), rdata.end())); + std::string(rdata.begin(), rdata.end()), answer); } void DnsResponseBuilder::AppendA(const std::string& service_domain_name, - uint32 ttl, net::IPAddressNumber http_ipv4) { + uint32 ttl, + net::IPAddressNumber http_ipv4, + bool answer) { // TODO(maksymb): IP to send must depends on interface from where query was // received. if (http_ipv4.empty()) { @@ -78,11 +85,28 @@ void DnsResponseBuilder::AppendA(const std::string& service_domain_name, } AddResponse(service_domain_name, net::dns_protocol::kTypeA, ttl, - std::string(http_ipv4.begin(), http_ipv4.end())); + std::string(http_ipv4.begin(), http_ipv4.end()), answer); } -void DnsResponseBuilder::AppendTxt(const std::string& service_name, uint32 ttl, - const std::vector<std::string>& metadata) { +void DnsResponseBuilder::AppendAAAA(const std::string& service_domain_name, + uint32 ttl, + net::IPAddressNumber http_ipv6, + bool answer) { + // TODO(maksymb): IP to send must depends on interface from where query was + // received. + if (http_ipv6.empty()) { + LOG(ERROR) << "Invalid IP"; + return; + } + + AddResponse(service_domain_name, net::dns_protocol::kTypeAAAA, ttl, + std::string(http_ipv6.begin(), http_ipv6.end()), answer); +} + +void DnsResponseBuilder::AppendTxt(const std::string& service_name, + uint32 ttl, + const std::vector<std::string>& metadata, + bool answer) { std::string rdata; for (std::vector<std::string>::const_iterator str = metadata.begin(); str != metadata.end(); ++str) { @@ -92,7 +116,7 @@ void DnsResponseBuilder::AppendTxt(const std::string& service_name, uint32 ttl, rdata += *str; } - AddResponse(service_name, net::dns_protocol::kTypeTXT, ttl, rdata); + AddResponse(service_name, net::dns_protocol::kTypeTXT, ttl, rdata, answer); } scoped_refptr<net::IOBufferWithSize> DnsResponseBuilder::Build() { @@ -108,8 +132,8 @@ scoped_refptr<net::IOBufferWithSize> DnsResponseBuilder::Build() { if (responses_.empty()) return NULL; // No answer. - header_.ancount = static_cast<uint16>(responses_.size()); - + DCHECK_EQ(static_cast<size_t>(header_.ancount + header_.arcount), + responses_.size()); scoped_refptr<net::IOBufferWithSize> message( new net::IOBufferWithSize(static_cast<int>(size))); net::BigEndianWriter writer(message->data(), message->size()); @@ -143,14 +167,24 @@ scoped_refptr<net::IOBufferWithSize> DnsResponseBuilder::Build() { return message; } -void DnsResponseBuilder::AddResponse(const std::string& name, uint16 type, - uint32 ttl, const std::string& rdata) { +void DnsResponseBuilder::AddResponse(const std::string& name, + uint16 type, + uint32 ttl, + const std::string& rdata, + bool answer) { DnsResponseRecord response; response.name = name; response.klass = klass; response.ttl = ttl; response.type = type; response.rdata = rdata; - responses_.push_back(response); + + if (answer) { + responses_.insert(responses_.begin() + header_.ancount, response); + ++header_.ancount; + } else { + responses_.push_back(response); + ++header_.arcount; + } } diff --git a/cloud_print/gcp20/prototype/dns_response_builder.h b/cloud_print/gcp20/prototype/dns_response_builder.h index 0d4a3eb4b7..b574ddf1dc 100644 --- a/cloud_print/gcp20/prototype/dns_response_builder.h +++ b/cloud_print/gcp20/prototype/dns_response_builder.h @@ -40,23 +40,43 @@ class DnsResponseBuilder { ~DnsResponseBuilder(); // Methods for appending different types of responses to packet. - void AppendPtr(const std::string& service_type, uint32 ttl, - const std::string& service_name); - void AppendSrv(const std::string& service_name, uint32 ttl, uint16 priority, + void AppendPtr(const std::string& service_type, + uint32 ttl, + const std::string& service_name, + bool answer); + + void AppendSrv(const std::string& service_name, + uint32 ttl, + uint16 priority, uint16 weight, uint16 http_port, - const std::string& service_domain_name); - void AppendA(const std::string& service_domain_name, uint32 ttl, - net::IPAddressNumber http_ipv4); - void AppendTxt(const std::string& service_name, uint32 ttl, - const std::vector<std::string>& metadata); + const std::string& service_domain_name, + bool answer); + + void AppendA(const std::string& service_domain_name, + uint32 ttl, + net::IPAddressNumber http_ipv4, + bool answer); + + void AppendAAAA(const std::string& service_domain_name, + uint32 ttl, + net::IPAddressNumber http_ipv6, + bool answer); + + void AppendTxt(const std::string& service_name, + uint32 ttl, + const std::vector<std::string>& metadata, + bool answer); // Serializes packet to byte sequence. scoped_refptr<net::IOBufferWithSize> Build(); private: // Appends response to packet. - void AddResponse(const std::string& name, uint16 type, uint32 ttl, - const std::string& rdata); + void AddResponse(const std::string& name, + uint16 type, + uint32 ttl, + const std::string& rdata, + bool answer); std::vector<DnsResponseRecord> responses_; diff --git a/cloud_print/gcp20/prototype/dns_sd_server.cc b/cloud_print/gcp20/prototype/dns_sd_server.cc index 85b3f8778d..f5500decd5 100644 --- a/cloud_print/gcp20/prototype/dns_sd_server.cc +++ b/cloud_print/gcp20/prototype/dns_sd_server.cc @@ -101,7 +101,7 @@ void DnsSdServer::UpdateMetadata(const std::vector<std::string>& metadata) { if (!CommandLine::ForCurrentProcess()->HasSwitch("no-announcement")) { DnsResponseBuilder builder(current_ttl); - builder.AppendTxt(serv_params_.service_name_, current_ttl, metadata_); + builder.AppendTxt(serv_params_.service_name_, current_ttl, metadata_, true); scoped_refptr<net::IOBufferWithSize> buffer(builder.Build()); DCHECK(buffer.get() != NULL); @@ -203,7 +203,20 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query, if (query.qname == serv_params_.service_type_ || query.qname == serv_params_.secondary_service_type_) { builder->AppendPtr(query.qname, current_ttl, - serv_params_.service_name_); + serv_params_.service_name_, true); + + if (CommandLine::ForCurrentProcess()->HasSwitch("extended-response")) { + builder->AppendSrv(serv_params_.service_name_, current_ttl, + kSrvPriority, kSrvWeight, serv_params_.http_port_, + serv_params_.service_domain_name_, false); + builder->AppendA(serv_params_.service_domain_name_, current_ttl, + serv_params_.http_ipv4_, false); + builder->AppendAAAA(serv_params_.service_domain_name_, current_ttl, + serv_params_.http_ipv6_, false); + builder->AppendTxt(serv_params_.service_name_, current_ttl, metadata_, + false); + } + responded = true; } @@ -213,7 +226,7 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query, if (query.qname == serv_params_.service_name_) { builder->AppendSrv(serv_params_.service_name_, current_ttl, kSrvPriority, kSrvWeight, serv_params_.http_port_, - serv_params_.service_domain_name_); + serv_params_.service_domain_name_, true); responded = true; } break; @@ -221,14 +234,23 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query, log = "Processing A query"; if (query.qname == serv_params_.service_domain_name_) { builder->AppendA(serv_params_.service_domain_name_, current_ttl, - serv_params_.http_ipv4_); + serv_params_.http_ipv4_, true); + responded = true; + } + break; + case net::dns_protocol::kTypeAAAA: + log = "Processing AAAA query"; + if (query.qname == serv_params_.service_domain_name_) { + builder->AppendAAAA(serv_params_.service_domain_name_, current_ttl, + serv_params_.http_ipv6_, true); responded = true; } break; case net::dns_protocol::kTypeTXT: log = "Processing TXT query"; if (query.qname == serv_params_.service_name_) { - builder->AppendTxt(serv_params_.service_name_, current_ttl, metadata_); + builder->AppendTxt(serv_params_.service_name_, current_ttl, metadata_, + true); responded = true; } break; @@ -261,15 +283,18 @@ void DnsSdServer::SendAnnouncement(uint32 ttl) { DnsResponseBuilder builder(ttl); builder.AppendPtr(serv_params_.service_type_, ttl, - serv_params_.service_name_); + serv_params_.service_name_, true); builder.AppendPtr(serv_params_.secondary_service_type_, ttl, - serv_params_.service_name_); - builder.AppendSrv(serv_params_.service_name_, ttl, kSrvPriority, kSrvWeight, - serv_params_.http_port_, - serv_params_.service_domain_name_); + serv_params_.service_name_, true); + builder.AppendSrv(serv_params_.service_name_, ttl, kSrvPriority, + kSrvWeight, serv_params_.http_port_, + serv_params_.service_domain_name_, true); builder.AppendA(serv_params_.service_domain_name_, ttl, - serv_params_.http_ipv4_); - builder.AppendTxt(serv_params_.service_name_, ttl, metadata_); + serv_params_.http_ipv4_, true); + builder.AppendAAAA(serv_params_.service_domain_name_, ttl, + serv_params_.http_ipv6_, true); + builder.AppendTxt(serv_params_.service_name_, ttl, metadata_, true); + scoped_refptr<net::IOBufferWithSize> buffer(builder.Build()); DCHECK(buffer.get() != NULL); diff --git a/cloud_print/gcp20/prototype/gcp20_device.cc b/cloud_print/gcp20/prototype/gcp20_device.cc index 57972a37e7..2b38a9af4e 100644 --- a/cloud_print/gcp20/prototype/gcp20_device.cc +++ b/cloud_print/gcp20/prototype/gcp20_device.cc @@ -26,6 +26,7 @@ const char kHelpMessage[] = "HTTP header\n" " -h, --help prints this message\n" " --no-announcement disables DNS announcements\n" + " --extended-response responds to PTR with additional records\n" " --simulate-printing-errors simulates some errors for local printing\n" " --unicast-respond DNS responses will be sent in unicast " "instead of multicast\n" @@ -90,7 +91,7 @@ int main(int argc, char* argv[]) { signal(SIGINT, OnAbort); // Handle Ctrl+C signal. - base::MessageLoop loop(base::MessageLoop::TYPE_IO); + base::MessageLoopForIO loop; g_message_loop = &loop; g_message_loop->PostTask(FROM_HERE, base::Bind(&StartPrinter, &printer)); base::RunLoop runner; diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc index 1d758f7f27..fdbdf8705e 100644 --- a/cloud_print/gcp20/prototype/printer.cc +++ b/cloud_print/gcp20/prototype/printer.cc @@ -4,6 +4,7 @@ #include "cloud_print/gcp20/prototype/printer.h" +#include <algorithm> #include <limits.h> #include <stdio.h> #include <string> @@ -37,7 +38,7 @@ const uint32 kTtlDefault = 60*60; // in seconds const char kServiceType[] = "_privet._tcp.local"; const char kSecondaryServiceType[] = "_printer._sub._privet._tcp.local"; -const char kServiceNamePrefixDefault[] = "first_gcp20_device"; +const char kServiceNamePrefixDefault[] = "gcp20_device_"; const char kServiceDomainNameFormatDefault[] = "my-privet-device%d.local"; const char kPrinterName[] = "Google GCP2.0 Prototype"; @@ -111,7 +112,8 @@ const char kCdd[] = net::IPAddressNumber GetLocalIp(const std::string& interface_name, bool return_ipv6_number) { net::NetworkInterfaceList interfaces; - bool success = net::GetNetworkList(&interfaces); + bool success = net::GetNetworkList( + &interfaces, net::INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES); DCHECK(success); size_t expected_address_size = return_ipv6_number ? net::kIPv6AddressSize @@ -841,8 +843,10 @@ bool Printer::StartDnsServer() { uint16 port = command_line_reader::ReadHttpPort(kHttpPortDefault); std::string service_name_prefix = - command_line_reader::ReadServiceNamePrefix(net::IPAddressToString(ip) + - kServiceNamePrefixDefault); + command_line_reader::ReadServiceNamePrefix(kServiceNamePrefixDefault + + net::IPAddressToString(ip)); + std::replace(service_name_prefix .begin(), service_name_prefix .end(), + '.', '_'); std::string service_domain_name = command_line_reader::ReadDomainName( @@ -850,8 +854,8 @@ bool Printer::StartDnsServer() { base::RandInt(0, INT_MAX))); ServiceParameters params(kServiceType, kSecondaryServiceType, - service_name_prefix, - service_domain_name, ip, port); + service_name_prefix, service_domain_name, + ip, GetLocalIp("", true), port); return dns_server_.Start(params, command_line_reader::ReadTtl(kTtlDefault), diff --git a/cloud_print/gcp20/prototype/printer_state.cc b/cloud_print/gcp20/prototype/printer_state.cc index 156ebe4623..0e12eee0da 100644 --- a/cloud_print/gcp20/prototype/printer_state.cc +++ b/cloud_print/gcp20/prototype/printer_state.cc @@ -8,7 +8,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/logging.h" -#include "base/safe_numerics.h" +#include "base/numerics/safe_conversions.h" #include "base/values.h" namespace { @@ -74,7 +74,7 @@ bool SaveToFile(const base::FilePath& path, const PrinterState& state) { base::JSONWriter::WriteWithOptions(&json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json_str); - int size = base::checked_numeric_cast<int>(json_str.size()); + int size = base::checked_cast<int>(json_str.size()); return (file_util::WriteFile(path, json_str.data(), size) == size); } diff --git a/cloud_print/gcp20/prototype/privet_http_server.cc b/cloud_print/gcp20/prototype/privet_http_server.cc index d589657eb1..9aa2835d19 100644 --- a/cloud_print/gcp20/prototype/privet_http_server.cc +++ b/cloud_print/gcp20/prototype/privet_http_server.cc @@ -302,7 +302,7 @@ scoped_ptr<base::DictionaryValue> PrivetHttpServer::ProcessCreateJob( *status_code = net::HTTP_OK; switch (result) { case LocalPrintJob::CREATE_SUCCESS: - response.reset(new DictionaryValue); + response.reset(new base::DictionaryValue); response->SetString("job_id", job_id); response->SetInteger("expires_in", expires_in); return response.Pass(); @@ -354,7 +354,7 @@ scoped_ptr<base::DictionaryValue> PrivetHttpServer::ProcessSubmitDoc( // Create response *status_code = net::HTTP_OK; - scoped_ptr<base::DictionaryValue> response(new DictionaryValue); + scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue); switch (status) { case LocalPrintJob::SAVE_SUCCESS: response->SetString("job_id", job_id); @@ -422,7 +422,7 @@ scoped_ptr<base::DictionaryValue> PrivetHttpServer::ProcessRegister( !user.empty(); RegistrationErrorStatus status = REG_ERROR_INVALID_PARAMS; - scoped_ptr<base::DictionaryValue> response(new DictionaryValue); + scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue); if (params_present) { response->SetString("action", action); diff --git a/cloud_print/gcp20/prototype/service_parameters.cc b/cloud_print/gcp20/prototype/service_parameters.cc index 85ba83c275..c15be13cea 100644 --- a/cloud_print/gcp20/prototype/service_parameters.cc +++ b/cloud_print/gcp20/prototype/service_parameters.cc @@ -15,11 +15,13 @@ ServiceParameters::ServiceParameters(const std::string& service_type, const std::string& service_name_prefix, const std::string& service_domain_name, const net::IPAddressNumber& http_ipv4, + const net::IPAddressNumber& http_ipv6, uint16 http_port) : service_type_(service_type), secondary_service_type_(secondary_service_type), service_name_(service_name_prefix + "." + service_type), service_domain_name_(service_domain_name), http_ipv4_(http_ipv4), + http_ipv6_(http_ipv6), http_port_(http_port) { } diff --git a/cloud_print/gcp20/prototype/service_parameters.h b/cloud_print/gcp20/prototype/service_parameters.h index 881e15f250..b22b3dd1a9 100644 --- a/cloud_print/gcp20/prototype/service_parameters.h +++ b/cloud_print/gcp20/prototype/service_parameters.h @@ -20,6 +20,7 @@ struct ServiceParameters { const std::string& service_name_prefix, const std::string& service_domain_name, const net::IPAddressNumber& http_ipv4, + const net::IPAddressNumber& http_ipv6, uint16 http_port); std::string service_type_; @@ -27,6 +28,7 @@ struct ServiceParameters { std::string service_name_; std::string service_domain_name_; net::IPAddressNumber http_ipv4_; + net::IPAddressNumber http_ipv6_; uint16 http_port_; }; diff --git a/cloud_print/service/common-controls.manifest b/cloud_print/service/common-controls.manifest new file mode 100644 index 0000000000..1710196fce --- /dev/null +++ b/cloud_print/service/common-controls.manifest @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/cloud_print/service/service.gyp b/cloud_print/service/service.gyp index 2e07037cd2..f4bc65bb67 100644 --- a/cloud_print/service/service.gyp +++ b/cloud_print/service/service.gyp @@ -137,19 +137,17 @@ 'cloud_print_service_lib', ], 'msvs_settings': { + 'VCManifestTool': { + 'AdditionalManifestFiles': [ + 'common-controls.manifest', + ], + }, 'VCLinkerTool': { 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS 'UACExecutionLevel': '2', # /level='requireAdministrator' 'AdditionalDependencies': [ 'secur32.lib', ], - 'AdditionalOptions': [ # Enable Vista+ look. - "\"/manifestdependency:type='win32' " - "name='Microsoft.Windows.Common-Controls' " - "version='6.0.0.0' " - "processorArchitecture='*' " - "publicKeyToken='6595b64144ccf1df' language='*'\"", - ], }, }, }, diff --git a/cloud_print/service/service_state.cc b/cloud_print/service/service_state.cc index 1937ba2cac..0894e20516 100644 --- a/cloud_print/service/service_state.cc +++ b/cloud_print/service/service_state.cc @@ -135,9 +135,9 @@ bool ServiceState::IsValid() const { } std::string ServiceState::ToString() { - scoped_ptr<base::DictionaryValue> services(new DictionaryValue()); + scoped_ptr<base::DictionaryValue> services(new base::DictionaryValue()); - scoped_ptr<base::DictionaryValue> cloud_print(new DictionaryValue()); + scoped_ptr<base::DictionaryValue> cloud_print(new base::DictionaryValue()); cloud_print->SetBoolean(kEnabledOptionName, true); SetNotEmptyJsonString(cloud_print.get(), kEmailOptionName, email_); @@ -160,7 +160,7 @@ std::string ServiceState::ToString() { std::string ServiceState::LoginToGoogle(const std::string& service, const std::string& email, const std::string& password) { - base::MessageLoop loop(base::MessageLoop::TYPE_IO); + base::MessageLoopForIO loop; net::URLRequestContextBuilder builder; scoped_ptr<net::URLRequestContext> context(builder.Build()); diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc index 7f3717e57e..f6b863ecd9 100644 --- a/cloud_print/service/win/chrome_launcher.cc +++ b/cloud_print/service/win/chrome_launcher.cc @@ -32,7 +32,7 @@ namespace { const int kShutdownTimeoutMs = 30 * 1000; const int kUsageUpdateTimeoutMs = 6 * 3600 * 1000; // 6 hours. -static const char16 kAutoRunKeyPath[] = +static const base::char16 kAutoRunKeyPath[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; // Terminates any process. diff --git a/cloud_print/service/win/cloud_print_service_config.cc b/cloud_print/service/win/cloud_print_service_config.cc index d7321f2c59..955682603d 100644 --- a/cloud_print/service/win/cloud_print_service_config.cc +++ b/cloud_print/service/win/cloud_print_service_config.cc @@ -11,6 +11,8 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/message_loop/message_loop.h" +#include "base/message_loop/message_pump_dispatcher.h" +#include "base/run_loop.h" #include "base/strings/string16.h" #include "base/threading/thread.h" #include "chrome/common/chrome_constants.h" @@ -29,15 +31,18 @@ class SetupDialog : public base::RefCounted<SetupDialog>, public ATL::CDialogImpl<SetupDialog> { public: // Enables accelerators. - class MessageFilter : public base::MessageLoopForUI::MessageFilter { + class Dispatcher : public base::MessagePumpDispatcher { public: - explicit MessageFilter(SetupDialog* dialog) : dialog_(dialog){} - virtual ~MessageFilter() {}; + explicit Dispatcher(SetupDialog* dialog) : dialog_(dialog) {} + virtual ~Dispatcher() {}; - // MessageLoopForUI::MessageFilter - virtual bool ProcessMessage(const MSG& msg) OVERRIDE { + // MessagePumpDispatcher: + virtual uint32_t Dispatch(const MSG& msg) OVERRIDE { MSG msg2 = msg; - return dialog_->IsDialogMessage(&msg2) != FALSE; + uint32_t action = POST_DISPATCH_NONE; + if (!dialog_->IsDialogMessage(&msg2)) + action = POST_DISPATCH_PERFORM_DEFAULT; + return action; } private: @@ -123,7 +128,7 @@ SetupDialog::SetupDialog() : state_(ServiceController::STATE_NOT_FOUND), worker_("worker") { ui_loop_ = base::MessageLoop::current(); - DCHECK(ui_loop_->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); worker_.StartWithOptions( base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); @@ -140,14 +145,14 @@ void SetupDialog::PostIOTask(const base::Closure& task) { } void SetupDialog::ShowErrorMessageBox(const base::string16& error_message) { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); MessageBox(error_message.c_str(), LoadLocalString(IDS_OPERATION_FAILED_TITLE).c_str(), MB_ICONERROR | MB_OK); } void SetupDialog::AskToCloseChrome() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); MessageBox(LoadLocalString(IDS_ADD_PRINTERS_USING_CHROME).c_str(), LoadLocalString(IDS_CONTINUE_IN_CHROME_TITLE).c_str(), MB_OK); @@ -156,7 +161,7 @@ void SetupDialog::AskToCloseChrome() { void SetupDialog::SetState(ServiceController::State status, const base::string16& user, bool is_logging_enabled) { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); state_ = status; DWORD status_string = 0; @@ -303,14 +308,14 @@ bool SetupDialog::IsLoggingEnabled() const{ } void SetupDialog::UpdateState() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); controller_.UpdateState(); PostUITask(base::Bind(&SetupDialog::SetState, this, controller_.state(), controller_.user(), controller_.is_logging_enabled())); } void SetupDialog::ShowError(const base::string16& error_message) { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); PostUITask(base::Bind(&SetupDialog::SetState, this, ServiceController::STATE_UNKNOWN, @@ -336,7 +341,7 @@ void SetupDialog::Install(const base::string16& user, base::ScopedClosureRunner scoped_update_status( base::Bind(&SetupDialog::UpdateState, this)); - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); SetupListener setup(GetUser()); HRESULT hr = controller_.InstallCheckService(user, password, @@ -404,7 +409,7 @@ void SetupDialog::Install(const base::string16& user, } void SetupDialog::Start() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); HRESULT hr = controller_.StartService(); if (FAILED(hr)) ShowError(hr); @@ -412,7 +417,7 @@ void SetupDialog::Start() { } void SetupDialog::Stop() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); HRESULT hr = controller_.StopService(); if (FAILED(hr)) ShowError(hr); @@ -420,7 +425,7 @@ void SetupDialog::Stop() { } void SetupDialog::Uninstall() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); HRESULT hr = controller_.UninstallService(); if (FAILED(hr)) ShowError(hr); @@ -444,10 +449,8 @@ int WINAPI WinMain(__in HINSTANCE hInstance, scoped_refptr<SetupDialog> dialog(new SetupDialog()); dialog->Create(NULL); dialog->ShowWindow(SW_SHOW); - scoped_ptr<SetupDialog::MessageFilter> filter( - new SetupDialog::MessageFilter(dialog)); - loop.SetMessageFilter(filter.Pass()); - - loop.Run(); + SetupDialog::Dispatcher dispatcher(dialog); + base::RunLoop run_loop(&dispatcher); + run_loop.Run(); return 0; } diff --git a/cloud_print/virtual_driver/win/virtual_driver64.gyp b/cloud_print/virtual_driver/win/virtual_driver64.gyp index b41a992e03..26a167fd9b 100644 --- a/cloud_print/virtual_driver/win/virtual_driver64.gyp +++ b/cloud_print/virtual_driver/win/virtual_driver64.gyp @@ -11,7 +11,7 @@ '<@(nacl_win64_defines)', ], 'dependencies': [ - '<(DEPTH)/base/base.gyp:base_nacl_win64', + '<(DEPTH)/base/base.gyp:base_win64', '<(DEPTH)/chrome/chrome.gyp:launcher_support64', '<(DEPTH)/chrome/common_constants.gyp:common_constants_win64', ], |