Chromium Code Reviews| 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/extensions/activity_log/activity_log.h" | 5 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 base::ListValue* args = action->mutable_args(); | 145 base::ListValue* args = action->mutable_args(); |
| 146 if (args->GetInteger(0, &tab_id)) { | 146 if (args->GetInteger(0, &tab_id)) { |
| 147 GURL url; | 147 GURL url; |
| 148 bool is_incognito; | 148 bool is_incognito; |
| 149 if (GetUrlForTabId(tab_id, profile, &url, &is_incognito)) { | 149 if (GetUrlForTabId(tab_id, profile, &url, &is_incognito)) { |
| 150 action->set_arg_url(url); | 150 action->set_arg_url(url); |
| 151 action->set_arg_incognito(is_incognito); | 151 action->set_arg_incognito(is_incognito); |
| 152 } | 152 } |
| 153 } else if ((api_call == "tabs.move" || api_call == "tabs.remove") && | 153 } else if ((api_call == "tabs.move" || api_call == "tabs.remove") && |
| 154 args->GetList(0, &id_list)) { | 154 args->GetList(0, &id_list)) { |
| 155 // For APIs that take a list of tab IDs: translate all tab IDs into URLs | |
| 156 // in-place within the argument list, so all URLs are available when full | |
| 157 // logging is turned on. We can only extract one of the URLs into | |
| 158 // arg_url; arbitrarily take the first one. | |
|
Matt Perry
2013/08/02 19:23:04
What's the difference between arg_url and the id_l
mvrable
2013/08/02 19:57:09
arg_url is a separate database column where we can
Matt Perry
2013/08/02 20:26:05
Might be worth briefly mentioning that in the comm
mvrable
2013/08/02 20:54:49
I reworked the comments to try to make this cleare
| |
| 155 for (int i = 0; i < static_cast<int>(id_list->GetSize()); ++i) { | 159 for (int i = 0; i < static_cast<int>(id_list->GetSize()); ++i) { |
| 156 if (id_list->GetInteger(i, &tab_id)) { | 160 if (id_list->GetInteger(i, &tab_id)) { |
| 157 GURL url; | 161 GURL url; |
| 158 bool is_incognito; | 162 bool is_incognito; |
| 159 if (GetUrlForTabId(tab_id, profile, &url, &is_incognito) && | 163 if (GetUrlForTabId(tab_id, profile, &url, &is_incognito) && |
| 160 !is_incognito) | 164 !is_incognito) { |
| 161 id_list->Set(i, new base::StringValue(url.spec())); | 165 id_list->Set(i, new base::StringValue(url.spec())); |
| 166 if (i == 0) { | |
| 167 action->set_arg_url(url); | |
| 168 action->set_arg_incognito(is_incognito); | |
| 169 } | |
| 170 } | |
| 162 } else { | 171 } else { |
| 163 LOG(ERROR) << "The tab ID array is malformed at index " << i; | 172 LOG(ERROR) << "The tab ID array is malformed at index " << i; |
| 164 } | 173 } |
| 165 } | 174 } |
| 166 } | 175 } |
| 167 } | 176 } |
| 168 } | 177 } |
| 169 | 178 |
| 170 } // namespace | 179 } // namespace |
| 171 | 180 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 it2 != it->second.end(); | 418 it2 != it->second.end(); |
| 410 ++it2) { | 419 ++it2) { |
| 411 action->mutable_args()->AppendString(*it2); | 420 action->mutable_args()->AppendString(*it2); |
| 412 } | 421 } |
| 413 LogAction(action); | 422 LogAction(action); |
| 414 } | 423 } |
| 415 } | 424 } |
| 416 } | 425 } |
| 417 | 426 |
| 418 } // namespace extensions | 427 } // namespace extensions |
| OLD | NEW |