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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 2205523002: AutoDiscardable property support on Chrome Extensions Tabs API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed nits Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c43670ac9311cae7af1a10fa403731139a561a98..cbced11e5836c0bdddf8486a2ddc677eaf9f2c19 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -993,10 +993,15 @@ bool TabsQueryFunction::RunSync() {
continue;
}
- // If tab_manager isn't present, then no tabs are discarded.
- bool discarded = tab_manager && tab_manager->IsTabDiscarded(web_contents);
- if (!MatchesBool(params->query_info.discarded.get(), discarded))
+ if (!MatchesBool(params->query_info.discarded.get(),
+ tab_manager->IsTabDiscarded(web_contents))) {
continue;
+ }
+
+ if (!MatchesBool(params->query_info.auto_discardable.get(),
+ tab_manager->IsTabAutoDiscardable(web_contents))) {
+ continue;
+ }
if (!MatchesBool(params->query_info.muted.get(),
web_contents->IsAudioMuted())) {
@@ -1336,6 +1341,12 @@ bool TabsUpdateFunction::RunAsync() {
tab_strip->SetOpenerOfWebContentsAt(tab_index, opener_contents);
}
+ if (params->update_properties.auto_discardable.get()) {
+ bool state = *params->update_properties.auto_discardable;
+ g_browser_process->GetTabManager()->SetTabAutoDiscardableState(contents,
+ state);
+ }
+
if (!is_async) {
PopulateResult();
SendResponse(true);
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698