| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 | 124 |
| 125 DictionaryValue* InitialLoadObserver::GetTimingInformation() const { | 125 DictionaryValue* InitialLoadObserver::GetTimingInformation() const { |
| 126 ListValue* items = new ListValue; | 126 ListValue* items = new ListValue; |
| 127 for (TabTimeMap::const_iterator it = loading_tabs_.begin(); | 127 for (TabTimeMap::const_iterator it = loading_tabs_.begin(); |
| 128 it != loading_tabs_.end(); | 128 it != loading_tabs_.end(); |
| 129 ++it) { | 129 ++it) { |
| 130 DictionaryValue* item = new DictionaryValue; | 130 DictionaryValue* item = new DictionaryValue; |
| 131 base::TimeDelta delta_start = it->second.start_time() - init_time_; | 131 base::TimeDelta delta_start = it->second.start_time() - init_time_; |
| 132 | 132 |
| 133 item->SetReal("load_start_ms", delta_start.InMillisecondsF()); | 133 item->SetDouble("load_start_ms", delta_start.InMillisecondsF()); |
| 134 if (it->second.stop_time().is_null()) { | 134 if (it->second.stop_time().is_null()) { |
| 135 item->Set("load_stop_ms", Value::CreateNullValue()); | 135 item->Set("load_stop_ms", Value::CreateNullValue()); |
| 136 } else { | 136 } else { |
| 137 base::TimeDelta delta_stop = it->second.stop_time() - init_time_; | 137 base::TimeDelta delta_stop = it->second.stop_time() - init_time_; |
| 138 item->SetReal("load_stop_ms", delta_stop.InMillisecondsF()); | 138 item->SetDouble("load_stop_ms", delta_stop.InMillisecondsF()); |
| 139 } | 139 } |
| 140 items->Append(item); | 140 items->Append(item); |
| 141 } | 141 } |
| 142 DictionaryValue* return_value = new DictionaryValue; | 142 DictionaryValue* return_value = new DictionaryValue; |
| 143 return_value->Set("tabs", items); | 143 return_value->Set("tabs", items); |
| 144 return return_value; | 144 return return_value; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void InitialLoadObserver::ConditionMet() { | 147 void InitialLoadObserver::ConditionMet() { |
| 148 registrar_.RemoveAll(); | 148 registrar_.RemoveAll(); |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 HistoryService::Handle request_handle, | 1243 HistoryService::Handle request_handle, |
| 1244 history::QueryResults* results) { | 1244 history::QueryResults* results) { |
| 1245 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1245 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| 1246 | 1246 |
| 1247 ListValue* history_list = new ListValue; | 1247 ListValue* history_list = new ListValue; |
| 1248 for (size_t i = 0; i < results->size(); ++i) { | 1248 for (size_t i = 0; i < results->size(); ++i) { |
| 1249 DictionaryValue* page_value = new DictionaryValue; | 1249 DictionaryValue* page_value = new DictionaryValue; |
| 1250 history::URLResult const &page = (*results)[i]; | 1250 history::URLResult const &page = (*results)[i]; |
| 1251 page_value->SetString("title", page.title()); | 1251 page_value->SetString("title", page.title()); |
| 1252 page_value->SetString("url", page.url().spec()); | 1252 page_value->SetString("url", page.url().spec()); |
| 1253 page_value->SetReal("time", | 1253 page_value->SetDouble("time", |
| 1254 static_cast<double>(page.visit_time().ToDoubleT())); | 1254 static_cast<double>(page.visit_time().ToDoubleT())); |
| 1255 page_value->SetString("snippet", page.snippet().text()); | 1255 page_value->SetString("snippet", page.snippet().text()); |
| 1256 page_value->SetBoolean( | 1256 page_value->SetBoolean( |
| 1257 "starred", | 1257 "starred", |
| 1258 provider_->profile()->GetBookmarkModel()->IsBookmarked(page.url())); | 1258 provider_->profile()->GetBookmarkModel()->IsBookmarked(page.url())); |
| 1259 history_list->Append(page_value); | 1259 history_list->Append(page_value); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 return_value->Set("history", history_list); | 1262 return_value->Set("history", history_list); |
| 1263 // Return history info. | 1263 // Return history info. |
| 1264 AutomationJSONReply reply(provider_, reply_message_); | 1264 AutomationJSONReply reply(provider_, reply_message_); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1277 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1277 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| 1278 | 1278 |
| 1279 ListValue* passwords = new ListValue; | 1279 ListValue* passwords = new ListValue; |
| 1280 for (std::vector<webkit_glue::PasswordForm*>::const_iterator it = | 1280 for (std::vector<webkit_glue::PasswordForm*>::const_iterator it = |
| 1281 result.begin(); it != result.end(); ++it) { | 1281 result.begin(); it != result.end(); ++it) { |
| 1282 DictionaryValue* password_val = new DictionaryValue; | 1282 DictionaryValue* password_val = new DictionaryValue; |
| 1283 webkit_glue::PasswordForm* password_form = *it; | 1283 webkit_glue::PasswordForm* password_form = *it; |
| 1284 password_val->SetString("username_value", password_form->username_value); | 1284 password_val->SetString("username_value", password_form->username_value); |
| 1285 password_val->SetString("password_value", password_form->password_value); | 1285 password_val->SetString("password_value", password_form->password_value); |
| 1286 password_val->SetString("signon_realm", password_form->signon_realm); | 1286 password_val->SetString("signon_realm", password_form->signon_realm); |
| 1287 password_val->SetReal( | 1287 password_val->SetDouble( |
| 1288 "time", static_cast<double>(password_form->date_created.ToDoubleT())); | 1288 "time", static_cast<double>(password_form->date_created.ToDoubleT())); |
| 1289 password_val->SetString("origin_url", password_form->origin.spec()); | 1289 password_val->SetString("origin_url", password_form->origin.spec()); |
| 1290 password_val->SetString("username_element", | 1290 password_val->SetString("username_element", |
| 1291 password_form->username_element); | 1291 password_form->username_element); |
| 1292 password_val->SetString("password_element", | 1292 password_val->SetString("password_element", |
| 1293 password_form->password_element); | 1293 password_form->password_element); |
| 1294 password_val->SetString("submit_element", | 1294 password_val->SetString("submit_element", |
| 1295 password_form->submit_element); | 1295 password_form->submit_element); |
| 1296 password_val->SetString("action_target", password_form->action.spec()); | 1296 password_val->SetString("action_target", password_form->action.spec()); |
| 1297 password_val->SetBoolean("blacklist", password_form->blacklisted_by_user); | 1297 password_val->SetBoolean("blacklist", password_form->blacklisted_by_user); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 NewRunnableMethod( | 1695 NewRunnableMethod( |
| 1696 this, | 1696 this, |
| 1697 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); | 1697 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { | 1700 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { |
| 1701 automation_->Send(reply_message_); | 1701 automation_->Send(reply_message_); |
| 1702 Release(); | 1702 Release(); |
| 1703 } | 1703 } |
| 1704 | 1704 |
| OLD | NEW |