summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 18:35:06 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 18:35:06 +0000
commit92926d9fd44a3aa9473afd15ce8b5c6f7f7d192c (patch)
tree419b2a4640e48dfbe0880abcd50d8230849c561e /chrome
parent23b0a94cb3cdf3154e05efb68ad21225859f451a (diff)
downloadchromium_src-92926d9fd44a3aa9473afd15ce8b5c6f7f7d192c.zip
chromium_src-92926d9fd44a3aa9473afd15ce8b5c6f7f7d192c.tar.gz
chromium_src-92926d9fd44a3aa9473afd15ce8b5c6f7f7d192c.tar.bz2
FBTF: Reaplly the TabRestoreService::Observer into its own file commit.
This means browser.h no longer includes a large chunk of the tab restore system. Now with fixes to chromeos. BUG=none TEST=compiles First Review URL: http://codereview.chromium.org/3296003 Review URL: http://codereview.chromium.org/3358005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc1
-rw-r--r--chrome/browser/browser.cc1
-rw-r--r--chrome/browser/browser.h7
-rw-r--r--chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc1
-rw-r--r--chrome/browser/cocoa/history_menu_bridge.h22
-rw-r--r--chrome/browser/cocoa/history_menu_bridge.mm17
-rw-r--r--chrome/browser/cocoa/view_id_util_browsertest.mm1
-rw-r--r--chrome/browser/dom_ui/mediaplayer_browsertest.cc1
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc5
-rw-r--r--chrome/browser/download/download_manager.cc1
-rw-r--r--chrome/browser/extensions/execute_code_in_tab_function.cc1
-rw-r--r--chrome/browser/extensions/extension_context_menu_browsertest.cc1
-rw-r--r--chrome/browser/extensions/extension_management_api.cc1
-rw-r--r--chrome/browser/extensions/extension_proxy_apitest.cc1
-rw-r--r--chrome/browser/jumplist_win.h5
-rw-r--r--chrome/browser/sessions/session_backend.cc4
-rw-r--r--chrome/browser/sessions/session_backend.h7
-rw-r--r--chrome/browser/sessions/session_types.cc56
-rw-r--r--chrome/browser/sessions/session_types.h25
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc11
-rw-r--r--chrome/browser/sessions/tab_restore_service.h22
-rw-r--r--chrome/browser/sessions/tab_restore_service_observer.h25
-rw-r--r--chrome/browser/views/location_bar/location_bar_view.cc1
23 files changed, 153 insertions, 64 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index a8ef344b..b5cb004 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/find_bar.h"
#include "chrome/browser/location_bar.h"
#include "chrome/browser/login_prompt.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/renderer_host/render_process_host.h"
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 9e3beea..6c4385b 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -70,6 +70,7 @@
#include "chrome/browser/service/service_process_control_manager.h"
#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/status_bubble.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_ui_util.h"
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index e2c9c36..3637871 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -14,11 +14,12 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/scoped_ptr.h"
+#include "base/task.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/debugger/devtools_toggle_action.h"
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/sessions/session_id.h"
-#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/browser/sync/profile_sync_service_observer.h"
#include "chrome/browser/tabs/tab_strip_model.h"
@@ -50,7 +51,7 @@ class Browser : public TabStripModelDelegate,
public CommandUpdater::CommandUpdaterDelegate,
public NotificationObserver,
public SelectFileDialog::Listener,
- public TabRestoreService::Observer,
+ public TabRestoreServiceObserver,
public ProfileSyncServiceObserver {
public:
// If you change the values in this enum you'll need to update browser_proxy.
@@ -619,7 +620,7 @@ class Browser : public TabStripModelDelegate,
// Helper function to run unload listeners on a TabContents.
static bool RunUnloadEventsHelper(TabContents* contents);
- // TabRestoreService::Observer ///////////////////////////////////////////////
+ // TabRestoreServiceObserver /////////////////////////////////////////////////
virtual void TabRestoreServiceChanged(TabRestoreService* service);
virtual void TabRestoreServiceDestroyed(TabRestoreService* service);
diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc
index 517aad9..444a1f9 100644
--- a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc
+++ b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/in_process_browser_test.h"
diff --git a/chrome/browser/cocoa/history_menu_bridge.h b/chrome/browser/cocoa/history_menu_bridge.h
index 55dab4d..2743752 100644
--- a/chrome/browser/cocoa/history_menu_bridge.h
+++ b/chrome/browser/cocoa/history_menu_bridge.h
@@ -16,6 +16,7 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/common/notification_observer.h"
class NavigationEntry;
@@ -23,6 +24,7 @@ class NotificationRegistrar;
class PageUsageData;
class Profile;
class TabNavigationEntry;
+class TabRestoreService;
@class HistoryMenuCocoaController;
namespace {
@@ -54,26 +56,16 @@ class HistoryMenuBridgeTest;
// controller is very thin and only exists to interact with Cocoa, but this
// class does the bulk of the work.
class HistoryMenuBridge : public NotificationObserver,
- public TabRestoreService::Observer {
+ public TabRestoreServiceObserver {
public:
// This is a generalization of the data we store in the history menu because
// we pull things from different sources with different data types.
struct HistoryItem {
public:
- HistoryItem()
- : icon_requested(false),
- menu_item(nil),
- session_id(0) {}
-
+ HistoryItem();
// Copy constructor allowed.
- HistoryItem(const HistoryItem& copy)
- : title(copy.title),
- url(copy.url),
- icon_requested(false),
- menu_item(nil),
- session_id(copy.session_id) {}
-
- ~HistoryItem() {}
+ HistoryItem(const HistoryItem& copy);
+ ~HistoryItem();
// The title for the menu item.
string16 title;
@@ -136,7 +128,7 @@ class HistoryMenuBridge : public NotificationObserver,
const NotificationSource& source,
const NotificationDetails& details);
- // For TabRestoreService::Observer
+ // For TabRestoreServiceObserver
virtual void TabRestoreServiceChanged(TabRestoreService* service);
virtual void TabRestoreServiceDestroyed(TabRestoreService* service);
diff --git a/chrome/browser/cocoa/history_menu_bridge.mm b/chrome/browser/cocoa/history_menu_bridge.mm
index d75043e..10e1bc2 100644
--- a/chrome/browser/cocoa/history_menu_bridge.mm
+++ b/chrome/browser/cocoa/history_menu_bridge.mm
@@ -46,6 +46,23 @@ const unsigned int kRecentlyClosedCount = 10;
} // namespace
+HistoryMenuBridge::HistoryItem::HistoryItem()
+ : icon_requested(false),
+ menu_item(nil),
+ session_id(0) {
+}
+
+HistoryMenuBridge::HistoryItem::HistoryItem(const HistoryItem& copy)
+ : title(copy.title),
+ url(copy.url),
+ icon_requested(false),
+ menu_item(nil),
+ session_id(copy.session_id) {
+}
+
+HistoryMenuBridge::HistoryItem::~HistoryItem() {
+}
+
HistoryMenuBridge::HistoryMenuBridge(Profile* profile)
: controller_([[HistoryMenuCocoaController alloc] initWithBridge:this]),
profile_(profile),
diff --git a/chrome/browser/cocoa/view_id_util_browsertest.mm b/chrome/browser/cocoa/view_id_util_browsertest.mm
index f6fa0c3..94e3aa4 100644
--- a/chrome/browser/cocoa/view_id_util_browsertest.mm
+++ b/chrome/browser/cocoa/view_id_util_browsertest.mm
@@ -11,6 +11,7 @@
#include "chrome/browser/cocoa/view_id_util.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/sidebar/sidebar_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
diff --git a/chrome/browser/dom_ui/mediaplayer_browsertest.cc b/chrome/browser/dom_ui/mediaplayer_browsertest.cc
index bde6409..1dcbfae 100644
--- a/chrome/browser/dom_ui/mediaplayer_browsertest.cc
+++ b/chrome/browser/dom_ui/mediaplayer_browsertest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/dom_ui/mediaplayer_ui.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 5b4d28e..1183a4e 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
@@ -120,7 +121,7 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
// RecentlyClosedTabsHandler
class RecentlyClosedTabsHandler : public DOMMessageHandler,
- public TabRestoreService::Observer {
+ public TabRestoreServiceObserver {
public:
RecentlyClosedTabsHandler() : tab_restore_service_(NULL) {}
virtual ~RecentlyClosedTabsHandler();
@@ -136,7 +137,7 @@ class RecentlyClosedTabsHandler : public DOMMessageHandler,
// Callback for the "getRecentlyClosedTabs" message.
void HandleGetRecentlyClosedTabs(const ListValue* args);
- // Observer callback for TabRestoreService::Observer. Sends data on
+ // Observer callback for TabRestoreServiceObserver. Sends data on
// recently closed tabs to the javascript side of this page to
// display to the user.
virtual void TabRestoreServiceChanged(TabRestoreService* service);
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 266767b..2283b32 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "base/rand_util.h"
+#include "base/stl_util-inl.h"
#include "base/sys_string_conversions.h"
#include "base/task.h"
#include "base/utf_string_conversions.h"
diff --git a/chrome/browser/extensions/execute_code_in_tab_function.cc b/chrome/browser/extensions/execute_code_in_tab_function.cc
index 5debd9a..52f519d 100644
--- a/chrome/browser/extensions/execute_code_in_tab_function.cc
+++ b/chrome/browser/extensions/execute_code_in_tab_function.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/extensions/file_reader.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc
index 65f0ed1..b176c57 100644
--- a/chrome/browser/extensions/extension_context_menu_browsertest.cc
+++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/extensions_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc
index ba5eab3..27caab3 100644
--- a/chrome/browser/extensions/extension_management_api.cc
+++ b/chrome/browser/extensions/extension_management_api.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/extensions/extension_event_names.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/extensions/extensions_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/common/extensions/extension_error_utils.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
diff --git a/chrome/browser/extensions/extension_proxy_apitest.cc b/chrome/browser/extensions/extension_proxy_apitest.cc
index 4f23236..c315bf2 100644
--- a/chrome/browser/extensions/extension_proxy_apitest.cc
+++ b/chrome/browser/extensions/extension_proxy_apitest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/pref_names.h"
diff --git a/chrome/browser/jumplist_win.h b/chrome/browser/jumplist_win.h
index e85735d..58146d0 100644
--- a/chrome/browser/jumplist_win.h
+++ b/chrome/browser/jumplist_win.h
@@ -15,6 +15,7 @@
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/sessions/tab_restore_service_observer.h"
class FilePath;
class Profile;
@@ -91,7 +92,7 @@ typedef std::vector<scoped_refptr<ShellLinkItem> > ShellLinkItemList;
// * Creatng COM objects used by JumpList from PageUsageData objects;
// * Adding COM objects to JumpList, etc.
//
-// This class also implements TabRestoreService::Observer. So, once we call
+// This class also implements TabRestoreServiceObserver. So, once we call
// AddObserver() and register this class as an observer, it automatically
// updates a JumpList when a tab is added or removed.
//
@@ -99,7 +100,7 @@ typedef std::vector<scoped_refptr<ShellLinkItem> > ShellLinkItemList;
// update it in a UI thread. To solve this problem, this class posts a
// task when it actually updates a JumpList. (This task is implemented in an
// anomynous namespace in "jumplist_win.cc".)
-class JumpList : public TabRestoreService::Observer {
+class JumpList : public TabRestoreServiceObserver {
public:
JumpList();
~JumpList();
diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc
index c06f811..342c1f0 100644
--- a/chrome/browser/sessions/session_backend.cc
+++ b/chrome/browser/sessions/session_backend.cc
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "base/histogram.h"
#include "base/scoped_vector.h"
+#include "net/base/file_stream.h"
using base::TimeTicks;
@@ -335,6 +336,9 @@ bool SessionBackend::AppendCommandsToFile(net::FileStream* file,
return true;
}
+SessionBackend::~SessionBackend() {
+}
+
void SessionBackend::ResetFile() {
DCHECK(inited_);
if (current_session_file_.get()) {
diff --git a/chrome/browser/sessions/session_backend.h b/chrome/browser/sessions/session_backend.h
index 523ef58..883a58f 100644
--- a/chrome/browser/sessions/session_backend.h
+++ b/chrome/browser/sessions/session_backend.h
@@ -12,7 +12,10 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/sessions/base_session_service.h"
#include "chrome/browser/sessions/session_command.h"
-#include "net/base/file_stream.h"
+
+namespace net {
+class FileStream;
+}
// SessionBackend -------------------------------------------------------------
@@ -93,7 +96,7 @@ class SessionBackend : public base::RefCountedThreadSafe<SessionBackend> {
private:
friend class base::RefCountedThreadSafe<SessionBackend>;
- ~SessionBackend() {}
+ ~SessionBackend();
// If current_session_file_ is open, it is truncated so that it is essentially
// empty (only contains the header). If current_session_file_ isn't open, it
diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc
index cdf77f6..995a9a2 100644
--- a/chrome/browser/sessions/session_types.cc
+++ b/chrome/browser/sessions/session_types.cc
@@ -11,6 +11,51 @@
// TabNavigation --------------------------------------------------------------
+TabNavigation::TabNavigation()
+ : transition_(PageTransition::TYPED),
+ type_mask_(0),
+ index_(-1) {
+}
+
+TabNavigation::TabNavigation(int index,
+ const GURL& virtual_url,
+ const GURL& referrer,
+ const string16& title,
+ const std::string& state,
+ PageTransition::Type transition)
+ : virtual_url_(virtual_url),
+ referrer_(referrer),
+ title_(title),
+ state_(state),
+ transition_(transition),
+ type_mask_(0),
+ index_(index) {
+}
+
+TabNavigation::TabNavigation(const TabNavigation& tab)
+ : virtual_url_(tab.virtual_url_),
+ referrer_(tab.referrer_),
+ title_(tab.title_),
+ state_(tab.state_),
+ transition_(tab.transition_),
+ type_mask_(tab.type_mask_),
+ index_(tab.index_) {
+}
+
+TabNavigation::~TabNavigation() {
+}
+
+TabNavigation& TabNavigation::operator=(const TabNavigation& tab) {
+ virtual_url_ = tab.virtual_url_;
+ referrer_ = tab.referrer_;
+ title_ = tab.title_;
+ state_ = tab.state_;
+ transition_ = tab.transition_;
+ type_mask_ = tab.type_mask_;
+ index_ = tab.index_;
+ return *this;
+}
+
// static
NavigationEntry* TabNavigation::ToNavigationEntry(int page_id,
Profile *profile) const {
@@ -39,6 +84,17 @@ void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) {
type_mask_ = entry.has_post_data() ? TabNavigation::HAS_POST_DATA : 0;
}
+// SessionTab -----------------------------------------------------------------
+
+SessionTab::SessionTab()
+ : tab_visual_index(-1),
+ current_navigation_index(-1),
+ pinned(false) {
+}
+
+SessionTab::~SessionTab() {
+}
+
// SessionWindow ---------------------------------------------------------------
SessionWindow::SessionWindow()
diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h
index 07dbae4..119392a 100644
--- a/chrome/browser/sessions/session_types.h
+++ b/chrome/browser/sessions/session_types.h
@@ -31,25 +31,16 @@ class TabNavigation {
HAS_POST_DATA = 1
};
- TabNavigation()
- : transition_(PageTransition::TYPED),
- type_mask_(0),
- index_(-1) {
- }
-
+ TabNavigation();
TabNavigation(int index,
const GURL& virtual_url,
const GURL& referrer,
const string16& title,
const std::string& state,
- PageTransition::Type transition)
- : virtual_url_(virtual_url),
- referrer_(referrer),
- title_(title),
- state_(state),
- transition_(transition),
- type_mask_(0),
- index_(index) {}
+ PageTransition::Type transition);
+ TabNavigation(const TabNavigation& tab);
+ ~TabNavigation();
+ TabNavigation& operator=(const TabNavigation& tab);
// Converts this TabNavigation into a NavigationEntry with a page id of
// |page_id|. The caller owns the returned NavigationEntry.
@@ -107,10 +98,8 @@ class TabNavigation {
// SessionTab corresponds to a NavigationController.
struct SessionTab {
- SessionTab()
- : tab_visual_index(-1),
- current_navigation_index(-1),
- pinned(false) { }
+ SessionTab();
+ ~SessionTab();
// Unique id of the window.
SessionID window_id;
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index 116f819..c62312a 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_command.h"
#include "chrome/browser/sessions/session_types.h"
+#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -182,17 +183,18 @@ TabRestoreService::~TabRestoreService() {
if (backend())
Save();
- FOR_EACH_OBSERVER(Observer, observer_list_, TabRestoreServiceDestroyed(this));
+ FOR_EACH_OBSERVER(TabRestoreServiceObserver, observer_list_,
+ TabRestoreServiceDestroyed(this));
STLDeleteElements(&entries_);
STLDeleteElements(&staging_entries_);
time_factory_ = NULL;
}
-void TabRestoreService::AddObserver(Observer* observer) {
+void TabRestoreService::AddObserver(TabRestoreServiceObserver* observer) {
observer_list_.AddObserver(observer);
}
-void TabRestoreService::RemoveObserver(Observer* observer) {
+void TabRestoreService::RemoveObserver(TabRestoreServiceObserver* observer) {
observer_list_.RemoveObserver(observer);
}
@@ -484,7 +486,8 @@ void TabRestoreService::PopulateTab(Tab* tab,
}
void TabRestoreService::NotifyTabsChanged() {
- FOR_EACH_OBSERVER(Observer, observer_list_, TabRestoreServiceChanged(this));
+ FOR_EACH_OBSERVER(TabRestoreServiceObserver, observer_list_,
+ TabRestoreServiceChanged(this));
}
void TabRestoreService::AddEntry(Entry* entry, bool notify, bool to_front) {
diff --git a/chrome/browser/sessions/tab_restore_service.h b/chrome/browser/sessions/tab_restore_service.h
index e12b9d1..2f9a237 100644
--- a/chrome/browser/sessions/tab_restore_service.h
+++ b/chrome/browser/sessions/tab_restore_service.h
@@ -20,6 +20,7 @@ class Browser;
class NavigationController;
class Profile;
struct SessionWindow;
+class TabRestoreServiceObserver;
// TabRestoreService is responsible for maintaining the most recently closed
// tabs and windows. When a tab is closed
@@ -34,21 +35,6 @@ struct SessionWindow;
// add an observer.
class TabRestoreService : public BaseSessionService {
public:
- // Observer is notified when the set of entries managed by TabRestoreService
- // changes in some way.
- class Observer {
- public:
- // Sent when the set of entries changes in some way.
- virtual void TabRestoreServiceChanged(TabRestoreService* service) = 0;
-
- // Sent to all remaining Observers when TabRestoreService's
- // destructor is run.
- virtual void TabRestoreServiceDestroyed(TabRestoreService* service) = 0;
-
- protected:
- virtual ~Observer() {}
- };
-
// Interface used to allow the test to provide a custom time.
class TimeFactory {
public:
@@ -132,8 +118,8 @@ class TabRestoreService : public BaseSessionService {
// Adds/removes an observer. TabRestoreService does not take ownership of
// the observer.
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
+ void AddObserver(TabRestoreServiceObserver* observer);
+ void RemoveObserver(TabRestoreServiceObserver* observer);
// Creates a Tab to represent |tab| and notifies observers the list of
// entries has changed.
@@ -328,7 +314,7 @@ class TabRestoreService : public BaseSessionService {
// Number of entries we've written.
int entries_written_;
- ObserverList<Observer> observer_list_;
+ ObserverList<TabRestoreServiceObserver> observer_list_;
// Set of tabs that we've received a BrowserClosing method for but no
// corresponding BrowserClosed. We cache the set of browsers closing to
diff --git a/chrome/browser/sessions/tab_restore_service_observer.h b/chrome/browser/sessions/tab_restore_service_observer.h
new file mode 100644
index 0000000..e4d21184
--- /dev/null
+++ b/chrome/browser/sessions/tab_restore_service_observer.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_OBSERVER_H_
+#define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_OBSERVER_H_
+
+class TabRestoreService;
+
+// Observer is notified when the set of entries managed by TabRestoreService
+// changes in some way.
+class TabRestoreServiceObserver {
+ public:
+ // Sent when the set of entries changes in some way.
+ virtual void TabRestoreServiceChanged(TabRestoreService* service) = 0;
+
+ // Sent to all remaining Observers when TabRestoreService's
+ // destructor is run.
+ virtual void TabRestoreServiceDestroyed(TabRestoreService* service) = 0;
+
+ protected:
+ virtual ~TabRestoreServiceObserver() {}
+};
+
+#endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_OBSERVER_H_
diff --git a/chrome/browser/views/location_bar/location_bar_view.cc b/chrome/browser/views/location_bar/location_bar_view.cc
index 97b9f2a..9cf40a1 100644
--- a/chrome/browser/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/views/location_bar/location_bar_view.cc
@@ -12,6 +12,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "app/theme_provider.h"
+#include "base/stl_util-inl.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/alternate_nav_url_fetcher.h"