Chromium Code Reviews| Index: chrome/browser/extensions/api/tabs/tabs_api.cc |
| diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| index c6dc4863414b048439052edcb3daee501bd03fa7..9037d0095f0ca2ba294125e1ba0f0cc53429a502 100644 |
| --- a/chrome/browser/extensions/api/tabs/tabs_api.cc |
| +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| @@ -26,6 +26,7 @@ |
| #include "base/strings/stringprintf.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| +#include "chrome/browser/browser_process.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| #include "chrome/browser/extensions/api/tabs/windows_util.h" |
| @@ -34,6 +35,7 @@ |
| #include "chrome/browser/extensions/tab_helper.h" |
| #include "chrome/browser/extensions/window_controller.h" |
| #include "chrome/browser/extensions/window_controller_list.h" |
| +#include "chrome/browser/memory/tab_manager.h" |
| #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/sessions/session_tab_helper.h" |
| @@ -966,6 +968,7 @@ bool TabsQueryFunction::RunSync() { |
| TabStripModel* tab_strip = browser->tab_strip_model(); |
| for (int i = 0; i < tab_strip->count(); ++i) { |
| WebContents* web_contents = tab_strip->GetWebContentsAt(i); |
| + memory::TabManager* tab_manager = g_browser_process->GetTabManager(); |
| if (index > -1 && i != index) |
| continue; |
| @@ -990,6 +993,13 @@ bool TabsQueryFunction::RunSync() { |
| continue; |
| } |
| + // If tab_manager is not present, no tabs are discarded and therefore |
| + // the tab is returned only if query_info.discarded is false. Otherwise |
|
Devlin
2016/07/11 20:25:04
nit: this comment is a bit long for what it's sayi
Anderson Silva
2016/07/11 21:25:55
Done.
|
| + // check the matching of the parameter and the status on tab_manager. |
| + bool discarded = tab_manager && tab_manager->IsTabDiscarded(web_contents); |
| + if (!MatchesBool(params->query_info.discarded.get(), discarded)) |
| + continue; |
| + |
| if (!MatchesBool(params->query_info.muted.get(), |
| web_contents->IsAudioMuted())) { |
| continue; |