OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/file_path.h" | |
12 #include "base/file_version_info.h" | 13 #include "base/file_version_info.h" |
13 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
14 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
15 #include "base/keyboard_codes.h" | 16 #include "base/keyboard_codes.h" |
16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
18 #include "base/process_util.h" | 19 #include "base/process_util.h" |
19 #include "base/stl_util-inl.h" | 20 #include "base/stl_util-inl.h" |
20 #include "base/string_util.h" | 21 #include "base/string_util.h" |
21 #include "base/thread.h" | 22 #include "base/thread.h" |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1601 if (args->GetInteger(L"width", &width)) | 1602 if (args->GetInteger(L"width", &width)) |
1602 rect.set_width(width); | 1603 rect.set_width(width); |
1603 if (args->GetInteger(L"height", &height)) | 1604 if (args->GetInteger(L"height", &height)) |
1604 rect.set_height(height); | 1605 rect.set_height(height); |
1605 browser->window()->SetBounds(rect); | 1606 browser->window()->SetBounds(rect); |
1606 AutomationMsg_SendJSONRequest::WriteReplyParams( | 1607 AutomationMsg_SendJSONRequest::WriteReplyParams( |
1607 reply_message, std::string("{}"), true); | 1608 reply_message, std::string("{}"), true); |
1608 Send(reply_message); | 1609 Send(reply_message); |
1609 } | 1610 } |
1610 | 1611 |
1612 std::string AutomationProvider::JSONErrorString(std::string err) { | |
Paweł Hajdan Jr.
2010/06/24 06:21:48
Could you move this from being AutomationProvider'
| |
1613 std::string prefix = "{\"error\": \""; | |
1614 std::string no_quote_err = err; | |
1615 std::string suffix = "\"}"; | |
1616 | |
1617 // Don't allow input string to break JSON by embedding quotes. | |
Paweł Hajdan Jr.
2010/06/24 06:21:48
How about using functions from base/json/string_es
| |
1618 // Try and make sure the input string won't break json quoting rules. | |
1619 if (no_quote_err.find("\"") != std::string::npos) | |
1620 no_quote_err = "unhappy about embedded quote in error string"; | |
1621 | |
1622 return prefix + no_quote_err + suffix; | |
1623 } | |
1624 | |
1611 // Sample json input: { "command": "GetBrowserInfo" } | 1625 // Sample json input: { "command": "GetBrowserInfo" } |
1612 // Refer to GetBrowserInfo() in chrome/test/pyautolib/pyauto.py for | 1626 // Refer to GetBrowserInfo() in chrome/test/pyautolib/pyauto.py for |
1613 // sample json output. | 1627 // sample json output. |
1614 void AutomationProvider::GetBrowserInfo(Browser* browser, | 1628 void AutomationProvider::GetBrowserInfo(Browser* browser, |
1615 DictionaryValue* args, | 1629 DictionaryValue* args, |
1616 IPC::Message* reply_message) { | 1630 IPC::Message* reply_message) { |
1617 std::string json_return; | 1631 std::string json_return; |
1618 bool reply_return = true; | 1632 bool reply_return = true; |
1619 | 1633 |
1620 DictionaryValue* properties = new DictionaryValue; | 1634 DictionaryValue* properties = new DictionaryValue; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1789 hs->AddPage(gurl, time, | 1803 hs->AddPage(gurl, time, |
1790 id_scope, | 1804 id_scope, |
1791 0, | 1805 0, |
1792 GURL(), | 1806 GURL(), |
1793 PageTransition::LINK, | 1807 PageTransition::LINK, |
1794 history::RedirectList(), | 1808 history::RedirectList(), |
1795 false); | 1809 false); |
1796 if (title.length()) | 1810 if (title.length()) |
1797 hs->SetPageTitle(gurl, title); | 1811 hs->SetPageTitle(gurl, title); |
1798 } else { | 1812 } else { |
1799 json_return = "{\"error\": \"bad args (no URL in dict?).\"}"; | 1813 json_return = JSONErrorString("bad args (no URL in dict?)"); |
1800 reply_return = false; | 1814 reply_return = false; |
1801 } | 1815 } |
1802 | 1816 |
1803 AutomationMsg_SendJSONRequest::WriteReplyParams( | 1817 AutomationMsg_SendJSONRequest::WriteReplyParams( |
1804 reply_message, json_return, reply_return); | 1818 reply_message, json_return, reply_return); |
1805 Send(reply_message); | 1819 Send(reply_message); |
1806 } | 1820 } |
1807 | 1821 |
1808 // Sample json input: { "command": "GetDownloadsInfo" } | 1822 // Sample json input: { "command": "GetDownloadsInfo" } |
1809 // Refer chrome/test/pyautolib/download_info.py for sample json output. | 1823 // Refer chrome/test/pyautolib/download_info.py for sample json output. |
1810 void AutomationProvider::GetDownloadsInfo(Browser* browser, | 1824 void AutomationProvider::GetDownloadsInfo(Browser* browser, |
1811 DictionaryValue* args, | 1825 DictionaryValue* args, |
1812 IPC::Message* reply_message) { | 1826 IPC::Message* reply_message) { |
1813 std::string json_return; | 1827 std::string json_return; |
1814 bool reply_return = true; | 1828 bool reply_return = true; |
1815 AutomationProviderDownloadManagerObserver observer; | 1829 AutomationProviderDownloadManagerObserver observer; |
1816 std::vector<DownloadItem*> downloads; | 1830 std::vector<DownloadItem*> downloads; |
1817 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1831 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
1818 | 1832 |
1819 if (!profile_->HasCreatedDownloadManager()) { | 1833 if (!profile_->HasCreatedDownloadManager()) { |
1820 json_return = "{\"error\": \"no download manager\"}"; | 1834 json_return = JSONErrorString("no download manager"); |
1821 reply_return = false; | 1835 reply_return = false; |
1822 } else { | 1836 } else { |
1823 // Use DownloadManager's GetDownloads() method and not GetCurrentDownloads() | 1837 // Use DownloadManager's GetDownloads() method and not GetCurrentDownloads() |
1824 // since that would be transient; a download might enter and empty out | 1838 // since that would be transient; a download might enter and empty out |
1825 // the current download queue too soon to be noticed. | 1839 // the current download queue too soon to be noticed. |
1826 profile_->GetDownloadManager()->GetDownloads(&observer, L""); | 1840 profile_->GetDownloadManager()->GetDownloads(&observer, L""); |
1827 downloads = observer.Downloads(); | 1841 downloads = observer.Downloads(); |
1828 } | 1842 } |
1829 | 1843 |
1830 std::map<DownloadItem::DownloadState, std::string> state_to_string; | 1844 std::map<DownloadItem::DownloadState, std::string> state_to_string; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1876 Browser* browser, | 1890 Browser* browser, |
1877 DictionaryValue* args, | 1891 DictionaryValue* args, |
1878 IPC::Message* reply_message) { | 1892 IPC::Message* reply_message) { |
1879 std::string json_return; | 1893 std::string json_return; |
1880 bool reply_return = true; | 1894 bool reply_return = true; |
1881 AutomationProviderDownloadManagerObserver observer; | 1895 AutomationProviderDownloadManagerObserver observer; |
1882 std::vector<DownloadItem*> downloads; | 1896 std::vector<DownloadItem*> downloads; |
1883 | 1897 |
1884 // Look for a quick return. | 1898 // Look for a quick return. |
1885 if (!profile_->HasCreatedDownloadManager()) { | 1899 if (!profile_->HasCreatedDownloadManager()) { |
1886 json_return = "{\"error\": \"no download manager\"}"; | 1900 json_return = JSONErrorString("no download manager"); |
1887 reply_return = false; | 1901 reply_return = false; |
1888 } else { | 1902 } else { |
1889 profile_->GetDownloadManager()->GetCurrentDownloads(&observer, | 1903 profile_->GetDownloadManager()->GetCurrentDownloads(&observer, |
1890 FilePath()); | 1904 FilePath()); |
1891 downloads = observer.Downloads(); | 1905 downloads = observer.Downloads(); |
1892 if (downloads.size() == 0) { | 1906 if (downloads.size() == 0) { |
1893 json_return = "{}"; | 1907 json_return = "{}"; |
1894 } | 1908 } |
1895 } | 1909 } |
1896 if (!json_return.empty()) { | 1910 if (!json_return.empty()) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1941 IPC::Message* reply_message) { | 1955 IPC::Message* reply_message) { |
1942 bool reply_return = true; | 1956 bool reply_return = true; |
1943 std::string json_return = "{}"; | 1957 std::string json_return = "{}"; |
1944 std::wstring path; | 1958 std::wstring path; |
1945 Value* val; | 1959 Value* val; |
1946 if (args->GetString(L"path", &path) && args->Get(L"value", &val)) { | 1960 if (args->GetString(L"path", &path) && args->Get(L"value", &val)) { |
1947 PrefService* pref_service = profile_->GetPrefs(); | 1961 PrefService* pref_service = profile_->GetPrefs(); |
1948 const PrefService::Preference* pref = | 1962 const PrefService::Preference* pref = |
1949 pref_service->FindPreference(path.c_str()); | 1963 pref_service->FindPreference(path.c_str()); |
1950 if (!pref) { // Not a registered pref. | 1964 if (!pref) { // Not a registered pref. |
1951 json_return = "{\"error\": \"pref not registered.\"}"; | 1965 json_return = JSONErrorString("pref not registered."); |
1952 reply_return = false; | 1966 reply_return = false; |
1953 } else if (pref->IsManaged()) { // Do not attempt to change a managed pref. | 1967 } else if (pref->IsManaged()) { // Do not attempt to change a managed pref. |
1954 json_return = "{\"error\": \"pref is managed. cannot be changed.\"}"; | 1968 json_return = JSONErrorString("pref is managed. cannot be changed."); |
1955 reply_return = false; | 1969 reply_return = false; |
1956 } else { // Set the pref. | 1970 } else { // Set the pref. |
1957 pref_service->Set(path.c_str(), *val); | 1971 pref_service->Set(path.c_str(), *val); |
1958 } | 1972 } |
1959 } else { | 1973 } else { |
1960 json_return = "{\"error\": \"no pref path or value given.\"}"; | 1974 json_return = JSONErrorString("no pref path or value given."); |
1961 reply_return = false; | 1975 reply_return = false; |
1962 } | 1976 } |
1963 | 1977 |
1964 AutomationMsg_SendJSONRequest::WriteReplyParams( | 1978 AutomationMsg_SendJSONRequest::WriteReplyParams( |
1965 reply_message, json_return, reply_return); | 1979 reply_message, json_return, reply_return); |
1966 Send(reply_message); | 1980 Send(reply_message); |
1967 } | 1981 } |
1968 | 1982 |
1969 // Sample json input: { "command": "GetOmniboxInfo" } | 1983 // Sample json input: { "command": "GetOmniboxInfo" } |
1970 // Refer chrome/test/pyautolib/omnibox_info.py for sample json output. | 1984 // Refer chrome/test/pyautolib/omnibox_info.py for sample json output. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2012 // Sample json input: { "command": "SetOmniboxText", | 2026 // Sample json input: { "command": "SetOmniboxText", |
2013 // "text": "goog" } | 2027 // "text": "goog" } |
2014 void AutomationProvider::SetOmniboxText(Browser* browser, | 2028 void AutomationProvider::SetOmniboxText(Browser* browser, |
2015 DictionaryValue* args, | 2029 DictionaryValue* args, |
2016 IPC::Message* reply_message) { | 2030 IPC::Message* reply_message) { |
2017 std::string json_return = "{}"; | 2031 std::string json_return = "{}"; |
2018 bool reply_return = true; | 2032 bool reply_return = true; |
2019 std::wstring text; | 2033 std::wstring text; |
2020 | 2034 |
2021 if (!args->GetString(L"text", &text)) { | 2035 if (!args->GetString(L"text", &text)) { |
2022 json_return = "{\"error\": \"text missing\"}"; | 2036 json_return = JSONErrorString("text missing"); |
2023 reply_return = false; | 2037 reply_return = false; |
2024 } else { | 2038 } else { |
2025 browser->FocusLocationBar(); | 2039 browser->FocusLocationBar(); |
2026 LocationBar* loc_bar = browser->window()->GetLocationBar(); | 2040 LocationBar* loc_bar = browser->window()->GetLocationBar(); |
2027 AutocompleteEditView* edit_view = loc_bar->location_entry(); | 2041 AutocompleteEditView* edit_view = loc_bar->location_entry(); |
2028 edit_view->model()->OnSetFocus(false); | 2042 edit_view->model()->OnSetFocus(false); |
2029 edit_view->SetUserText(text); | 2043 edit_view->SetUserText(text); |
2030 } | 2044 } |
2031 | 2045 |
2032 AutomationMsg_SendJSONRequest::WriteReplyParams( | 2046 AutomationMsg_SendJSONRequest::WriteReplyParams( |
2033 reply_message, json_return, reply_return); | 2047 reply_message, json_return, reply_return); |
2034 Send(reply_message); | 2048 Send(reply_message); |
2035 } | 2049 } |
2036 | 2050 |
2037 // Sample json input: { "command": "OmniboxMovePopupSelection", | 2051 // Sample json input: { "command": "OmniboxMovePopupSelection", |
2038 // "count": 1 } | 2052 // "count": 1 } |
2039 // Negative count implies up, positive implies down. Count values will be | 2053 // Negative count implies up, positive implies down. Count values will be |
2040 // capped by the size of the popup list. | 2054 // capped by the size of the popup list. |
2041 void AutomationProvider::OmniboxMovePopupSelection( | 2055 void AutomationProvider::OmniboxMovePopupSelection( |
2042 Browser* browser, | 2056 Browser* browser, |
2043 DictionaryValue* args, | 2057 DictionaryValue* args, |
2044 IPC::Message* reply_message) { | 2058 IPC::Message* reply_message) { |
2045 std::string json_return = "{}"; | 2059 std::string json_return = "{}"; |
2046 bool reply_return = true; | 2060 bool reply_return = true; |
2047 int count; | 2061 int count; |
2048 | 2062 |
2049 if (!args->GetInteger(L"count", &count)) { | 2063 if (!args->GetInteger(L"count", &count)) { |
2050 json_return = "{\"error\": \"count missing\"}"; | 2064 json_return = JSONErrorString("count missing"); |
2051 reply_return = false; | 2065 reply_return = false; |
2052 } else { | 2066 } else { |
2053 LocationBar* loc_bar = browser->window()->GetLocationBar(); | 2067 LocationBar* loc_bar = browser->window()->GetLocationBar(); |
2054 AutocompleteEditModel* model = loc_bar->location_entry()->model(); | 2068 AutocompleteEditModel* model = loc_bar->location_entry()->model(); |
2055 model->OnUpOrDownKeyPressed(count); | 2069 model->OnUpOrDownKeyPressed(count); |
2056 } | 2070 } |
2057 | 2071 |
2058 AutomationMsg_SendJSONRequest::WriteReplyParams( | 2072 AutomationMsg_SendJSONRequest::WriteReplyParams( |
2059 reply_message, json_return, reply_return); | 2073 reply_message, json_return, reply_return); |
2060 Send(reply_message); | 2074 Send(reply_message); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2146 // Sample json input: | 2160 // Sample json input: |
2147 // { "command": "EnablePlugin", | 2161 // { "command": "EnablePlugin", |
2148 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } | 2162 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } |
2149 void AutomationProvider::EnablePlugin(Browser* browser, | 2163 void AutomationProvider::EnablePlugin(Browser* browser, |
2150 DictionaryValue* args, | 2164 DictionaryValue* args, |
2151 IPC::Message* reply_message) { | 2165 IPC::Message* reply_message) { |
2152 std::string json_return = "{}"; | 2166 std::string json_return = "{}"; |
2153 bool reply_return = true; | 2167 bool reply_return = true; |
2154 FilePath::StringType path; | 2168 FilePath::StringType path; |
2155 if (!args->GetString(L"path", &path)) { | 2169 if (!args->GetString(L"path", &path)) { |
2156 json_return = "{\"error\": \"path not specified.\"}"; | 2170 json_return = JSONErrorString("path not specified."); |
2157 reply_return = false; | 2171 reply_return = false; |
2158 } else if (!NPAPI::PluginList::Singleton()->EnablePlugin(FilePath(path))) { | 2172 } else if (!NPAPI::PluginList::Singleton()->EnablePlugin(FilePath(path))) { |
2159 json_return = StringPrintf("{\"error\": \"Could not enable plugin" | 2173 json_return = StringPrintf("{\"error\": \"Could not enable plugin" |
2160 " for path %s.\"}", path.c_str()); | 2174 " for path %s.\"}", path.c_str()); |
2161 reply_return = false; | 2175 reply_return = false; |
2162 } | 2176 } |
2163 | 2177 |
2164 AutomationMsg_SendJSONRequest::WriteReplyParams( | 2178 AutomationMsg_SendJSONRequest::WriteReplyParams( |
2165 reply_message, json_return, reply_return); | 2179 reply_message, json_return, reply_return); |
2166 Send(reply_message); | 2180 Send(reply_message); |
2167 } | 2181 } |
2168 | 2182 |
2169 // Sample json input: | 2183 // Sample json input: |
2170 // { "command": "DisablePlugin", | 2184 // { "command": "DisablePlugin", |
2171 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } | 2185 // "path": "/Library/Internet Plug-Ins/Flash Player.plugin" } |
2172 void AutomationProvider::DisablePlugin(Browser* browser, | 2186 void AutomationProvider::DisablePlugin(Browser* browser, |
2173 DictionaryValue* args, | 2187 DictionaryValue* args, |
2174 IPC::Message* reply_message) { | 2188 IPC::Message* reply_message) { |
2175 std::string json_return = "{}"; | 2189 std::string json_return = "{}"; |
2176 bool reply_return = true; | 2190 bool reply_return = true; |
2177 FilePath::StringType path; | 2191 FilePath::StringType path; |
2178 if (!args->GetString(L"path", &path)) { | 2192 if (!args->GetString(L"path", &path)) { |
2179 json_return = "{\"error\": \"path not specified.\"}"; | 2193 json_return = JSONErrorString("path not specified."); |
2180 reply_return = false; | 2194 reply_return = false; |
2181 } else if (!NPAPI::PluginList::Singleton()->DisablePlugin(FilePath(path))) { | 2195 } else if (!NPAPI::PluginList::Singleton()->DisablePlugin(FilePath(path))) { |
2182 json_return = StringPrintf("{\"error\": \"Could not enable plugin" | 2196 json_return = StringPrintf("{\"error\": \"Could not enable plugin" |
2183 " for path %s.\"}", path.c_str()); | 2197 " for path %s.\"}", path.c_str()); |
2184 reply_return = false; | 2198 reply_return = false; |
2185 } | 2199 } |
2186 | 2200 |
2187 AutomationMsg_SendJSONRequest::WriteReplyParams( | 2201 AutomationMsg_SendJSONRequest::WriteReplyParams( |
2188 reply_message, json_return, reply_return); | 2202 reply_message, json_return, reply_return); |
2189 Send(reply_message); | 2203 Send(reply_message); |
2190 } | 2204 } |
2191 | 2205 |
2206 // Sample json input: | |
2207 // { "command": "SaveTabContents", | |
2208 // "tab_index": 0, | |
2209 // "filename": <a full pathname> } | |
2210 // Sample json output: | |
2211 // {} | |
2212 void AutomationProvider::SaveTabContents(Browser* browser, | |
2213 DictionaryValue* args, | |
2214 IPC::Message* reply_message) { | |
2215 std::string json_return; | |
2216 int tab_index = 0; | |
2217 FilePath::StringType filename; | |
2218 FilePath::StringType parent_directory; | |
2219 TabContents* tab_contents = NULL; | |
2220 | |
2221 if (!args->GetInteger(L"tab_index", &tab_index) || | |
2222 !args->GetString(L"filename", &filename)) { | |
2223 json_return = JSONErrorString("tab_index or filename param missing"); | |
2224 } else { | |
2225 tab_contents = browser->GetTabContentsAt(tab_index); | |
2226 if (!tab_contents) { | |
2227 json_return = JSONErrorString("no tab at tab_index"); | |
2228 } | |
2229 } | |
2230 if (tab_contents) { | |
2231 // We're doing a SAVE_AS_ONLY_HTML so the the directory path isn't | |
2232 // used. Nevertheless, SavePackage requires it be valid. Sigh. | |
2233 parent_directory = FilePath(filename).DirName().value(); | |
2234 if (!tab_contents->SavePage(FilePath(filename), FilePath(parent_directory), | |
2235 SavePackage::SAVE_AS_ONLY_HTML)) { | |
2236 json_return = JSONErrorString("Could not initiate SavePage"); | |
2237 } else { | |
2238 // The observer will delete itself when done. | |
2239 new SavePackageNotificationObserver(tab_contents->save_package(), | |
2240 this, reply_message); | |
2241 return; | |
2242 } | |
2243 } | |
2244 | |
2245 // if we get here, error. | |
Paweł Hajdan Jr.
2010/06/24 06:21:48
nit: "if" -> "If".
| |
2246 DCHECK(!json_return.empty()); | |
2247 AutomationMsg_SendJSONRequest::WriteReplyParams( | |
2248 reply_message, json_return, false); | |
2249 Send(reply_message); | |
2250 } | |
2251 | |
2192 void AutomationProvider::SendJSONRequest(int handle, | 2252 void AutomationProvider::SendJSONRequest(int handle, |
2193 std::string json_request, | 2253 std::string json_request, |
2194 IPC::Message* reply_message) { | 2254 IPC::Message* reply_message) { |
2195 Browser* browser = NULL; | 2255 Browser* browser = NULL; |
2196 std::string error_string; | 2256 std::string error_string; |
2197 scoped_ptr<Value> values; | 2257 scoped_ptr<Value> values; |
2198 | 2258 |
2199 // Basic error checking. | 2259 // Basic error checking. |
2200 if (browser_tracker_->ContainsHandle(handle)) { | 2260 if (browser_tracker_->ContainsHandle(handle)) { |
2201 browser = browser_tracker_->GetResource(handle); | 2261 browser = browser_tracker_->GetResource(handle); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2247 handler_map["SetPrefs"] = &AutomationProvider::SetPrefs; | 2307 handler_map["SetPrefs"] = &AutomationProvider::SetPrefs; |
2248 | 2308 |
2249 handler_map["SetWindowDimensions"] = &AutomationProvider::SetWindowDimensions; | 2309 handler_map["SetWindowDimensions"] = &AutomationProvider::SetWindowDimensions; |
2250 | 2310 |
2251 handler_map["GetDownloadsInfo"] = &AutomationProvider::GetDownloadsInfo; | 2311 handler_map["GetDownloadsInfo"] = &AutomationProvider::GetDownloadsInfo; |
2252 handler_map["WaitForAllDownloadsToComplete"] = | 2312 handler_map["WaitForAllDownloadsToComplete"] = |
2253 &AutomationProvider::WaitForDownloadsToComplete; | 2313 &AutomationProvider::WaitForDownloadsToComplete; |
2254 | 2314 |
2255 handler_map["GetInitialLoadTimes"] = &AutomationProvider::GetInitialLoadTimes; | 2315 handler_map["GetInitialLoadTimes"] = &AutomationProvider::GetInitialLoadTimes; |
2256 | 2316 |
2317 handler_map["SaveTabContents"] = &AutomationProvider::SaveTabContents; | |
2318 | |
2257 if (error_string.empty()) { | 2319 if (error_string.empty()) { |
2258 if (handler_map.find(std::string(command)) != handler_map.end()) { | 2320 if (handler_map.find(std::string(command)) != handler_map.end()) { |
2259 (this->*handler_map[command])(browser, dict_value, reply_message); | 2321 (this->*handler_map[command])(browser, dict_value, reply_message); |
2260 return; | 2322 return; |
2261 } else { | 2323 } else { |
2262 error_string = "Unknown command. Options: "; | 2324 error_string = "Unknown command. Options: "; |
2263 for (std::map<std::string, JsonHandler>::const_iterator it = | 2325 for (std::map<std::string, JsonHandler>::const_iterator it = |
2264 handler_map.begin(); it != handler_map.end(); ++it) { | 2326 handler_map.begin(); it != handler_map.end(); ++it) { |
2265 error_string += it->first + ", "; | 2327 error_string += it->first + ", "; |
2266 } | 2328 } |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3442 } | 3504 } |
3443 | 3505 |
3444 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 3506 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { |
3445 NOTIMPLEMENTED(); | 3507 NOTIMPLEMENTED(); |
3446 } | 3508 } |
3447 #endif // !defined(TOOLKIT_VIEWS) | 3509 #endif // !defined(TOOLKIT_VIEWS) |
3448 | 3510 |
3449 void AutomationProvider::ResetToDefaultTheme() { | 3511 void AutomationProvider::ResetToDefaultTheme() { |
3450 profile_->ClearTheme(); | 3512 profile_->ClearTheme(); |
3451 } | 3513 } |
OLD | NEW |