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

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

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/extensions/extension_tab_util.h" 5 #include "chrome/browser/extensions/extension_tab_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 351
352 std::unique_ptr<base::ListValue> ExtensionTabUtil::CreateTabList( 352 std::unique_ptr<base::ListValue> ExtensionTabUtil::CreateTabList(
353 const Browser* browser, 353 const Browser* browser,
354 const Extension* extension) { 354 const Extension* extension) {
355 std::unique_ptr<base::ListValue> tab_list(new base::ListValue()); 355 std::unique_ptr<base::ListValue> tab_list(new base::ListValue());
356 TabStripModel* tab_strip = browser->tab_strip_model(); 356 TabStripModel* tab_strip = browser->tab_strip_model();
357 for (int i = 0; i < tab_strip->count(); ++i) { 357 for (int i = 0; i < tab_strip->count(); ++i) {
358 tab_list->Append( 358 tab_list->Append(
359 CreateTabObject(tab_strip->GetWebContentsAt(i), tab_strip, i, extension) 359 CreateTabObject(tab_strip->GetWebContentsAt(i), tab_strip, i, extension)
360 ->ToValue() 360 ->ToValue());
361 .release());
362 } 361 }
363 362
364 return tab_list; 363 return tab_list;
365 } 364 }
366 365
367 // static 366 // static
368 std::unique_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject( 367 std::unique_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
369 content::WebContents* contents, 368 content::WebContents* contents,
370 TabStripModel* tab_strip, 369 TabStripModel* tab_strip,
371 int tab_index) { 370 int tab_index) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 chrome::ShowSingletonTabOverwritingNTP(browser, params); 663 chrome::ShowSingletonTabOverwritingNTP(browser, params);
665 return true; 664 return true;
666 } 665 }
667 666
668 // static 667 // static
669 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) { 668 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) {
670 return browser && browser->tab_strip_model() && !browser->is_devtools(); 669 return browser && browser->tab_strip_model() && !browser->is_devtools();
671 } 670 }
672 671
673 } // namespace extensions 672 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698