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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 DictionaryValue* InitialLoadObserver::GetTimingInformation() const { | 135 DictionaryValue* InitialLoadObserver::GetTimingInformation() const { |
136 ListValue* items = new ListValue; | 136 ListValue* items = new ListValue; |
137 for (TabTimeMap::const_iterator it = loading_tabs_.begin(); | 137 for (TabTimeMap::const_iterator it = loading_tabs_.begin(); |
138 it != loading_tabs_.end(); | 138 it != loading_tabs_.end(); |
139 ++it) { | 139 ++it) { |
140 DictionaryValue* item = new DictionaryValue; | 140 DictionaryValue* item = new DictionaryValue; |
141 base::TimeDelta delta_start = it->second.start_time() - init_time_; | 141 base::TimeDelta delta_start = it->second.start_time() - init_time_; |
142 | 142 |
143 item->SetDouble("load_start_ms", delta_start.InMillisecondsF()); | 143 item->SetDouble("load_start_ms", delta_start.InMillisecondsF()); |
144 if (it->second.stop_time().is_null()) { | 144 if (it->second.stop_time().is_null()) { |
145 item->Set("load_stop_ms", Value::CreateNullValue()); | 145 item->Set("load_stop_ms", base::NullValue()); |
146 } else { | 146 } else { |
147 base::TimeDelta delta_stop = it->second.stop_time() - init_time_; | 147 base::TimeDelta delta_stop = it->second.stop_time() - init_time_; |
148 item->SetDouble("load_stop_ms", delta_stop.InMillisecondsF()); | 148 item->SetDouble("load_stop_ms", delta_stop.InMillisecondsF()); |
149 } | 149 } |
150 items->Append(item); | 150 items->Append(item); |
151 } | 151 } |
152 DictionaryValue* return_value = new DictionaryValue; | 152 DictionaryValue* return_value = new DictionaryValue; |
153 return_value->Set("tabs", items); | 153 return_value->Set("tabs", items); |
154 return return_value; | 154 return return_value; |
155 } | 155 } |
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 // Get the info that would be displayed in the recently closed section. | 2034 // Get the info that would be displayed in the recently closed section. |
2035 ListValue* recently_closed_list = new ListValue; | 2035 ListValue* recently_closed_list = new ListValue; |
2036 RecentlyClosedTabsHandler::AddRecentlyClosedEntries(service->entries(), | 2036 RecentlyClosedTabsHandler::AddRecentlyClosedEntries(service->entries(), |
2037 recently_closed_list); | 2037 recently_closed_list); |
2038 ntp_info_->Set("recently_closed", recently_closed_list); | 2038 ntp_info_->Set("recently_closed", recently_closed_list); |
2039 | 2039 |
2040 // Add default site URLs. | 2040 // Add default site URLs. |
2041 ListValue* default_sites_list = new ListValue; | 2041 ListValue* default_sites_list = new ListValue; |
2042 history::MostVisitedURLList urls = history::TopSites::GetPrepopulatePages(); | 2042 history::MostVisitedURLList urls = history::TopSites::GetPrepopulatePages(); |
2043 for (size_t i = 0; i < urls.size(); ++i) { | 2043 for (size_t i = 0; i < urls.size(); ++i) { |
2044 default_sites_list->Append(Value::CreateStringValue( | 2044 default_sites_list->Append(base::StringValue::New( |
2045 urls[i].url.possibly_invalid_spec())); | 2045 urls[i].url.possibly_invalid_spec())); |
2046 } | 2046 } |
2047 ntp_info_->Set("default_sites", default_sites_list); | 2047 ntp_info_->Set("default_sites", default_sites_list); |
2048 | 2048 |
2049 registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_UPDATED, | 2049 registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_UPDATED, |
2050 Source<history::TopSites>(top_sites_)); | 2050 Source<history::TopSites>(top_sites_)); |
2051 if (top_sites_->loaded()) { | 2051 if (top_sites_->loaded()) { |
2052 OnTopSitesLoaded(); | 2052 OnTopSitesLoaded(); |
2053 } else { | 2053 } else { |
2054 registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_LOADED, | 2054 registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_LOADED, |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2615 void DragTargetDropAckNotificationObserver::Observe( | 2615 void DragTargetDropAckNotificationObserver::Observe( |
2616 int type, | 2616 int type, |
2617 const NotificationSource& source, | 2617 const NotificationSource& source, |
2618 const NotificationDetails& details) { | 2618 const NotificationDetails& details) { |
2619 if (automation_) { | 2619 if (automation_) { |
2620 AutomationJSONReply(automation_, | 2620 AutomationJSONReply(automation_, |
2621 reply_message_.release()).SendSuccess(NULL); | 2621 reply_message_.release()).SendSuccess(NULL); |
2622 } | 2622 } |
2623 delete this; | 2623 delete this; |
2624 } | 2624 } |
OLD | NEW |