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

Side by Side Diff: chrome/browser/ui/webui/options/options_ui.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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) 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/ui/webui/options/options_ui.h" 5 #include "chrome/browser/ui/webui/options/options_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted_memory.h" 14 #include "base/memory/ref_counted_memory.h"
14 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
17 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 const AutocompleteMatch& match = result.match_at(i); 408 const AutocompleteMatch& match = result.match_at(i);
408 AutocompleteMatchType::Type type = match.type; 409 AutocompleteMatchType::Type type = match.type;
409 if (type != AutocompleteMatchType::HISTORY_URL && 410 if (type != AutocompleteMatchType::HISTORY_URL &&
410 type != AutocompleteMatchType::HISTORY_TITLE && 411 type != AutocompleteMatchType::HISTORY_TITLE &&
411 type != AutocompleteMatchType::HISTORY_BODY && 412 type != AutocompleteMatchType::HISTORY_BODY &&
412 type != AutocompleteMatchType::HISTORY_KEYWORD && 413 type != AutocompleteMatchType::HISTORY_KEYWORD &&
413 type != AutocompleteMatchType::NAVSUGGEST && 414 type != AutocompleteMatchType::NAVSUGGEST &&
414 type != AutocompleteMatchType::NAVSUGGEST_PERSONALIZED) { 415 type != AutocompleteMatchType::NAVSUGGEST_PERSONALIZED) {
415 continue; 416 continue;
416 } 417 }
417 base::DictionaryValue* entry = new base::DictionaryValue(); 418 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
418 entry->SetString("title", match.description); 419 entry->SetString("title", match.description);
419 entry->SetString("displayURL", match.contents); 420 entry->SetString("displayURL", match.contents);
420 entry->SetString("url", match.destination_url.spec()); 421 entry->SetString("url", match.destination_url.spec());
421 suggestions->Append(entry); 422 suggestions->Append(std::move(entry));
422 } 423 }
423 } 424 }
424 425
425 void OptionsUI::DidStartProvisionalLoadForFrame( 426 void OptionsUI::DidStartProvisionalLoadForFrame(
426 content::RenderFrameHost* render_frame_host, 427 content::RenderFrameHost* render_frame_host,
427 const GURL& validated_url, 428 const GURL& validated_url,
428 bool is_error_page, 429 bool is_error_page,
429 bool is_iframe_srcdoc) { 430 bool is_iframe_srcdoc) {
430 load_start_time_ = base::Time::Now(); 431 load_start_time_ = base::Time::Now();
431 if (render_frame_host->GetRenderViewHost() == 432 if (render_frame_host->GetRenderViewHost() ==
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // Add only if handler's service is enabled. 489 // Add only if handler's service is enabled.
489 if (handler->IsEnabled()) { 490 if (handler->IsEnabled()) {
490 // Add handler to the list and also pass the ownership. 491 // Add handler to the list and also pass the ownership.
491 web_ui()->AddMessageHandler(handler.release()); 492 web_ui()->AddMessageHandler(handler.release());
492 handler_raw->GetLocalizedValues(localized_strings); 493 handler_raw->GetLocalizedValues(localized_strings);
493 handlers_.push_back(handler_raw); 494 handlers_.push_back(handler_raw);
494 } 495 }
495 } 496 }
496 497
497 } // namespace options 498 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698