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

Side by Side Diff: chrome/browser/automation/automation_provider_json.cc

Issue 9288051: Implement the webdriver window sizing commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/automation/automation_provider_json.h" 5 #include "chrome/browser/automation/automation_provider_json.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/json/string_escape.h" 8 #include "base/json/string_escape.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/autocomplete/autocomplete_match.h" 10 #include "chrome/browser/autocomplete/autocomplete_match.h"
(...skipping 24 matching lines...) Expand all
35 std::string json_string = "{}"; 35 std::string json_string = "{}";
36 if (value) 36 if (value)
37 base::JSONWriter::Write(value, false, &json_string); 37 base::JSONWriter::Write(value, false, &json_string);
38 AutomationMsg_SendJSONRequest::WriteReplyParams( 38 AutomationMsg_SendJSONRequest::WriteReplyParams(
39 message_, json_string, true); 39 message_, json_string, true);
40 provider_->Send(message_); 40 provider_->Send(message_);
41 message_ = NULL; 41 message_ = NULL;
42 } 42 }
43 43
44 void AutomationJSONReply::SendError(const std::string& error_message) { 44 void AutomationJSONReply::SendError(const std::string& error_message) {
45 SendErrorInternal(Error(error_message)); 45 SendError(Error(error_message));
46 } 46 }
47 47
48 void AutomationJSONReply::SendErrorCode(ErrorCode code) { 48 void AutomationJSONReply::SendErrorCode(ErrorCode code) {
49 SendErrorInternal(Error(code)); 49 SendError(Error(code));
50 } 50 }
51 51
52 void AutomationJSONReply::SendErrorInternal(const Error& error) { 52 void AutomationJSONReply::SendError(const Error& error) {
53 DCHECK(message_) << "Resending reply for JSON automation request"; 53 DCHECK(message_) << "Resending reply for JSON automation request";
54 54
55 base::DictionaryValue dict; 55 base::DictionaryValue dict;
56 dict.SetString("error", error.message()); 56 dict.SetString("error", error.message());
57 dict.SetInteger("code", error.code()); 57 dict.SetInteger("code", error.code());
58 std::string json; 58 std::string json;
59 base::JSONWriter::Write(&dict, false /* pretty_print */, &json); 59 base::JSONWriter::Write(&dict, false /* pretty_print */, &json);
60 60
61 AutomationMsg_SendJSONRequest::WriteReplyParams(message_, json, false); 61 AutomationMsg_SendJSONRequest::WriteReplyParams(message_, json, false);
62 provider_->Send(message_); 62 provider_->Send(message_);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 bool GetEnabledExtensionFromJSONArgs( 225 bool GetEnabledExtensionFromJSONArgs(
226 base::DictionaryValue* args, 226 base::DictionaryValue* args,
227 const std::string& key, 227 const std::string& key,
228 Profile* profile, 228 Profile* profile,
229 const Extension** extension, 229 const Extension** extension,
230 std::string* error) { 230 std::string* error) {
231 return GetExtensionFromJSONArgsHelper( 231 return GetExtensionFromJSONArgsHelper(
232 args, key, profile, false /* include_disabled */, extension, error); 232 args, key, profile, false /* include_disabled */, extension, error);
233 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698