diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 22:10:17 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 22:10:17 +0000 |
commit | ecd9d87092866d04c00b5695ac56f0a026a6a2c8 (patch) | |
tree | 8af05cf2b9c524db3d40a7007ed5ec137a820d12 /chrome/browser/views/info_bar_view.h | |
parent | 7ea9cbb1f61ea1b6990011d076bc09c05b9e72e8 (diff) | |
download | chromium_src-ecd9d87092866d04c00b5695ac56f0a026a6a2c8.zip chromium_src-ecd9d87092866d04c00b5695ac56f0a026a6a2c8.tar.gz chromium_src-ecd9d87092866d04c00b5695ac56f0a026a6a2c8.tar.bz2 |
Make a step on refactoring navigation. The eventual plan is to have the NavigationController create and commit the new NavigationEntries (currently WebContents does a bunch of the details of this which is hard to understand and not easily testable).
This tries to consolidate the logic that I want to move to the NavigationController without actually moving it there yet. I removed all of the "PreCommit" functions in WebContents, since when the NavigationController does
all of the committing, there won't be a phase where the NavigationEntry exists but isn't committed.
Most of the logic could be moved to the PostCommit functions without any problem, which is an indication that the current design was busted anyway. I had to precompute some data and pass it to the *PostCommit function to work around some of the components that required old data. I had to change InfoBars around since it relied on having both the committed and uncommitted entries, but I think the new design is much better anyway.
BUG=1343593,1343146
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/info_bar_view.h')
-rw-r--r-- | chrome/browser/views/info_bar_view.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/chrome/browser/views/info_bar_view.h b/chrome/browser/views/info_bar_view.h index 8234c0a..0ff9b94 100644 --- a/chrome/browser/views/info_bar_view.h +++ b/chrome/browser/views/info_bar_view.h @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_VIEWS_INFO_BAR_VIEW_H__ -#define CHROME_BROWSER_VIEWS_INFO_BAR_VIEW_H__ +#ifndef CHROME_BROWSER_VIEWS_INFO_BAR_VIEW_H_ +#define CHROME_BROWSER_VIEWS_INFO_BAR_VIEW_H_ #include <map> +#include "chrome/common/notification_service.h" #include "chrome/views/view.h" class NavigationEntry; @@ -16,7 +17,8 @@ class WebContents; // // It will paint all of its children vertically, with the most recently // added child displayed at the top of the info bar. -class InfoBarView : public ChromeViews::View { +class InfoBarView : public ChromeViews::View, + public NotificationObserver { public: explicit InfoBarView(WebContents* web_contents); @@ -42,12 +44,6 @@ class InfoBarView : public ChromeViews::View { virtual void DidChangeBounds(const CRect& previous, const CRect& current); - // Notification that the user has done a navigation. Removes child views that - // are set to be removed after a certain number of navigations and - // potentially hides the info bar. |entry| is the new entry that we are - // navigating to. - void DidNavigate(NavigationEntry* entry); - WebContents* web_contents() { return web_contents_; } protected: @@ -74,14 +70,19 @@ class InfoBarView : public ChromeViews::View { ChromeViews::View* v1, ChromeViews::View* v2); + // NotificationObserver implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + WebContents* web_contents_; // Map from view to number of navigations before it is removed. If a child // doesn't have an entry in here, it is NOT removed on navigations. std::map<View*,int> expire_map_; - DISALLOW_EVIL_CONSTRUCTORS(InfoBarView); + DISALLOW_COPY_AND_ASSIGN(InfoBarView); }; -#endif // CHROME_BROWSER_VIEWS_INFO_BAR_VIEW_H__ +#endif // CHROME_BROWSER_VIEWS_INFO_BAR_VIEW_H_ |