Commit 1c7bd66e authored by gab@chromium.org's avatar gab@chromium.org

Replace static/native-desktop-only BrowserList::const_reverse_iterator by...

Replace static/native-desktop-only BrowserList::const_reverse_iterator by desktop specific reverse iterators as appropriate.

BUG=129187

Review URL: https://codereview.chromium.org/12262019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182463 0039d316-1c4b-4281-b951-d872f2087c98
parent be5c1816
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
#include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list_impl.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/native_app_window.h" #include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
...@@ -144,9 +145,11 @@ AppShortcutLauncherItemController::GetRunningApplications() { ...@@ -144,9 +145,11 @@ AppShortcutLauncherItemController::GetRunningApplications() {
const Extension* extension = const Extension* extension =
launcher_controller()->GetExtensionForAppID(app_id()); launcher_controller()->GetExtensionForAppID(app_id());
for (BrowserList::const_reverse_iterator it = const chrome::BrowserListImpl* ash_browser_list =
BrowserList::begin_last_active(); chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH);
it != BrowserList::end_last_active(); ++it) { for (chrome::BrowserListImpl::const_reverse_iterator it =
ash_browser_list->begin_last_active();
it != ash_browser_list->end_last_active(); ++it) {
Browser* browser = *it; Browser* browser = *it;
TabStripModel* tab_strip = browser->tab_strip_model(); TabStripModel* tab_strip = browser->tab_strip_model();
// We start to enumerate from the active index. // We start to enumerate from the active index.
......
...@@ -1371,10 +1371,12 @@ ChromeLauncherControllerPerApp::GetBrowserApplicationList() { ...@@ -1371,10 +1371,12 @@ ChromeLauncherControllerPerApp::GetBrowserApplicationList() {
items.push_back(new ChromeLauncherAppMenuItem( items.push_back(new ChromeLauncherAppMenuItem(
l10n_util::GetStringFUTF16(IDS_LAUNCHER_CHROME_BROWSER_NAME, l10n_util::GetStringFUTF16(IDS_LAUNCHER_CHROME_BROWSER_NAME,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)), NULL)); l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)), NULL));
const chrome::BrowserListImpl* ash_browser_list =
chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH);
int index = 1; int index = 1;
for (BrowserList::const_reverse_iterator it = for (chrome::BrowserListImpl::const_reverse_iterator it =
BrowserList::begin_last_active(); ash_browser_list->begin_last_active();
it != BrowserList::end_last_active(); ++it, ++index) { it != ash_browser_list->end_last_active(); ++it, ++index) {
Browser* browser = *it; Browser* browser = *it;
if (browser->is_type_tabbed()) if (browser->is_type_tabbed())
found_tabbed_browser = true; found_tabbed_browser = true;
......
...@@ -71,16 +71,6 @@ void BrowserList::SetLastActive(Browser* browser) { ...@@ -71,16 +71,6 @@ void BrowserList::SetLastActive(Browser* browser) {
SetLastActive(browser); SetLastActive(browser);
} }
// static
BrowserList::const_reverse_iterator BrowserList::begin_last_active() {
return GetNativeList()->begin_last_active();
}
// static
BrowserList::const_reverse_iterator BrowserList::end_last_active() {
return GetNativeList()->end_last_active();
}
// static // static
bool BrowserList::IsOffTheRecordSessionActive() { bool BrowserList::IsOffTheRecordSessionActive() {
return GetNativeList()->IsIncognitoWindowOpen(); return GetNativeList()->IsIncognitoWindowOpen();
......
...@@ -20,7 +20,6 @@ class BrowserListObserver; ...@@ -20,7 +20,6 @@ class BrowserListObserver;
class BrowserList { class BrowserList {
public: public:
typedef std::vector<Browser*> BrowserVector; typedef std::vector<Browser*> BrowserVector;
typedef BrowserVector::const_reverse_iterator const_reverse_iterator;
// Adds and removes browsers from the list they are associated with. The // Adds and removes browsers from the list they are associated with. The
// browser object should be valid BEFORE these calls (for the benefit of // browser object should be valid BEFORE these calls (for the benefit of
...@@ -39,13 +38,6 @@ class BrowserList { ...@@ -39,13 +38,6 @@ class BrowserList {
// Closes all browsers for |profile| across all desktops. // Closes all browsers for |profile| across all desktops.
static void CloseAllBrowsersWithProfile(Profile* profile); static void CloseAllBrowsersWithProfile(Profile* profile);
// Returns iterated access to list of open browsers ordered by when
// they were last active. The underlying data structure is a vector
// and we push_back on recent access so a reverse iterator gives the
// latest accessed browser first.
static const_reverse_iterator begin_last_active();
static const_reverse_iterator end_last_active();
// Returns true if at least one incognito session is active. // Returns true if at least one incognito session is active.
static bool IsOffTheRecordSessionActive(); static bool IsOffTheRecordSessionActive();
......
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/ash_init.h" #include "chrome/browser/ui/ash/ash_init.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list_impl.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/browser_window_state.h" #include "chrome/browser/ui/browser_window_state.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "ui/gfx/screen.h" #include "ui/gfx/screen.h"
...@@ -112,9 +113,16 @@ class DefaultStateProvider : public WindowSizer::StateProvider { ...@@ -112,9 +113,16 @@ class DefaultStateProvider : public WindowSizer::StateProvider {
if (browser_ && browser_->window() && !browser_->window()->IsPanel()) { if (browser_ && browser_->window() && !browser_->window()->IsPanel()) {
window = browser_->window(); window = browser_->window();
} else { } else {
BrowserList::const_reverse_iterator it = BrowserList::begin_last_active(); // This code is only ran on the native desktop (on the ash desktop,
BrowserList::const_reverse_iterator end = BrowserList::end_last_active(); // GetBoundsOverrideAsh should take over below before this is reached).
for (; (it != end); ++it) { // TODO(gab): This code should go in a native desktop specific window
// sizer as part of fixing crbug.com/175812.
const chrome::BrowserListImpl* native_browser_list =
chrome::BrowserListImpl::GetInstance(
chrome::HOST_DESKTOP_TYPE_NATIVE);
for (chrome::BrowserListImpl::const_reverse_iterator it =
native_browser_list->begin_last_active();
it != native_browser_list->end_last_active(); ++it) {
Browser* last_active = *it; Browser* last_active = *it;
if (last_active && last_active->is_type_tabbed()) { if (last_active && last_active->is_type_tabbed()) {
window = last_active->window(); window = last_active->window();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment