summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sessions
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 00:14:30 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 00:14:30 +0000
commita3c1a5e844df326b6effc4f11eb1a3ebbab13d64 (patch)
tree236b9c5e9ba68291bf16b0eac76ff364582e8ecb /chrome/browser/sessions
parent35b9ae79505ac4e25cdb704cc65b6807c9dfe29f (diff)
downloadchromium_src-a3c1a5e844df326b6effc4f11eb1a3ebbab13d64.zip
chromium_src-a3c1a5e844df326b6effc4f11eb1a3ebbab13d64.tar.gz
chromium_src-a3c1a5e844df326b6effc4f11eb1a3ebbab13d64.tar.bz2
Revert 123830 - Aura: Support hovering restore & close buttons for full screen apps.
BUG=None TEST=None Review URL: https://chromiumcodereview.appspot.com/9359022 TBR=davemoore@chromium.org Review URL: https://chromiumcodereview.appspot.com/9480013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions')
-rw-r--r--chrome/browser/sessions/base_session_service.cc32
-rw-r--r--chrome/browser/sessions/base_session_service.h13
-rw-r--r--chrome/browser/sessions/session_restore.cc23
-rw-r--r--chrome/browser/sessions/session_service.cc93
-rw-r--r--chrome/browser/sessions/session_service.h20
-rw-r--r--chrome/browser/sessions/session_service_unittest.cc73
-rw-r--r--chrome/browser/sessions/session_types.h2
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc32
-rw-r--r--chrome/browser/sessions/tab_restore_service.h3
-rw-r--r--chrome/browser/sessions/tab_restore_service_browsertest.cc41
-rw-r--r--chrome/browser/sessions/tab_restore_service_delegate.h8
11 files changed, 46 insertions, 294 deletions
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc
index 9f4d05a..d4b3809 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -247,25 +247,6 @@ SessionCommand* BaseSessionService::CreateSetTabExtensionAppIDCommand(
return new SessionCommand(command_id, pickle);
}
-SessionCommand* BaseSessionService::CreateSetWindowAppNameCommand(
- SessionID::id_type command_id,
- SessionID::id_type window_id,
- const std::string& app_name) {
- // Use pickle to handle marshalling.
- Pickle pickle;
- pickle.WriteInt(window_id);
-
- // Enforce a max for ids. They should never be anywhere near this size.
- static const SessionCommand::size_type max_id_size =
- std::numeric_limits<SessionCommand::size_type>::max() - 1024;
-
- int bytes_written = 0;
-
- WriteStringToPickle(pickle, &bytes_written, max_id_size, app_name);
-
- return new SessionCommand(command_id, pickle);
-}
-
bool BaseSessionService::RestoreUpdateTabNavigationCommand(
const SessionCommand& command,
TabNavigation* navigation,
@@ -333,19 +314,6 @@ bool BaseSessionService::RestoreSetTabExtensionAppIDCommand(
pickle->ReadString(&iterator, extension_app_id);
}
-bool BaseSessionService::RestoreSetWindowAppNameCommand(
- const SessionCommand& command,
- SessionID::id_type* window_id,
- std::string* app_name) {
- scoped_ptr<Pickle> pickle(command.PayloadAsPickle());
- if (!pickle.get())
- return false;
-
- void* iterator = NULL;
- return pickle->ReadInt(&iterator, window_id) &&
- pickle->ReadString(&iterator, app_name);
-}
-
bool BaseSessionService::ShouldTrackEntry(const GURL& url) {
// NOTE: Do not track print preview tab because re-opening that page will
// just display a non-functional print preview page.
diff --git a/chrome/browser/sessions/base_session_service.h b/chrome/browser/sessions/base_session_service.h
index 0f8afe1..26bfbd4 100644
--- a/chrome/browser/sessions/base_session_service.h
+++ b/chrome/browser/sessions/base_session_service.h
@@ -125,12 +125,6 @@ class BaseSessionService : public CancelableRequestProvider,
SessionID::id_type tab_id,
const std::string& extension_id);
- // Creates a SessionCommand stores a browser window's app name.
- SessionCommand* CreateSetWindowAppNameCommand(
- SessionID::id_type command_id,
- SessionID::id_type window_id,
- const std::string& app_name);
-
// Converts a SessionCommand previously created by
// CreateUpdateTabNavigationCommand into a TabNavigation. Returns true
// on success. If successful |tab_id| is set to the id of the restored tab.
@@ -146,13 +140,6 @@ class BaseSessionService : public CancelableRequestProvider,
SessionID::id_type* tab_id,
std::string* extension_app_id);
- // Extracts a SessionCommand as previously created by
- // CreateSetWindowAppNameCommand into the window id and application name.
- bool RestoreSetWindowAppNameCommand(
- const SessionCommand& command,
- SessionID::id_type* window_id,
- std::string* app_name);
-
// Returns true if the entry at specified |url| should be written to disk.
bool ShouldTrackEntry(const GURL& url);
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 7d2d05b..b111a41 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -485,8 +485,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
Browser* browser = CreateRestoredBrowser(
static_cast<Browser::Type>((*i)->type),
(*i)->bounds,
- (*i)->show_state,
- (*i)->app_name);
+ (*i)->show_state);
// Restore and show the browser.
const int initial_tab_count = browser->tab_count();
@@ -675,10 +674,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
}
browser = CreateRestoredBrowser(
- static_cast<Browser::Type>((*i)->type),
- (*i)->bounds,
- show_state,
- (*i)->app_name);
+ static_cast<Browser::Type>((*i)->type), (*i)->bounds, show_state);
#if defined(OS_CHROMEOS)
chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
"SessionRestore-CreateRestoredBrowser-End", false);
@@ -790,14 +786,13 @@ class SessionRestoreImpl : public content::NotificationObserver {
Browser* CreateRestoredBrowser(Browser::Type type,
gfx::Rect bounds,
- ui::WindowShowState show_state,
- const std::string& app_name) {
- Browser::CreateParams params(type, profile_);
- params.app_name = app_name;
- params.initial_bounds = bounds;
- params.initial_show_state = show_state;
- params.is_session_restore = true;
- return Browser::CreateWithParams(params);
+ ui::WindowShowState show_state) {
+ Browser* browser = new Browser(type, profile_);
+ browser->set_override_bounds(bounds);
+ browser->set_show_state(show_state);
+ browser->set_is_session_restore(true);
+ browser->InitBrowserWindow();
+ return browser;
}
void ShowBrowser(Browser* browser,
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 2ba33b5..3f8c854 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -66,7 +66,6 @@ static const SessionCommand::id_type
static const SessionCommand::id_type kCommandSetPinnedState = 12;
static const SessionCommand::id_type kCommandSetExtensionAppID = 13;
static const SessionCommand::id_type kCommandSetWindowBounds3 = 14;
-static const SessionCommand::id_type kCommandSetWindowAppName = 15;
// Every kWritesPerReset commands triggers recreating the file.
static const int kWritesPerReset = 250;
@@ -320,9 +319,8 @@ void SessionService::WindowClosed(const SessionID& window_id) {
}
void SessionService::SetWindowType(const SessionID& window_id,
- Browser::Type type,
- AppType app_type) {
- if (!should_track_changes_for_browser_type(type, app_type))
+ Browser::Type type) {
+ if (!should_track_changes_for_browser_type(type))
return;
windows_tracking_.insert(window_id.id());
@@ -338,18 +336,6 @@ void SessionService::SetWindowType(const SessionID& window_id,
CreateSetWindowTypeCommand(window_id, WindowTypeForBrowserType(type)));
}
-void SessionService::SetWindowAppName(
- const SessionID& window_id,
- const std::string& app_name) {
- if (!ShouldTrackChangesToWindow(window_id))
- return;
-
- ScheduleCommand(CreateSetTabExtensionAppIDCommand(
- kCommandSetWindowAppName,
- window_id.id(),
- app_name));
-}
-
void SessionService::TabNavigationPathPrunedFromBack(const SessionID& window_id,
const SessionID& tab_id,
int count) {
@@ -484,8 +470,7 @@ void SessionService::Init() {
content::NotificationService::AllSources());
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::NotificationService::AllSources());
- // Wait for NOTIFICATION_BROWSER_WINDOW_READY so that is_app() is set.
- registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY,
+ registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
content::NotificationService::AllBrowserContextsAndSources());
registrar_.Add(
this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
@@ -537,16 +522,15 @@ void SessionService::Observe(int type,
const content::NotificationDetails& details) {
// All of our messages have the NavigationController as the source.
switch (type) {
- case chrome::NOTIFICATION_BROWSER_WINDOW_READY: {
+ case chrome::NOTIFICATION_BROWSER_OPENED: {
Browser* browser = content::Source<Browser>(source).ptr();
- AppType app_type = browser->is_app() ? TYPE_APP : TYPE_NORMAL;
if (browser->profile() != profile() ||
- !should_track_changes_for_browser_type(browser->type(), app_type))
+ !should_track_changes_for_browser_type(browser->type())) {
return;
+ }
RestoreIfNecessary(std::vector<GURL>(), browser);
- SetWindowType(browser->session_id(), browser->type(), app_type);
- SetWindowAppName(browser->session_id(), browser->app_name());
+ SetWindowType(browser->session_id(), browser->type());
break;
}
@@ -902,26 +886,23 @@ void SessionService::SortTabsBasedOnVisualOrderAndPrune(
std::vector<SessionWindow*>* valid_windows) {
std::map<int, SessionWindow*>::iterator i = windows->begin();
while (i != windows->end()) {
- SessionWindow* window = i->second;
- AppType app_type = window->app_name.empty() ? TYPE_NORMAL : TYPE_APP;
- if (window->tabs.empty() || window->is_constrained ||
+ if (i->second->tabs.empty() || i->second->is_constrained ||
!should_track_changes_for_browser_type(
- static_cast<Browser::Type>(window->type),
- app_type)) {
- delete window;
+ static_cast<Browser::Type>(i->second->type))) {
+ delete i->second;
windows->erase(i++);
} else {
// Valid window; sort the tabs and add it to the list of valid windows.
- std::sort(window->tabs.begin(), window->tabs.end(),
+ std::sort(i->second->tabs.begin(), i->second->tabs.end(),
&TabVisualIndexSortFunction);
// Add the window such that older windows appear first.
if (valid_windows->empty()) {
- valid_windows->push_back(window);
+ valid_windows->push_back(i->second);
} else {
valid_windows->insert(
std::upper_bound(valid_windows->begin(), valid_windows->end(),
- window, &WindowOrderSortFunction),
- window);
+ i->second, &WindowOrderSortFunction),
+ i->second);
}
++i;
}
@@ -1126,16 +1107,6 @@ bool SessionService::CreateTabsAndWindows(
break;
}
- case kCommandSetWindowAppName: {
- SessionID::id_type window_id;
- std::string app_name;
- if (!RestoreSetWindowAppNameCommand(*command, &window_id, &app_name))
- return true;
-
- GetWindow(window_id, windows)->app_name.swap(app_name);
- break;
- }
-
case kCommandSetExtensionAppID: {
SessionID::id_type tab_id;
std::string extension_app_id;
@@ -1232,13 +1203,6 @@ void SessionService::BuildCommandsForBrowser(
commands->push_back(CreateSetWindowTypeCommand(
browser->session_id(), WindowTypeForBrowserType(browser->type())));
- if (!browser->app_name().empty()) {
- commands->push_back(CreateSetWindowAppNameCommand(
- kCommandSetWindowAppName,
- browser->session_id().id(),
- browser->app_name()));
- }
-
bool added_to_windows_to_track = false;
for (int i = 0; i < browser->tab_count(); ++i) {
TabContentsWrapper* tab = browser->GetTabContentsWrapperAt(i);
@@ -1265,18 +1229,15 @@ void SessionService::BuildCommandsFromBrowsers(
DCHECK(commands);
for (BrowserList::const_iterator i = BrowserList::begin();
i != BrowserList::end(); ++i) {
- Browser* browser = *i;
// Make sure the browser has tabs and a window. Browsers destructor
// removes itself from the BrowserList. When a browser is closed the
// destructor is not necessarily run immediately. This means its possible
// for us to get a handle to a browser that is about to be removed. If
// the tab count is 0 or the window is NULL, the browser is about to be
// deleted, so we ignore it.
- AppType app_type = browser->is_app() ? TYPE_APP : TYPE_NORMAL;
- if (should_track_changes_for_browser_type(browser->type(), app_type) &&
- browser->tab_count() &&
- browser->window()) {
- BuildCommandsForBrowser(browser, commands, tab_to_available_range,
+ if (should_track_changes_for_browser_type((*i)->type()) &&
+ (*i)->tab_count() && (*i)->window()) {
+ BuildCommandsForBrowser(*i, commands, tab_to_available_range,
windows_to_track);
}
}
@@ -1383,11 +1344,9 @@ bool SessionService::IsOnlyOneTabLeft() {
int window_count = 0;
for (BrowserList::const_iterator i = BrowserList::begin();
i != BrowserList::end(); ++i) {
- Browser* browser = *i;
- const SessionID::id_type window_id = browser->session_id().id();
- AppType app_type = browser->is_app() ? TYPE_APP : TYPE_NORMAL;
- if (should_track_changes_for_browser_type(browser->type(), app_type) &&
- browser->profile() == profile() &&
+ const SessionID::id_type window_id = (*i)->session_id().id();
+ if (should_track_changes_for_browser_type((*i)->type()) &&
+ (*i)->profile() == profile() &&
window_closing_ids_.find(window_id) == window_closing_ids_.end()) {
if (++window_count > 1)
return false;
@@ -1410,10 +1369,9 @@ bool SessionService::HasOpenTrackableBrowsers(const SessionID& window_id) {
i != BrowserList::end(); ++i) {
Browser* browser = *i;
const SessionID::id_type browser_id = browser->session_id().id();
- AppType app_type = browser->is_app() ? TYPE_APP : TYPE_NORMAL;
if (browser_id != window_id.id() &&
window_closing_ids_.find(browser_id) == window_closing_ids_.end() &&
- should_track_changes_for_browser_type(browser->type(), app_type) &&
+ should_track_changes_for_browser_type(browser->type()) &&
browser->profile() == profile()) {
return true;
}
@@ -1426,14 +1384,7 @@ bool SessionService::ShouldTrackChangesToWindow(const SessionID& window_id) {
}
-bool SessionService::should_track_changes_for_browser_type(Browser::Type type,
- AppType app_type) {
-#if defined(USE_AURA)
- // Restore app popups for aura alone.
- if (type == Browser::TYPE_POPUP && app_type == TYPE_APP)
- return true;
-#endif
-
+bool SessionService::should_track_changes_for_browser_type(Browser::Type type) {
return type == Browser::TYPE_TABBED ||
(type == Browser::TYPE_POPUP && browser_defaults::kRestorePopups);
}
diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h
index 4c38ec2..e6feffd 100644
--- a/chrome/browser/sessions/session_service.h
+++ b/chrome/browser/sessions/session_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -55,12 +55,6 @@ class SessionService : public BaseSessionService,
public content::NotificationObserver {
friend class SessionServiceTestHelper;
public:
- // Used to distinguish an application window from a normal one.
- enum AppType {
- TYPE_APP,
- TYPE_NORMAL
- };
-
// Creates a SessionService for the specified profile.
explicit SessionService(Profile* profile);
// For testing.
@@ -127,13 +121,7 @@ class SessionService : public BaseSessionService,
// Sets the type of window. In order for the contents of a window to be
// tracked SetWindowType must be invoked with a type we track
// (should_track_changes_for_browser_type returns true).
- void SetWindowType(const SessionID& window_id,
- Browser::Type type,
- AppType app_type);
-
- // Sets the application name of the specified window.
- void SetWindowAppName(const SessionID& window_id,
- const std::string& app_name);
+ void SetWindowType(const SessionID& window_id, Browser::Type type);
// Invoked when the NavigationController has removed entries from the back of
// the list. |count| gives the number of entries in the navigation controller.
@@ -374,9 +362,7 @@ class SessionService : public BaseSessionService,
bool ShouldTrackChangesToWindow(const SessionID& window_id);
// Returns true if we track changes to the specified browser type.
- static bool should_track_changes_for_browser_type(
- Browser::Type type,
- AppType app_type);
+ static bool should_track_changes_for_browser_type(Browser::Type type);
// Returns true if we should record a window close as pending.
// |has_open_trackable_browsers_| must be up-to-date before calling this.
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc
index e25b83b..38a1303 100644
--- a/chrome/browser/sessions/session_service_unittest.cc
+++ b/chrome/browser/sessions/session_service_unittest.cc
@@ -48,8 +48,7 @@ class SessionServiceTest : public BrowserWithTestWindowTest,
SessionService* session_service = new SessionService(path_);
helper_.set_service(session_service);
- service()->SetWindowType(
- window_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL);
+ service()->SetWindowType(window_id, Browser::TYPE_TABBED);
service()->SetWindowBounds(window_id,
window_bounds,
ui::SHOW_STATE_NORMAL);
@@ -276,8 +275,7 @@ TEST_F(SessionServiceTest, TwoWindows) {
UpdateNavigation(window_id, tab1_id, nav1, 0, true);
const gfx::Rect window2_bounds(3, 4, 5, 6);
- service()->SetWindowType(
- window2_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL);
+ service()->SetWindowType(window2_id, Browser::TYPE_TABBED);
service()->SetWindowBounds(window2_id,
window2_bounds,
ui::SHOW_STATE_MAXIMIZED);
@@ -331,8 +329,7 @@ TEST_F(SessionServiceTest, WindowWithNoTabsGetsPruned) {
UpdateNavigation(window_id, tab1_id, nav1, 0, true);
const gfx::Rect window2_bounds(3, 4, 5, 6);
- service()->SetWindowType(
- window2_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL);
+ service()->SetWindowType(window2_id, Browser::TYPE_TABBED);
service()->SetWindowBounds(window2_id,
window2_bounds,
ui::SHOW_STATE_NORMAL);
@@ -394,8 +391,7 @@ TEST_F(SessionServiceTest, WindowCloseCommittedAfterNavigate) {
SessionID tab2_id;
ASSERT_NE(window2_id.id(), window_id.id());
- service()->SetWindowType(
- window2_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL);
+ service()->SetWindowType(window2_id, Browser::TYPE_TABBED);
service()->SetWindowBounds(window2_id,
window_bounds,
ui::SHOW_STATE_NORMAL);
@@ -440,8 +436,7 @@ TEST_F(SessionServiceTest, IgnorePopups) {
SessionID tab2_id;
ASSERT_NE(window2_id.id(), window_id.id());
- service()->SetWindowType(
- window2_id, Browser::TYPE_POPUP, SessionService::TYPE_NORMAL);
+ service()->SetWindowType(window2_id, Browser::TYPE_POPUP);
service()->SetWindowBounds(window2_id,
window_bounds,
ui::SHOW_STATE_NORMAL);
@@ -482,8 +477,7 @@ TEST_F(SessionServiceTest, RestorePopup) {
SessionID tab2_id;
ASSERT_NE(window2_id.id(), window_id.id());
- service()->SetWindowType(
- window2_id, Browser::TYPE_POPUP, SessionService::TYPE_NORMAL);
+ service()->SetWindowType(window2_id, Browser::TYPE_POPUP);
service()->SetWindowBounds(window2_id,
window_bounds,
ui::SHOW_STATE_NORMAL);
@@ -525,61 +519,6 @@ TEST_F(SessionServiceTest, RestorePopup) {
helper_.AssertNavigationEquals(nav2, tab->navigations[0]);
}
-#if defined (USE_AURA)
-// Makes sure we track apps. Only applicable on aura.
-TEST_F(SessionServiceTest, RestoreApp) {
- SessionID window2_id;
- SessionID tab_id;
- SessionID tab2_id;
- ASSERT_NE(window2_id.id(), window_id.id());
-
- service()->SetWindowType(
- window2_id, Browser::TYPE_POPUP, SessionService::TYPE_APP);
- service()->SetWindowBounds(window2_id,
- window_bounds,
- ui::SHOW_STATE_NORMAL);
- service()->SetWindowAppName(window2_id, "TestApp");
-
- TabNavigation nav1(0, GURL("http://google.com"), content::Referrer(),
- ASCIIToUTF16("abc"), "def",
- content::PAGE_TRANSITION_QUALIFIER_MASK);
- TabNavigation nav2(0, GURL("http://google2.com"), content::Referrer(),
- ASCIIToUTF16("abcd"), "defg",
- content::PAGE_TRANSITION_AUTO_BOOKMARK);
-
- helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
- UpdateNavigation(window_id, tab_id, nav1, 0, true);
-
- helper_.PrepareTabInWindow(window2_id, tab2_id, 0, false);
- UpdateNavigation(window2_id, tab2_id, nav2, 0, true);
-
- ScopedVector<SessionWindow> windows;
- ReadWindows(&(windows.get()));
-
- ASSERT_EQ(2U, windows->size());
- int tabbed_index = windows[0]->type == Browser::TYPE_TABBED ?
- 0 : 1;
- int app_index = tabbed_index == 0 ? 1 : 0;
- ASSERT_EQ(0, windows[tabbed_index]->selected_tab_index);
- ASSERT_EQ(window_id.id(), windows[tabbed_index]->window_id.id());
- ASSERT_EQ(1U, windows[tabbed_index]->tabs.size());
-
- SessionTab* tab = windows[tabbed_index]->tabs[0];
- helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab);
- helper_.AssertNavigationEquals(nav1, tab->navigations[0]);
-
- ASSERT_EQ(0, windows[app_index]->selected_tab_index);
- ASSERT_EQ(window2_id.id(), windows[app_index]->window_id.id());
- ASSERT_EQ(1U, windows[app_index]->tabs.size());
- ASSERT_EQ(1U, windows[app_index]->type == Browser::TYPE_POPUP);
- ASSERT_EQ("TestApp", windows[app_index]->app_name);
-
- tab = windows[app_index]->tabs[0];
- helper_.AssertTabEquals(window2_id, tab2_id, 0, 0, 1, *tab);
- helper_.AssertNavigationEquals(nav2, tab->navigations[0]);
-}
-#endif
-
// Tests pruning from the front.
TEST_F(SessionServiceTest, PruneFromFront) {
const std::string base_url("http://google.com/");
diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h
index bd3232a7..48c80ff 100644
--- a/chrome/browser/sessions/session_types.h
+++ b/chrome/browser/sessions/session_types.h
@@ -200,8 +200,6 @@ struct SessionWindow {
// Is the window maximized, minimized, or normal?
ui::WindowShowState show_state;
- std::string app_name;
-
private:
DISALLOW_COPY_AND_ASSIGN(SessionWindow);
};
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index 380f917..fa19cf5 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -81,7 +81,6 @@ static const SessionCommand::id_type kCommandWindow = 3;
static const SessionCommand::id_type kCommandSelectedNavigationInTab = 4;
static const SessionCommand::id_type kCommandPinnedState = 5;
static const SessionCommand::id_type kCommandSetExtensionAppID = 6;
-static const SessionCommand::id_type kCommandSetWindowAppName = 7;
// Number of entries (not commands) before we clobber the file and write
// everything.
@@ -241,8 +240,6 @@ void TabRestoreService::BrowserClosing(TabRestoreServiceDelegate* delegate) {
scoped_ptr<Window> window(new Window());
window->selected_tab_index = delegate->GetSelectedIndex();
window->timestamp = TimeNow();
- window->app_name = delegate->GetAppName();
-
// Don't use std::vector::resize() because it will push copies of an empty tab
// into the vector, which will give all tabs in a window the same ID.
for (int i = 0; i < delegate->GetTabCount(); ++i) {
@@ -261,7 +258,7 @@ void TabRestoreService::BrowserClosing(TabRestoreServiceDelegate* delegate) {
entry_index++;
}
}
- if (window->tabs.size() == 1 && window->app_name.empty()) {
+ if (window->tabs.size() == 1) {
// Short-circuit creating a Window if only 1 tab was present. This fixes
// http://crbug.com/56744. Copy the Tab because it's owned by an object on
// the stack.
@@ -352,7 +349,7 @@ void TabRestoreService::RestoreEntryById(TabRestoreServiceDelegate* delegate,
// single tab within it. If the entry's ID matches the one to restore, then
// the entire window will be restored.
if (!restoring_tab_in_window) {
- delegate = TabRestoreServiceDelegate::Create(profile(), window->app_name);
+ delegate = TabRestoreServiceDelegate::Create(profile());
for (size_t tab_i = 0; tab_i < window->tabs.size(); ++tab_i) {
const Tab& tab = window->tabs[tab_i];
WebContents* restored_tab =
@@ -615,13 +612,6 @@ void TabRestoreService::ScheduleCommandsForWindow(const Window& window) {
valid_tab_count,
window.timestamp));
- if (!window.app_name.empty()) {
- ScheduleCommand(
- CreateSetWindowAppNameCommand(kCommandSetWindowAppName,
- window.id,
- window.app_name));
- }
-
for (size_t i = 0; i < window.tabs.size(); ++i) {
int selected_index = GetSelectedNavigationIndexToPersist(window.tabs[i]);
if (selected_index != -1)
@@ -896,22 +886,6 @@ void TabRestoreService::CreateEntriesFromCommands(
break;
}
- case kCommandSetWindowAppName: {
- if (!current_window) {
- // We should have created a window already.
- NOTREACHED();
- return;
- }
-
- SessionID::id_type window_id;
- std::string app_name;
- if (!RestoreSetWindowAppNameCommand(command, &window_id, &app_name))
- return;
-
- current_window->app_name.swap(app_name);
- break;
- }
-
case kCommandSetExtensionAppID: {
if (!current_tab) {
// Should be in a tab when we get this.
@@ -962,7 +936,7 @@ TabRestoreServiceDelegate* TabRestoreService::RestoreTab(
if (delegate && disposition != NEW_WINDOW) {
tab_index = tab.tabstrip_index;
} else {
- delegate = TabRestoreServiceDelegate::Create(profile(), std::string());
+ delegate = TabRestoreServiceDelegate::Create(profile());
if (tab.has_browser())
UpdateTabBrowserIDs(tab.browser_id, delegate->GetSessionID().id());
}
diff --git a/chrome/browser/sessions/tab_restore_service.h b/chrome/browser/sessions/tab_restore_service.h
index 6f3078d..c783962 100644
--- a/chrome/browser/sessions/tab_restore_service.h
+++ b/chrome/browser/sessions/tab_restore_service.h
@@ -116,9 +116,6 @@ class TabRestoreService : public BaseSessionService {
// Index of the selected tab.
int selected_tab_index;
-
- // If an application window, the name of the app.
- std::string app_name;
};
typedef std::list<Entry*> Entries;
diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc
index 75192d2..4cb97d1 100644
--- a/chrome/browser/sessions/tab_restore_service_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc
@@ -8,26 +8,18 @@
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/sessions/tab_restore_service.h"
-#include "chrome/browser/sessions/tab_restore_service_factory.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/chrome_render_view_test.h"
-#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_profile.h"
-#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
#include "content/test/render_view_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
typedef TabRestoreService::Tab Tab;
-typedef TabRestoreService::Window Window;
using content::NavigationEntry;
@@ -105,8 +97,7 @@ class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness {
SessionServiceFactory::GetForProfile(profile());
SessionID tab_id;
SessionID window_id;
- session_service->SetWindowType(
- window_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL);
+ session_service->SetWindowType(window_id, Browser::TYPE_TABBED);
session_service->SetTabWindow(window_id, tab_id);
session_service->SetTabIndexInWindow(window_id, tab_id, 0);
session_service->SetSelectedTabInWindow(window_id, 0);
@@ -258,36 +249,6 @@ TEST_F(TabRestoreServiceTest, RestorePinnedAndApp) {
EXPECT_TRUE(extension_app_id == tab->extension_app_id);
}
-// We only restore apps on chromeos.
-#if defined(OS_CHROMEOS)
-
-typedef InProcessBrowserTest TabRestoreServiceBrowserTest;
-
-IN_PROC_BROWSER_TEST_F(TabRestoreServiceBrowserTest, RestoreApp) {
- Profile* profile = browser()->profile();
- TabRestoreService* trs = TabRestoreServiceFactory::GetForProfile(profile);
- const char* app_name = "TestApp";
-
- Browser* app_browser = CreateBrowserForApp(app_name, profile);
- app_browser->window()->Close();
- ui_test_utils::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_BROWSER_CLOSED,
- content::Source<Browser>(app_browser));
- observer.Wait();
-
- // One entry should be created.
- ASSERT_EQ(1U, trs->entries().size());
- const TabRestoreService::Entry* restored_entry = trs->entries().front();
-
- // It should be a window with an app.
- ASSERT_EQ(TabRestoreService::WINDOW, restored_entry->type);
- const Window* restored_window =
- static_cast<const Window*>(restored_entry);
- EXPECT_EQ(app_name, restored_window->app_name);
-
-}
-#endif
-
// Make sure we persist entries to disk that have post data.
TEST_F(TabRestoreServiceTest, DontPersistPostData) {
AddThreeNavigations();
diff --git a/chrome/browser/sessions/tab_restore_service_delegate.h b/chrome/browser/sessions/tab_restore_service_delegate.h
index 5c7182f..adf0eda 100644
--- a/chrome/browser/sessions/tab_restore_service_delegate.h
+++ b/chrome/browser/sessions/tab_restore_service_delegate.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -36,9 +36,6 @@ class TabRestoreServiceDelegate {
// see Browser::active_index()
virtual int GetSelectedIndex() const = 0;
- // see Browser::app_name()
- virtual std::string GetAppName() const = 0;
-
// see Browser methods with the same names
virtual content::WebContents* GetWebContentsAt(int index) const = 0;
virtual content::WebContents* GetSelectedWebContents() const = 0;
@@ -61,8 +58,7 @@ class TabRestoreServiceDelegate {
virtual void CloseTab() = 0;
// see Browser::Create
- static TabRestoreServiceDelegate* Create(Profile* profile,
- const std::string& app_name);
+ static TabRestoreServiceDelegate* Create(Profile* profile);
// see BrowserList::GetBrowserForController
static TabRestoreServiceDelegate* FindDelegateForController(