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

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

Issue 2559001: Measure loading time of several tabs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Revert michaeln's revert due to mac linker error Created 10 years, 6 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
OLDNEW
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"
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 NavigationController& controller = 2070 NavigationController& controller =
2071 browser->GetSelectedTabContents()->controller(); 2071 browser->GetSelectedTabContents()->controller();
2072 // Setup observer to wait until the selected item loads. 2072 // Setup observer to wait until the selected item loads.
2073 NotificationObserver* observer = 2073 NotificationObserver* observer =
2074 new OmniboxAcceptNotificationObserver(&controller, this, reply_message); 2074 new OmniboxAcceptNotificationObserver(&controller, this, reply_message);
2075 notification_observer_list_.AddObserver(observer); 2075 notification_observer_list_.AddObserver(observer);
2076 2076
2077 browser->window()->GetLocationBar()->AcceptInput(); 2077 browser->window()->GetLocationBar()->AcceptInput();
2078 } 2078 }
2079 2079
2080 // Sample json input: { "command": "GetInitialLoadTimes" }
2081 // Refer to InitialLoadObserver::GetTimingInformation() for sample output.
2082 void AutomationProvider::GetInitialLoadTimes(
2083 Browser*,
2084 DictionaryValue*,
2085 IPC::Message* reply_message) {
2086 scoped_ptr<DictionaryValue> return_value(
2087 initial_load_observer_->GetTimingInformation());
2088
2089 std::string json_return;
2090 base::JSONWriter::Write(return_value.get(), false, &json_return);
2091 AutomationMsg_SendJSONRequest::WriteReplyParams(
2092 reply_message, json_return, true);
2093 Send(reply_message);
2094 }
2095
2080 // Sample json input: { "command": "GetPluginsInfo" } 2096 // Sample json input: { "command": "GetPluginsInfo" }
2081 // Refer chrome/test/pyautolib/plugins_info.py for sample json output. 2097 // Refer chrome/test/pyautolib/plugins_info.py for sample json output.
2082 void AutomationProvider::GetPluginsInfo(Browser* browser, 2098 void AutomationProvider::GetPluginsInfo(Browser* browser,
2083 DictionaryValue* args, 2099 DictionaryValue* args,
2084 IPC::Message* reply_message) { 2100 IPC::Message* reply_message) {
2085 std::string json_return; 2101 std::string json_return;
2086 bool reply_return = true; 2102 bool reply_return = true;
2087 2103
2088 std::vector<WebPluginInfo> plugins; 2104 std::vector<WebPluginInfo> plugins;
2089 NPAPI::PluginList::Singleton()->GetPlugins(false, &plugins); 2105 NPAPI::PluginList::Singleton()->GetPlugins(false, &plugins);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 2248
2233 handler_map["GetPrefsInfo"] = &AutomationProvider::GetPrefsInfo; 2249 handler_map["GetPrefsInfo"] = &AutomationProvider::GetPrefsInfo;
2234 handler_map["SetPrefs"] = &AutomationProvider::SetPrefs; 2250 handler_map["SetPrefs"] = &AutomationProvider::SetPrefs;
2235 2251
2236 handler_map["SetWindowDimensions"] = &AutomationProvider::SetWindowDimensions; 2252 handler_map["SetWindowDimensions"] = &AutomationProvider::SetWindowDimensions;
2237 2253
2238 handler_map["GetDownloadsInfo"] = &AutomationProvider::GetDownloadsInfo; 2254 handler_map["GetDownloadsInfo"] = &AutomationProvider::GetDownloadsInfo;
2239 handler_map["WaitForAllDownloadsToComplete"] = 2255 handler_map["WaitForAllDownloadsToComplete"] =
2240 &AutomationProvider::WaitForDownloadsToComplete; 2256 &AutomationProvider::WaitForDownloadsToComplete;
2241 2257
2258 handler_map["GetInitialLoadTimes"] = &AutomationProvider::GetInitialLoadTimes;
2259
2242 if (error_string.empty()) { 2260 if (error_string.empty()) {
2243 if (handler_map.find(std::string(command)) != handler_map.end()) { 2261 if (handler_map.find(std::string(command)) != handler_map.end()) {
2244 (this->*handler_map[command])(browser, dict_value, reply_message); 2262 (this->*handler_map[command])(browser, dict_value, reply_message);
2245 return; 2263 return;
2246 } else { 2264 } else {
2247 error_string = "Unknown command. Options: "; 2265 error_string = "Unknown command. Options: ";
2248 for (std::map<std::string, JsonHandler>::const_iterator it = 2266 for (std::map<std::string, JsonHandler>::const_iterator it =
2249 handler_map.begin(); it != handler_map.end(); ++it) { 2267 handler_map.begin(); it != handler_map.end(); ++it) {
2250 error_string += it->first + ", "; 2268 error_string += it->first + ", ";
2251 } 2269 }
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 } 3445 }
3428 3446
3429 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { 3447 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) {
3430 NOTIMPLEMENTED(); 3448 NOTIMPLEMENTED();
3431 } 3449 }
3432 #endif // !defined(TOOLKIT_VIEWS) 3450 #endif // !defined(TOOLKIT_VIEWS)
3433 3451
3434 void AutomationProvider::ResetToDefaultTheme() { 3452 void AutomationProvider::ResetToDefaultTheme() {
3435 profile_->ClearTheme(); 3453 profile_->ClearTheme();
3436 } 3454 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/browser/automation/automation_provider_observers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698