Chromium Code Reviews| 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 "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 ScrubTabValueForExtension(contents, extension, result); | 343 ScrubTabValueForExtension(contents, extension, result); |
| 344 return result; | 344 return result; |
| 345 } | 345 } |
| 346 | 346 |
| 347 base::ListValue* ExtensionTabUtil::CreateTabList( | 347 base::ListValue* ExtensionTabUtil::CreateTabList( |
| 348 const Browser* browser, | 348 const Browser* browser, |
| 349 const Extension* extension) { | 349 const Extension* extension) { |
| 350 base::ListValue* tab_list = new base::ListValue(); | 350 base::ListValue* tab_list = new base::ListValue(); |
| 351 TabStripModel* tab_strip = browser->tab_strip_model(); | 351 TabStripModel* tab_strip = browser->tab_strip_model(); |
| 352 for (int i = 0; i < tab_strip->count(); ++i) { | 352 for (int i = 0; i < tab_strip->count(); ++i) { |
| 353 tab_list->Append(CreateTabValue(tab_strip->GetWebContentsAt(i), | 353 base::DictionaryValue* value = |
| 354 tab_strip, | 354 CreateTabValue(tab_strip->GetWebContentsAt(i), tab_strip, i, extension); |
| 355 i, | 355 // Remove tab id for devtools as we don't want them to be |
| 356 extension)); | 356 // manipulated through the chrome.tabs API. |
| 357 if (browser->is_devtools()) | |
|
dgozman
2015/07/14 15:16:16
What about TabUpdatedEvent or TabsGetCurrent? Perh
not at google - send to devlin
2015/07/14 17:15:13
CreateTabValue looks right to me.
not at google - send to devlin
2015/07/14 17:40:00
Actually, GetTabID looks even right-er to me. More
not at google - send to devlin
2015/07/14 17:41:09
More comments:
In fact I wonder if this would bre
| |
| 358 value->Remove(keys::kIdKey, nullptr); | |
| 359 tab_list->Append(value); | |
| 357 } | 360 } |
| 358 | 361 |
| 359 return tab_list; | 362 return tab_list; |
| 360 } | 363 } |
| 361 | 364 |
| 362 base::DictionaryValue* ExtensionTabUtil::CreateTabValue( | 365 base::DictionaryValue* ExtensionTabUtil::CreateTabValue( |
| 363 WebContents* contents, | 366 WebContents* contents, |
| 364 TabStripModel* tab_strip, | 367 TabStripModel* tab_strip, |
| 365 int tab_index) { | 368 int tab_index) { |
| 366 // If we have a matching AppWindow with a controller, get the tab value | 369 // If we have a matching AppWindow with a controller, get the tab value |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 | 635 |
| 633 chrome::NavigateParams params( | 636 chrome::NavigateParams params( |
| 634 chrome::GetSingletonTabNavigateParams(browser, url_to_navigate)); | 637 chrome::GetSingletonTabNavigateParams(browser, url_to_navigate)); |
| 635 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 638 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
| 636 params.url = url_to_navigate; | 639 params.url = url_to_navigate; |
| 637 chrome::ShowSingletonTabOverwritingNTP(browser, params); | 640 chrome::ShowSingletonTabOverwritingNTP(browser, params); |
| 638 return true; | 641 return true; |
| 639 } | 642 } |
| 640 | 643 |
| 641 } // namespace extensions | 644 } // namespace extensions |
| OLD | NEW |