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

Unified Diff: chrome/browser/automation/automation_provider.cc

Issue 2827048: PyAuto: Automation hooks to get/set theme (Closed)
Patch Set: use existing ResetToDefaultTheme Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698