Index: chrome/browser/automation/testing_automation_provider.cc |
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc |
index b7a2f89bd8492426c611a50026996143b79f1b9e..0f95d826731d0cc588d7b941469ef1111f1898df 100644 |
--- a/chrome/browser/automation/testing_automation_provider.cc |
+++ b/chrome/browser/automation/testing_automation_provider.cc |
@@ -98,7 +98,6 @@ |
#include "chrome/browser/ui/omnibox/omnibox_view.h" |
#include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
-#include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
#include "chrome/common/automation_messages.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_notification_types.h" |
@@ -2540,15 +2539,6 @@ void TestingAutomationProvider::SendJSONRequest(int handle, |
browser_handler_map["KillRendererProcess"] = |
&TestingAutomationProvider::KillRendererProcess; |
- browser_handler_map["GetNTPThumbnailMode"] = |
- &TestingAutomationProvider::GetNTPThumbnailMode; |
- browser_handler_map["SetNTPThumbnailMode"] = |
- &TestingAutomationProvider::SetNTPThumbnailMode; |
- browser_handler_map["GetNTPMenuMode"] = |
- &TestingAutomationProvider::GetNTPMenuMode; |
- browser_handler_map["SetNTPMenuMode"] = |
- &TestingAutomationProvider::SetNTPMenuMode; |
- |
browser_handler_map["LaunchApp"] = &TestingAutomationProvider::LaunchApp; |
browser_handler_map["SetAppLaunchType"] = |
&TestingAutomationProvider::SetAppLaunchType; |
@@ -5604,137 +5594,6 @@ void TestingAutomationProvider::AcceptOrDismissAppModalDialog( |
reply.SendSuccess(NULL); |
} |
-// Sample JSON input: { "command": "GetNTPThumbnailMode" } |
-// For output, refer to GetNTPThumbnailMode() in |
-// chrome/test/pyautolib/pyauto.py. |
-void TestingAutomationProvider::GetNTPThumbnailMode( |
- Browser* browser, |
- DictionaryValue* args, |
- IPC::Message* reply_message) { |
- const int shown_sections = ShownSectionsHandler::GetShownSections( |
- browser->profile()->GetPrefs()); |
- |
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
- return_value->SetBoolean("apps", shown_sections & APPS ? true : false); |
- return_value->SetBoolean("most_visited", |
- shown_sections & THUMB ? true : false); |
- |
- AutomationJSONReply reply(this, reply_message); |
- reply.SendSuccess(return_value.get()); |
-} |
- |
-// Sample JSON input: { "command": "SetNTPThumbnailMode", "section": "apps", |
-// "turn_on": true } |
-// Refer to SetNTPThumbnailMode() in chrome/test/pyautolib/pyauto.py for |
-// all possible input values. |
-// Sample JSON output: {} |
-void TestingAutomationProvider::SetNTPThumbnailMode( |
- Browser* browser, |
- DictionaryValue* args, |
- IPC::Message* reply_message) { |
- AutomationJSONReply reply(this, reply_message); |
- std::string section_name; |
- bool turn_on; |
- if (!args->GetString("section", §ion_name) || |
- !args->GetBoolean("turn_on", &turn_on)) { |
- reply.SendError("Invalid or missing args"); |
- return; |
- } |
- |
- PrefService* prefs = browser->profile()->GetPrefs(); |
- Section section; |
- if (section_name.compare("apps") == 0) { |
- section = APPS; |
- } else if (section_name.compare("most_visited") == 0) { |
- section = THUMB; |
- } else if (section_name.compare("recently_closed") == 0) { |
- reply.SendError("Thumbnail mode does not apply to the recently closed " |
- "section."); |
- return; |
- } else { |
- reply.SendError(StringPrintf("Unexpected section name: '%s'", |
- section_name.c_str())); |
- return; |
- } |
- |
- if (turn_on) { |
- ShownSectionsHandler::SetShownSection(prefs, section); |
- } else { |
- int shown_sections = ShownSectionsHandler::GetShownSections(prefs); |
- // Change the bit for the relevant section in the bitmask to 0. |
- shown_sections &= ~(0xFFFFFFFF & section); |
- prefs->SetInteger(prefs::kNTPShownSections, shown_sections); |
- } |
- |
- reply.SendSuccess(NULL); |
-} |
- |
-// Sample JSON input: { "command": "GetNTPMenuMode" } |
-// For output, refer to GetNTPMenuMode() in |
-// chrome/test/pyautolib/pyauto.py. |
-void TestingAutomationProvider::GetNTPMenuMode( |
- Browser* browser, |
- DictionaryValue* args, |
- IPC::Message* reply_message) { |
- const int shown_sections = ShownSectionsHandler::GetShownSections( |
- browser->profile()->GetPrefs()); |
- |
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
- return_value->SetBoolean("apps", shown_sections & MENU_APPS ? true : false); |
- return_value->SetBoolean("most_visited", |
- shown_sections & MENU_THUMB ? true : false); |
- return_value->SetBoolean("recently_closed", |
- shown_sections & MENU_RECENT ? true : false); |
- |
- AutomationJSONReply reply(this, reply_message); |
- reply.SendSuccess(return_value.get()); |
-} |
- |
-// Sample JSON input: { "command": "SetNTPMenuMode", "section": "apps", |
-// "turn_on": false } |
-// Refer to SetNTPMenuMode() in chrome/test/pyautolib/pyauto.py for all possible |
-// input values. |
-// Sample JSON output: {} |
-void TestingAutomationProvider::SetNTPMenuMode( |
- Browser* browser, |
- DictionaryValue* args, |
- IPC::Message* reply_message) { |
- AutomationJSONReply reply(this, reply_message); |
- std::string section_name; |
- bool turn_on; |
- if (!args->GetString("section", §ion_name) || |
- !args->GetBoolean("turn_on", &turn_on)) { |
- reply.SendError("Invalid or missing args"); |
- return; |
- } |
- |
- PrefService* prefs = browser->profile()->GetPrefs(); |
- Section section; |
- if (section_name.compare("apps") == 0) { |
- section = MENU_APPS; |
- } else if (section_name.compare("most_visited") == 0) { |
- section = MENU_THUMB; |
- } else if (section_name.compare("recently_closed") == 0) { |
- section = MENU_RECENT; |
- } else { |
- reply.SendError(StringPrintf("Unexpected section name: '%s'", |
- section_name.c_str())); |
- return; |
- } |
- |
- int shown_sections = ShownSectionsHandler::GetShownSections(prefs); |
- if (turn_on) { |
- // Change the bit for the relevant section in the bitmask to 1. |
- shown_sections |= section; |
- } else { |
- // Change the bit for the relevant section in the bitmask to 0. |
- shown_sections &= ~(0xFFFFFFFF & section); |
- } |
- prefs->SetInteger(prefs::kNTPShownSections, shown_sections); |
- |
- reply.SendSuccess(NULL); |
-} |
- |
// Sample JSON input: { "command": "LaunchApp", |
// "id": "ahfgeienlihckogmohjhadlkjgocpleb" } |
// Sample JSON output: {} |