| 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 (std::set<GURL>::const_iterator iterator = details->urls.begin(); | 148 for (history::URLRows::const_iterator iterator = details->rows.begin(); |
| 149 iterator != details->urls.end(); | 149 iterator != details->rows.end(); ++iterator) { |
| 150 ++iterator) { | 150 urls->Append(new StringValue(iterator->url().spec())); |
| 151 urls->Append(new StringValue(iterator->spec())); | |
| 152 } | 151 } |
| 153 dict->Set(kUrlsKey, urls); | 152 dict->Set(kUrlsKey, urls); |
| 154 args.Append(dict); | 153 args.Append(dict); |
| 155 | 154 |
| 156 std::string json_args; | 155 std::string json_args; |
| 157 base::JSONWriter::Write(&args, &json_args); | 156 base::JSONWriter::Write(&args, &json_args); |
| 158 DispatchEvent(profile, kOnVisitRemoved, json_args); | 157 DispatchEvent(profile, kOnVisitRemoved, json_args); |
| 159 } | 158 } |
| 160 | 159 |
| 161 void HistoryExtensionEventRouter::DispatchEvent(Profile* profile, | 160 void HistoryExtensionEventRouter::DispatchEvent(Profile* profile, |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 &cancelable_consumer_, | 392 &cancelable_consumer_, |
| 394 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, | 393 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, |
| 395 base::Unretained(this))); | 394 base::Unretained(this))); |
| 396 | 395 |
| 397 return true; | 396 return true; |
| 398 } | 397 } |
| 399 | 398 |
| 400 void DeleteAllHistoryFunction::DeleteComplete() { | 399 void DeleteAllHistoryFunction::DeleteComplete() { |
| 401 SendAsyncResponse(); | 400 SendAsyncResponse(); |
| 402 } | 401 } |
| OLD | NEW |