OLD | NEW |
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 "cloud_print/service/win/chrome_launcher.h" | 5 #include "cloud_print/service/win/chrome_launcher.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 url = net::AppendQueryParameter(url, "service", "cloudprint"); | 108 url = net::AppendQueryParameter(url, "service", "cloudprint"); |
109 url = net::AppendQueryParameter(url, "sarp", "1"); | 109 url = net::AppendQueryParameter(url, "sarp", "1"); |
110 return net::AppendQueryParameter( | 110 return net::AppendQueryParameter( |
111 url, "continue", GetCloudPrintServiceEnableURL(proxy_id).spec()); | 111 url, "continue", GetCloudPrintServiceEnableURL(proxy_id).spec()); |
112 } | 112 } |
113 | 113 |
114 std::string ReadAndUpdateServiceState(const base::FilePath& directory, | 114 std::string ReadAndUpdateServiceState(const base::FilePath& directory, |
115 const std::string& proxy_id) { | 115 const std::string& proxy_id) { |
116 std::string json; | 116 std::string json; |
117 base::FilePath file_path = directory.Append(chrome::kServiceStateFileName); | 117 base::FilePath file_path = directory.Append(chrome::kServiceStateFileName); |
118 if (!file_util::ReadFileToString(file_path, &json)) { | 118 if (!base::ReadFileToString(file_path, &json)) { |
119 return std::string(); | 119 return std::string(); |
120 } | 120 } |
121 | 121 |
122 scoped_ptr<base::Value> service_state(base::JSONReader::Read(json)); | 122 scoped_ptr<base::Value> service_state(base::JSONReader::Read(json)); |
123 base::DictionaryValue* dictionary = NULL; | 123 base::DictionaryValue* dictionary = NULL; |
124 if (!service_state->GetAsDictionary(&dictionary) || !dictionary) { | 124 if (!service_state->GetAsDictionary(&dictionary) || !dictionary) { |
125 return std::string(); | 125 return std::string(); |
126 } | 126 } |
127 | 127 |
128 bool enabled = false; | 128 bool enabled = false; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 337 } |
338 } else { | 338 } else { |
339 LOG(ERROR) << "Chrome launch failed."; | 339 LOG(ERROR) << "Chrome launch failed."; |
340 return result; | 340 return result; |
341 } | 341 } |
342 } | 342 } |
343 NOTREACHED(); | 343 NOTREACHED(); |
344 return std::string(); | 344 return std::string(); |
345 } | 345 } |
346 | 346 |
OLD | NEW |