Index: chrome/browser/automation/automation_provider.cc |
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc |
index 7edc7c35f0ca819e1a10f48d41c02f5f769f48b1..e246c381b205c7489be5993e5a8bb485cf1c3c2d 100644 |
--- a/chrome/browser/automation/automation_provider.cc |
+++ b/chrome/browser/automation/automation_provider.cc |
@@ -2345,6 +2345,27 @@ void AutomationProvider::SaveTabContents(Browser* browser, |
Send(reply_message); |
} |
+// Sample json input: { "command": "GetThemeInfo" } |
+// Refer GetThemeInfo() in chrome/test/pyautolib/pyauto.py for sample output. |
+void AutomationProvider::GetThemeInfo(Browser* browser, |
+ DictionaryValue* args, |
+ IPC::Message* reply_message) { |
+ scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
+ Extension* theme = browser->profile()->GetTheme(); |
+ if (theme) { |
+ return_value->SetString(L"name", theme->name()); |
+ return_value->Set(L"images", theme->GetThemeImages()->DeepCopy()); |
+ return_value->Set(L"colors", theme->GetThemeColors()->DeepCopy()); |
+ return_value->Set(L"tints", theme->GetThemeTints()->DeepCopy()); |
+ } |
+ |
+ std::string json_return; |
+ base::JSONWriter::Write(return_value.get(), false, &json_return); |
+ AutomationMsg_SendJSONRequest::WriteReplyParams( |
+ reply_message, json_return, true); |
+ Send(reply_message); |
+} |
+ |
/* static */ |
std::string AutomationProvider::JSONErrorString(const std::string& err) { |
std::string prefix = "{\"error\": \""; |
@@ -2422,6 +2443,9 @@ void AutomationProvider::SendJSONRequest(int handle, |
handler_map["SaveTabContents"] = &AutomationProvider::SaveTabContents; |
+ // SetTheme() implemented using InstallExtension(). |
+ handler_map["GetThemeInfo"] = &AutomationProvider::GetThemeInfo; |
+ |
if (error_string.empty()) { |
if (handler_map.find(std::string(command)) != handler_map.end()) { |
(this->*handler_map[command])(browser, dict_value, reply_message); |