Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 switch (api_info->arg_url_transform) { 272 switch (api_info->arg_url_transform) {
273 case NONE: { 273 case NONE: {
274 // No translation needed; just extract the URL directly from a raw string 274 // No translation needed; just extract the URL directly from a raw string
275 // or from a dictionary. Succeeds if we can find a string in the 275 // or from a dictionary. Succeeds if we can find a string in the
276 // argument list and that the string resolves to a valid URL. 276 // argument list and that the string resolves to a valid URL.
277 std::string url_string; 277 std::string url_string;
278 if (action->args()->GetString(url_index, &url_string) && 278 if (action->args()->GetString(url_index, &url_string) &&
279 ResolveUrl(action->page_url(), url_string, &arg_url)) { 279 ResolveUrl(action->page_url(), url_string, &arg_url)) {
280 action->mutable_args()->Set(url_index, 280 action->mutable_args()->Set(url_index,
281 new base::StringValue(kArgUrlPlaceholder)); 281 new base::Value(kArgUrlPlaceholder));
282 } 282 }
283 break; 283 break;
284 } 284 }
285 285
286 case DICT_LOOKUP: { 286 case DICT_LOOKUP: {
287 CHECK(api_info->arg_url_dict_path); 287 CHECK(api_info->arg_url_dict_path);
288 // Look up the URL from a dictionary at the specified location. Succeeds 288 // Look up the URL from a dictionary at the specified location. Succeeds
289 // if we can find a dictionary in the argument list, the dictionary 289 // if we can find a dictionary in the argument list, the dictionary
290 // contains the specified key, and the corresponding value resolves to a 290 // contains the specified key, and the corresponding value resolves to a
291 // valid URL. 291 // valid URL.
(...skipping 10 matching lines...) Expand all
302 case LOOKUP_TAB_ID: { 302 case LOOKUP_TAB_ID: {
303 // Translation of tab IDs to URLs has been requested. There are two 303 // Translation of tab IDs to URLs has been requested. There are two
304 // cases to consider: either a single integer or a list of integers (when 304 // cases to consider: either a single integer or a list of integers (when
305 // multiple tabs are manipulated). 305 // multiple tabs are manipulated).
306 int tab_id; 306 int tab_id;
307 base::ListValue* tab_list = NULL; 307 base::ListValue* tab_list = NULL;
308 if (action->args()->GetInteger(url_index, &tab_id)) { 308 if (action->args()->GetInteger(url_index, &tab_id)) {
309 // Single tab ID to translate. 309 // Single tab ID to translate.
310 GetUrlForTabId(tab_id, profile, &arg_url, &arg_incognito); 310 GetUrlForTabId(tab_id, profile, &arg_url, &arg_incognito);
311 if (arg_url.is_valid()) { 311 if (arg_url.is_valid()) {
312 action->mutable_args()->Set( 312 action->mutable_args()->Set(url_index,
313 url_index, new base::StringValue(kArgUrlPlaceholder)); 313 new base::Value(kArgUrlPlaceholder));
314 } 314 }
315 } else if (action->mutable_args()->GetList(url_index, &tab_list)) { 315 } else if (action->mutable_args()->GetList(url_index, &tab_list)) {
316 // A list of possible IDs to translate. Work through in reverse order 316 // A list of possible IDs to translate. Work through in reverse order
317 // so the last one translated is left in arg_url. 317 // so the last one translated is left in arg_url.
318 int extracted_index = -1; // Which list item is copied to arg_url? 318 int extracted_index = -1; // Which list item is copied to arg_url?
319 for (int i = tab_list->GetSize() - 1; i >= 0; --i) { 319 for (int i = tab_list->GetSize() - 1; i >= 0; --i) {
320 if (tab_list->GetInteger(i, &tab_id) && 320 if (tab_list->GetInteger(i, &tab_id) &&
321 GetUrlForTabId(tab_id, profile, &arg_url, &arg_incognito)) { 321 GetUrlForTabId(tab_id, profile, &arg_url, &arg_incognito)) {
322 if (!arg_incognito) 322 if (!arg_incognito)
323 tab_list->Set(i, new base::StringValue(arg_url.spec())); 323 tab_list->Set(i, new base::Value(arg_url.spec()));
324 extracted_index = i; 324 extracted_index = i;
325 } 325 }
326 } 326 }
327 if (extracted_index >= 0) { 327 if (extracted_index >= 0) {
328 tab_list->Set( 328 tab_list->Set(extracted_index, new base::Value(kArgUrlPlaceholder));
329 extracted_index, new base::StringValue(kArgUrlPlaceholder));
330 } 329 }
331 } 330 }
332 break; 331 break;
333 } 332 }
334 333
335 default: 334 default:
336 NOTREACHED(); 335 NOTREACHED();
337 } 336 }
338 337
339 if (arg_url.is_valid()) { 338 if (arg_url.is_valid()) {
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 } 933 }
935 } 934 }
936 935
937 template <> 936 template <>
938 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { 937 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() {
939 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 938 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
940 DependsOn(ExtensionRegistryFactory::GetInstance()); 939 DependsOn(ExtensionRegistryFactory::GetInstance());
941 } 940 }
942 941
943 } // namespace extensions 942 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698