OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/history/history_extension_api.h" | 5 #include "chrome/browser/history/history_extension_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 DispatchEvent(profile, kOnVisited, json_args); | 138 DispatchEvent(profile, kOnVisited, json_args); |
139 } | 139 } |
140 | 140 |
141 void HistoryExtensionEventRouter::HistoryUrlsRemoved( | 141 void HistoryExtensionEventRouter::HistoryUrlsRemoved( |
142 Profile* profile, | 142 Profile* profile, |
143 const history::URLsDeletedDetails* details) { | 143 const history::URLsDeletedDetails* details) { |
144 ListValue args; | 144 ListValue args; |
145 DictionaryValue* dict = new DictionaryValue(); | 145 DictionaryValue* dict = new DictionaryValue(); |
146 dict->SetBoolean(kAllHistoryKey, details->all_history); | 146 dict->SetBoolean(kAllHistoryKey, details->all_history); |
147 ListValue* urls = new ListValue(); | 147 ListValue* urls = new ListValue(); |
148 for (history::URLRows::const_iterator iterator = details->rows.begin(); | 148 for (std::set<GURL>::const_iterator iterator = details->urls.begin(); |
149 iterator != details->rows.end(); ++iterator) { | 149 iterator != details->urls.end(); |
150 urls->Append(new StringValue(iterator->url().spec())); | 150 ++iterator) { |
| 151 urls->Append(new StringValue(iterator->spec())); |
151 } | 152 } |
152 dict->Set(kUrlsKey, urls); | 153 dict->Set(kUrlsKey, urls); |
153 args.Append(dict); | 154 args.Append(dict); |
154 | 155 |
155 std::string json_args; | 156 std::string json_args; |
156 base::JSONWriter::Write(&args, &json_args); | 157 base::JSONWriter::Write(&args, &json_args); |
157 DispatchEvent(profile, kOnVisitRemoved, json_args); | 158 DispatchEvent(profile, kOnVisitRemoved, json_args); |
158 } | 159 } |
159 | 160 |
160 void HistoryExtensionEventRouter::DispatchEvent(Profile* profile, | 161 void HistoryExtensionEventRouter::DispatchEvent(Profile* profile, |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 &cancelable_consumer_, | 393 &cancelable_consumer_, |
393 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, | 394 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, |
394 base::Unretained(this))); | 395 base::Unretained(this))); |
395 | 396 |
396 return true; | 397 return true; |
397 } | 398 } |
398 | 399 |
399 void DeleteAllHistoryFunction::DeleteComplete() { | 400 void DeleteAllHistoryFunction::DeleteComplete() { |
400 SendAsyncResponse(); | 401 SendAsyncResponse(); |
401 } | 402 } |
OLD | NEW |