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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |