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

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

Issue 1239643004: extensions: tabs: set tab id to -1 for app/devtools windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698