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

Side by Side Diff: chrome/browser/extensions/extension_tab_util.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 unified diff | Download patch
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 <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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 std::unique_ptr<api::tabs::Tab> tab_object(new api::tabs::Tab); 382 std::unique_ptr<api::tabs::Tab> tab_object(new api::tabs::Tab);
383 tab_object->id.reset(new int(GetTabIdForExtensions(contents))); 383 tab_object->id.reset(new int(GetTabIdForExtensions(contents)));
384 tab_object->index = tab_index; 384 tab_object->index = tab_index;
385 tab_object->window_id = GetWindowIdOfTab(contents); 385 tab_object->window_id = GetWindowIdOfTab(contents);
386 tab_object->status.reset(new std::string(GetTabStatusText(is_loading))); 386 tab_object->status.reset(new std::string(GetTabStatusText(is_loading)));
387 tab_object->active = tab_strip && tab_index == tab_strip->active_index(); 387 tab_object->active = tab_strip && tab_index == tab_strip->active_index();
388 tab_object->selected = tab_strip && tab_index == tab_strip->active_index(); 388 tab_object->selected = tab_strip && tab_index == tab_strip->active_index();
389 tab_object->highlighted = tab_strip && tab_strip->IsTabSelected(tab_index); 389 tab_object->highlighted = tab_strip && tab_strip->IsTabSelected(tab_index);
390 tab_object->pinned = tab_strip && tab_strip->IsTabPinned(tab_index); 390 tab_object->pinned = tab_strip && tab_strip->IsTabPinned(tab_index);
391 tab_object->audible.reset(new bool(contents->WasRecentlyAudible())); 391 tab_object->audible.reset(new bool(contents->WasRecentlyAudible()));
392 392 tab_object->discarded =
393 memory::TabManager* tab_manager = g_browser_process->GetTabManager(); 393 g_browser_process->GetTabManager()->IsTabDiscarded(contents);
394 tab_object->discarded = tab_manager && tab_manager->IsTabDiscarded(contents); 394 tab_object->auto_discardable =
395 395 g_browser_process->GetTabManager()->IsTabAutoDiscardable(contents);
396 tab_object->muted_info = CreateMutedInfo(contents); 396 tab_object->muted_info = CreateMutedInfo(contents);
397 tab_object->incognito = contents->GetBrowserContext()->IsOffTheRecord(); 397 tab_object->incognito = contents->GetBrowserContext()->IsOffTheRecord();
398 tab_object->width.reset( 398 tab_object->width.reset(
399 new int(contents->GetContainerBounds().size().width())); 399 new int(contents->GetContainerBounds().size().width()));
400 tab_object->height.reset( 400 tab_object->height.reset(
401 new int(contents->GetContainerBounds().size().height())); 401 new int(contents->GetContainerBounds().size().height()));
402 402
403 tab_object->url.reset(new std::string(contents->GetURL().spec())); 403 tab_object->url.reset(new std::string(contents->GetURL().spec()));
404 tab_object->title.reset( 404 tab_object->title.reset(
405 new std::string(base::UTF16ToUTF8(contents->GetTitle()))); 405 new std::string(base::UTF16ToUTF8(contents->GetTitle())));
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 chrome::ShowSingletonTabOverwritingNTP(browser, params); 670 chrome::ShowSingletonTabOverwritingNTP(browser, params);
671 return true; 671 return true;
672 } 672 }
673 673
674 // static 674 // static
675 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) { 675 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) {
676 return browser && browser->tab_strip_model() && !browser->is_devtools(); 676 return browser && browser->tab_strip_model() && !browser->is_devtools();
677 } 677 }
678 678
679 } // namespace extensions 679 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_test.cc ('k') | chrome/browser/extensions/extension_tabs_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698