summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 17:46:17 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 17:46:17 +0000
commit00d8cf0a2a9435c64e2421d761cec2ff32baefc5 (patch)
treea5193f56be9088f3053ffdca69dfc103b97848c3
parent621adaae105bee50e90d58accbe4d52f6bd8139c (diff)
downloadchromium_src-00d8cf0a2a9435c64e2421d761cec2ff32baefc5.zip
chromium_src-00d8cf0a2a9435c64e2421d761cec2ff32baefc5.tar.gz
chromium_src-00d8cf0a2a9435c64e2421d761cec2ff32baefc5.tar.bz2
Another Frame Grab-Bag
- makes more stuff in Browser object only happen if you're using the old frames- rename BrowserWindow::Update to BrowserWindow::UpdateToolbar since that's what it does - add window position save/restore handling to Browser- remove BrowserWindow::BrowserDidPaint - relic from HaloFrame days- remove BrowserWindow::GetRootView - unused and exposes impl details- remove BrowserWindow::DetachFromBrowser - unused - store BrowserView2* on HWND's property list so infobubbles can access it later- both frames (Opaque and AeroGlass) notify the BrowserView2 when they're moved so BrowserView2 can reposition the status bubble and close the autocomplete popup - remove BrowserView2::ShowTabContents - no longer used - remove BrowserView2::ShelfVisibilityChanged - no longer used - remove BrowserView2::SetWindowTitle - never used - remove BrowserView2::ProfileChanged - now called from TabSelectedAt- properly unhook infobars etc when a tab is detached B=1031854 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@660 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc81
-rw-r--r--chrome/browser/browser.h6
-rw-r--r--chrome/browser/browser_window.h35
-rw-r--r--chrome/browser/frame_util.cc30
-rw-r--r--chrome/browser/views/constrained_window_impl.cc3
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.cc8
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.h2
-rw-r--r--chrome/browser/views/frame/browser_view.cc15
-rw-r--r--chrome/browser/views/frame/browser_view.h5
-rw-r--r--chrome/browser/views/frame/browser_view2.cc129
-rw-r--r--chrome/browser/views/frame/browser_view2.h24
-rw-r--r--chrome/browser/views/frame/opaque_frame.cc8
-rw-r--r--chrome/browser/views/frame/opaque_frame.h3
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc11
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.h7
-rw-r--r--chrome/browser/vista_frame.cc13
-rw-r--r--chrome/browser/vista_frame.h7
-rw-r--r--chrome/browser/xp_frame.cc14
-rw-r--r--chrome/browser/xp_frame.h7
-rw-r--r--chrome/views/hwnd_view_container.h2
20 files changed, 209 insertions, 201 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 866b2a5..3ebf41d 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -249,9 +249,11 @@ Browser::Browser(const gfx::Rect& initial_bounds,
if (!parsed_command_line.HasSwitch(switches::kDisableHangMonitor))
InitHangMonitor();
- NotificationService::current()->
- AddObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources());
+ if (!g_browser_process->IsUsingNewFrames()) {
+ NotificationService::current()->
+ AddObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
+ NotificationService::AllSources());
+ }
if (profile->HasSessionService()) {
SessionService* session_service = profile->GetSessionService();
@@ -300,9 +302,11 @@ Browser::~Browser() {
if (session_service)
session_service->WindowClosed(session_id_);
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources());
+ if (!g_browser_process->IsUsingNewFrames()) {
+ NotificationService::current()->
+ RemoveObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
+ NotificationService::AllSources());
+ }
// Stop hung plugin monitoring.
ticker_.Stop();
@@ -375,6 +379,8 @@ GURL Browser::GetHomePage() {
////////////////////////////////////////////////////////////////////////////////
void Browser::SyncWindowTitle() {
+ DCHECK(!g_browser_process->IsUsingNewFrames());
+
TabContents* current_tab = GetSelectedTabContents();
if (!current_tab || current_tab->GetTitle().empty()) {
window_->SetWindowTitle(l10n_util::GetString(IDS_PRODUCT_NAME));
@@ -405,7 +411,7 @@ LocationBarView* Browser::GetLocationBarView() const {
// Chrome update coalescing
void Browser::UpdateToolBar(bool should_restore_state) {
- window_->Update(GetSelectedTabContents(), should_restore_state);
+ window_->UpdateToolbar(GetSelectedTabContents(), should_restore_state);
}
void Browser::ScheduleUIUpdate(const TabContents* source,
@@ -492,8 +498,10 @@ void Browser::ProcessPendingUIUpdates() {
// Updating the URL happens synchronously in ScheduleUIUpdate.
- if (flags & TabContents::INVALIDATE_TITLE)
+ if (flags & TabContents::INVALIDATE_TITLE &&
+ !g_browser_process->IsUsingNewFrames()) {
SyncWindowTitle(); // We'll update the tab due to invalide_tab below.
+ }
if (flags & TabContents::INVALIDATE_LOAD)
GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText());
@@ -825,6 +833,7 @@ void Browser::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
if (type == NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) {
+ DCHECK(!g_browser_process->IsUsingNewFrames());
TabContents* current_tab = GetSelectedTabContents();
if (current_tab) {
Profile* event_profile = Source<Profile>(source).ptr();
@@ -908,6 +917,7 @@ StatusBubble* Browser::GetStatusBubble() {
// of any WS_POPUP HWNDs.
// TODO(beng): This should move to BrowserView2!
void Browser::WindowMoved() {
+ DCHECK(!g_browser_process->IsUsingNewFrames());
GetStatusBubble()->Reposition();
// Close the omnibox popup, if any.
@@ -1400,11 +1410,13 @@ void Browser::TabClosingAt(TabContents* contents, int index) {
}
void Browser::TabDetachedAt(TabContents* contents, int index) {
- // TODO(beng): (http://b/1085418) figure out if we really need to do this
- // here - surely the subsequent selection of another tab would
- // result in this action taking place?
- if (contents == GetSelectedTabContents())
- RemoveShelvesForTabContents(contents);
+ if (!g_browser_process->IsUsingNewFrames()) {
+ // TODO(beng): (http://b/1085418) figure out if we really need to do this
+ // here - surely the subsequent selection of another tab would
+ // result in this action taking place?
+ if (contents == GetSelectedTabContents())
+ RemoveShelvesForTabContents(contents);
+ }
contents->set_delegate(NULL);
if (!tabstrip_model_.closing_all())
@@ -1451,7 +1463,8 @@ void Browser::TabSelectedAt(TabContents* old_contents,
}
// Propagate the profile to the location bar.
- window_->ProfileChanged(new_contents->profile());
+ if (!g_browser_process->IsUsingNewFrames())
+ window_->ProfileChanged(new_contents->profile());
UpdateToolBar(true);
// Force the go/stop button to change.
@@ -1471,7 +1484,8 @@ void Browser::TabSelectedAt(TabContents* old_contents,
// Show the loading state (if any).
GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText());
- SyncWindowTitle();
+ if (!g_browser_process->IsUsingNewFrames())
+ SyncWindowTitle();
// Update sessions. Don't force creation of sessions. If sessions doesn't
// exist, the change will be picked up by sessions when created.
@@ -1512,6 +1526,8 @@ void Browser::TabStripEmpty() {
}
void Browser::RemoveShelvesForTabContents(TabContents* contents) {
+ DCHECK(!g_browser_process->IsUsingNewFrames());
+
ChromeViews::View* shelf = contents->GetDownloadShelfView();
if (shelf && shelf->GetParent() != NULL)
shelf->GetParent()->RemoveChildView(shelf);
@@ -1767,6 +1783,41 @@ NavigationController* Browser::GetSelectedNavigationController() const {
// NEW FRAME TODO(beng): clean up this file
// DO NOT PLACE METHODS NOT RELATED TO NEW FRAMES BELOW THIS LINE.
+void Browser::SaveWindowPosition(const gfx::Rect& bounds, bool maximized) {
+ // First save to local state, this is for remembering on subsequent starts.
+ PrefService* prefs = g_browser_process->local_state();
+ DCHECK(prefs);
+ std::wstring name(prefs::kBrowserWindowPlacement);
+ if (!app_name_.empty()) {
+ name.append(L"_");
+ name.append(app_name_);
+ }
+
+ DictionaryValue* win_pref = prefs->GetMutableDictionary(name.c_str());
+ DCHECK(win_pref);
+ win_pref->SetInteger(L"top", bounds.y());
+ win_pref->SetInteger(L"left", bounds.x());
+ win_pref->SetInteger(L"bottom", bounds.bottom());
+ win_pref->SetInteger(L"right", bounds.right());
+ win_pref->SetBoolean(L"maximized", maximized);
+
+ // Then save to the session storage service, used when reloading a past
+ // session. Note that we don't want to be the ones who cause lazy
+ // initialization of the session service. This function gets called during
+ // initial window showing, and we don't want to bring in the session service
+ // this early.
+ if (profile()->HasSessionService()) {
+ SessionService* session_service = profile()->GetSessionService();
+ if (session_service)
+ session_service->SetWindowBounds(session_id_, bounds, maximized);
+ }
+}
+
+void Browser::RestoreWindowPosition(gfx::Rect* bounds, bool* maximized) {
+ DCHECK(bounds && maximized);
+ WindowSizer::GetBrowserWindowBounds(app_name_, *bounds, bounds, maximized);
+}
+
SkBitmap Browser::GetCurrentPageIcon() const {
TabContents* contents = tabstrip_model_.GetSelectedTabContents();
return contents ? contents->GetFavIcon() : SkBitmap();
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 3af7051..42018257 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -384,6 +384,10 @@ class Browser : public TabStripModelDelegate,
// NEW FRAME METHODS BELOW THIS LINE ONLY... TODO(beng): clean up this file!
+ // Save and restore the window position.
+ void SaveWindowPosition(const gfx::Rect& bounds, bool maximized);
+ void RestoreWindowPosition(gfx::Rect* bounds, bool* maximized);
+
// Gets the FavIcon of the page in the selected tab.
SkBitmap GetCurrentPageIcon() const;
@@ -432,6 +436,7 @@ class Browser : public TabStripModelDelegate,
// Returns the StatusBubble from the current toolbar. It is possible for
// this to return NULL if called before the toolbar has initialized.
+ // TODO(beng): remove this.
StatusBubble* GetStatusBubble();
// Syncs the window title with current_tab_. This may be necessary because
@@ -490,6 +495,7 @@ class Browser : public TabStripModelDelegate,
// Removes the InfoBar and download shelf for the specified TabContents, if
// they are presently attached.
+ // TODO(beng): REMOVE
void RemoveShelvesForTabContents(TabContents* contents);
// Copy the current page URL to the clipboard.
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index 4e011f6..c450562 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -67,13 +67,6 @@ class BrowserWindow {
// default screen.
virtual void Show(int command, bool adjust_to_fit) = 0;
- // TODO(beng): REMOVE
- // Invoked by the browser when painting occurred. This is called as a
- // result of calling Browser::Paint()
- // TODO(ACW) We really need a cross platform region class to replace
- // HRGN in our APIs
- virtual void BrowserDidPaint(HRGN region) = 0;
-
// Closes the frame as soon as possible. If the frame is not in a drag
// session, it will close immediately; otherwise, it will move offscreen (so
// events are still fired) until the drag ends, then close.
@@ -81,6 +74,8 @@ class BrowserWindow {
// Return a platform dependent identifier for this frame. On Windows, this
// returns an HWND.
+ // TODO(beng): This should go away. The Browser object and friends should not
+ // be interacting with platform types.
virtual void* GetPlatformID() = 0;
// TODO(beng): REMOVE (obtain via BrowserFrame).
@@ -90,12 +85,10 @@ class BrowserWindow {
// Return the status bubble associated with the frame
virtual StatusBubble* GetStatusBubble() = 0;
- // Return the RootView associated with the frame.
- virtual ChromeViews::RootView* GetRootView() = 0;
-
// Inform the receiving frame that the visibility of one of the shelfs/bars
// may have changed.
- virtual void ShelfVisibilityChanged() = 0;
+ // TODO(beng): REMOVE
+ virtual void ShelfVisibilityChanged() {}
// Inform the receiving frame that an animation has progressed in the
// selected tab.
@@ -103,13 +96,16 @@ class BrowserWindow {
// Inform the frame that the selected tab favicon or title has changed. Some
// frames may need to refresh their title bar.
+ // TODO(beng): make this pure virtual after XPFrame/VistaFrame retire.
virtual void UpdateTitleBar() { }
// Sets the title displayed in various places within the OS, such as the task
// bar.
- virtual void SetWindowTitle(const std::wstring& title) = 0;
+ // TODO(beng): REMOVE
+ virtual void SetWindowTitle(const std::wstring& title) {}
- // Activates (brings to front) the frame. Deminiaturize the frame if needed.
+ // Activates (brings to front) the window. Restores the window from minimized
+ // state if necessary.
virtual void Activate() = 0;
// Flashes the taskbar item associated with this frame.
@@ -118,7 +114,8 @@ class BrowserWindow {
// Makes the specified TabContents visible. If there is another TabContents
// visible presently, this method is responsible for hiding that TabContents
// cleanly as well.
- virtual void ShowTabContents(TabContents* contents) = 0;
+ // TODO(beng): REMOVE
+ virtual void ShowTabContents(TabContents* contents) {}
// Continue a drag gesture that began with a constrained window. When the
// user drags a constrained window such that their mouse pointer leaves the
@@ -165,10 +162,6 @@ class BrowserWindow {
// |content_rect|.
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect) = 0;
- // Tel this frame to detach from the web browser. The frame should no longer
- // notify the browser about anything.
- virtual void DetachFromBrowser() = 0;
-
// Invoked by the InfoBubble when it is shown/hidden. XPFrame/VistaFrame use
// this notification to make sure they render as active even though they are
// not active while the bubble is shown.
@@ -200,10 +193,12 @@ class BrowserWindow {
virtual BrowserView* GetBrowserView() const = 0;
// Updates the toolbar with the state for the specified |contents|.
- virtual void Update(TabContents* contents, bool should_restore_state) = 0;
+ virtual void UpdateToolbar(TabContents* contents,
+ bool should_restore_state) = 0;
// Updates the UI with the specified Profile.
- virtual void ProfileChanged(Profile* profile) = 0;
+ // TODO(beng): REMOVE
+ virtual void ProfileChanged(Profile* profile) {}
// Focuses the toolbar (for accessibility).
virtual void FocusToolbar() = 0;
diff --git a/chrome/browser/frame_util.cc b/chrome/browser/frame_util.cc
index 949d5c7..194488a 100644
--- a/chrome/browser/frame_util.cc
+++ b/chrome/browser/frame_util.cc
@@ -47,22 +47,32 @@
#include "chrome/common/win_util.h"
#include "chrome/views/focus_manager.h"
+// TODO(beng): clean this up
+static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__";
+
// static
void FrameUtil::RegisterBrowserWindow(BrowserWindow* frame) {
+ DCHECK(!g_browser_process->IsUsingNewFrames());
HWND h = reinterpret_cast<HWND>(frame->GetPlatformID());
win_util::SetWindowUserData(h, frame);
}
// static
BrowserWindow* FrameUtil::GetBrowserWindowForHWND(HWND hwnd) {
- if (hwnd) {
- std::wstring class_name = win_util::GetClassName(hwnd);
- if (class_name == VISTA_FRAME_CLASSNAME ||
- class_name == XP_FRAME_CLASSNAME) {
- // Need to check for both, as it's possible to have vista and xp frames
- // at the same time (you can get into this state when connecting via
- // remote desktop to a vista machine with Chrome already running).
- return static_cast<BrowserWindow*>(win_util::GetWindowUserData(hwnd));
+ if (IsWindow(hwnd)) {
+ if (g_browser_process->IsUsingNewFrames()) {
+ HANDLE data = GetProp(hwnd, kBrowserWindowKey);
+ if (data)
+ return reinterpret_cast<BrowserWindow*>(data);
+ } else {
+ std::wstring class_name = win_util::GetClassName(hwnd);
+ if (class_name == VISTA_FRAME_CLASSNAME ||
+ class_name == XP_FRAME_CLASSNAME) {
+ // Need to check for both, as it's possible to have vista and xp frames
+ // at the same time (you can get into this state when connecting via
+ // remote desktop to a vista machine with Chrome already running).
+ return static_cast<BrowserWindow*>(win_util::GetWindowUserData(hwnd));
+ }
}
}
return NULL;
@@ -71,6 +81,8 @@ BrowserWindow* FrameUtil::GetBrowserWindowForHWND(HWND hwnd) {
// static
BrowserWindow* FrameUtil::CreateBrowserWindow(const gfx::Rect& bounds,
Browser* browser) {
+ DCHECK(!g_browser_process->IsUsingNewFrames());
+
BrowserWindow* frame = NULL;
switch (browser->GetType()) {
@@ -101,6 +113,8 @@ BrowserWindow* FrameUtil::CreateBrowserWindow(const gfx::Rect& bounds,
bool FrameUtil::LoadAccelerators(BrowserWindow* frame,
HACCEL accelerator_table,
ChromeViews::AcceleratorTarget* accelerator_target) {
+ DCHECK(!g_browser_process->IsUsingNewFrames());
+
// We have to copy the table to access its contents.
int count = CopyAcceleratorTable(accelerator_table, 0, 0);
if (count == 0) {
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index fd13b85..f12a41a 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -393,7 +393,8 @@ static const int kThrobberFrameTimeMs = 30;
ConstrainedWindowNonClientView::ConstrainedWindowNonClientView(
ConstrainedWindowImpl* container, TabContents* owner)
- : container_(container),
+ : NonClientView(),
+ container_(container),
window_delegate_(NULL),
close_button_(new ChromeViews::Button),
location_bar_(NULL),
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc
index 96e89f1..6ea83de 100644
--- a/chrome/browser/views/frame/aero_glass_frame.cc
+++ b/chrome/browser/views/frame/aero_glass_frame.cc
@@ -176,6 +176,14 @@ bool AeroGlassFrame::GetAccelerator(int cmd_id,
return browser_view_->GetAccelerator(cmd_id, accelerator);
}
+void AeroGlassFrame::OnMove(const CPoint& point) {
+ browser_view_->WindowMoved();
+}
+
+void AeroGlassFrame::OnMoving(UINT param, const RECT* new_bounds) {
+ browser_view_->WindowMoved();
+}
+
///////////////////////////////////////////////////////////////////////////////
// AeroGlassFrame, private:
diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h
index a08581c..c4b67bd 100644
--- a/chrome/browser/views/frame/aero_glass_frame.h
+++ b/chrome/browser/views/frame/aero_glass_frame.h
@@ -73,6 +73,8 @@ class AeroGlassFrame : public BrowserFrame,
virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator);
virtual bool GetAccelerator(int cmd_id,
ChromeViews::Accelerator* accelerator);
+ virtual void OnMove(const CPoint& point);
+ virtual void OnMoving(UINT param, const RECT* new_bounds);
protected:
// Overridden from ChromeViews::HWNDViewContainer:
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index c6d73f2..7783549 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -91,10 +91,6 @@ void BrowserView::Show(int command, bool adjust_to_fit) {
frame_->Show(command, adjust_to_fit);
}
-void BrowserView::BrowserDidPaint(HRGN region) {
- frame_->BrowserDidPaint(region);
-}
-
void BrowserView::Close() {
frame_->Close();
}
@@ -111,10 +107,6 @@ StatusBubble* BrowserView::GetStatusBubble() {
return status_bubble_.get();
}
-ChromeViews::RootView* BrowserView::GetRootView() {
- return frame_->GetRootView();
-}
-
void BrowserView::ShelfVisibilityChanged() {
frame_->ShelfVisibilityChanged();
}
@@ -174,10 +166,6 @@ gfx::Rect BrowserView::GetBoundsForContentBounds(const gfx::Rect content_rect) {
return frame_->GetBoundsForContentBounds(content_rect);
}
-void BrowserView::DetachFromBrowser() {
- frame_->DetachFromBrowser();
-}
-
void BrowserView::InfoBubbleShowing() {
frame_->InfoBubbleShowing();
}
@@ -206,7 +194,8 @@ BrowserView* BrowserView::GetBrowserView() const {
return NULL;
}
-void BrowserView::Update(TabContents* contents, bool should_restore_state) {
+void BrowserView::UpdateToolbar(TabContents* contents,
+ bool should_restore_state) {
toolbar_->Update(contents, should_restore_state);
}
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 5920ed7..2e86759 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -62,12 +62,10 @@ class BrowserView : public BrowserWindow,
// Overridden from BrowserWindow:
virtual void Init();
virtual void Show(int command, bool adjust_to_fit);
- virtual void BrowserDidPaint(HRGN region);
virtual void Close();
virtual void* GetPlatformID();
virtual TabStrip* GetTabStrip() const;
virtual StatusBubble* GetStatusBubble();
- virtual ChromeViews::RootView* GetRootView();
virtual void ShelfVisibilityChanged();
virtual void SelectedTabToolbarSizeChanged(bool is_animating);
virtual void UpdateTitleBar();
@@ -85,7 +83,6 @@ class BrowserView : public BrowserWindow,
virtual gfx::Rect GetNormalBounds();
virtual bool IsMaximized();
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect);
- virtual void DetachFromBrowser();
virtual void InfoBubbleShowing();
virtual void InfoBubbleClosing();
virtual ToolbarStarToggle* GetStarButton() const;
@@ -93,7 +90,7 @@ class BrowserView : public BrowserWindow,
virtual GoButton* GetGoButton() const;
virtual BookmarkBarView* GetBookmarkBarView();
virtual BrowserView* GetBrowserView() const;
- virtual void Update(TabContents* contents, bool should_restore_state);
+ virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
virtual void ProfileChanged(Profile* profile);
virtual void FocusToolbar();
virtual void DestroyBrowser();
diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc
index 076faa0..313652e 100644
--- a/chrome/browser/views/frame/browser_view2.cc
+++ b/chrome/browser/views/frame/browser_view2.cc
@@ -53,6 +53,7 @@ static const int kStatusBubbleHeight = 20;
static const int kStatusBubbleOffset = 2;
static const int kSeparationLineHeight = 1;
static const SkColor kSeparationLineColor = SkColorSetRGB(178, 178, 178);
+static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__";
///////////////////////////////////////////////////////////////////////////////
// BrowserView2, public:
@@ -77,6 +78,14 @@ BrowserView2::~BrowserView2() {
browser_->tabstrip_model()->RemoveObserver(this);
}
+void BrowserView2::WindowMoved() {
+ status_bubble_->Reposition();
+
+ // Close the omnibox popup, if any.
+ if (GetLocationBarView())
+ GetLocationBarView()->location_entry()->ClosePopup();
+}
+
gfx::Rect BrowserView2::GetToolbarBounds() const {
CRect bounds;
toolbar_->GetBounds(&bounds);
@@ -152,6 +161,10 @@ unsigned int BrowserView2::FeaturesForBrowserType(BrowserType::Type type) {
// BrowserView2, BrowserWindow implementation:
void BrowserView2::Init() {
+ // Stow a pointer to this object onto the window handle so that we can get
+ // at it later when all we have is a HWND.
+ SetProp(GetViewContainer()->GetHWND(), kBrowserWindowKey, this);
+
LoadAccelerators();
SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
@@ -176,9 +189,6 @@ void BrowserView2::Show(int command, bool adjust_to_fit) {
frame_->GetWindow()->Show();
}
-void BrowserView2::BrowserDidPaint(HRGN region) {
-}
-
void BrowserView2::Close() {
frame_->GetWindow()->Close();
}
@@ -195,22 +205,13 @@ StatusBubble* BrowserView2::GetStatusBubble() {
return status_bubble_.get();
}
-ChromeViews::RootView* BrowserView2::GetRootView() {
- // TODO(beng): Get rid of this stupid method.
- return View::GetRootView();
-}
-
-void BrowserView2::ShelfVisibilityChanged() {
- UpdateUIForContents(browser_->GetSelectedTabContents());
-}
-
void BrowserView2::SelectedTabToolbarSizeChanged(bool is_animating) {
if (is_animating) {
contents_container_->set_fast_resize(true);
- ShelfVisibilityChanged();
+ UpdateUIForContents(browser_->GetSelectedTabContents());
contents_container_->set_fast_resize(false);
} else {
- ShelfVisibilityChanged();
+ UpdateUIForContents(browser_->GetSelectedTabContents());
contents_container_->UpdateHWNDBounds();
}
}
@@ -220,9 +221,6 @@ void BrowserView2::UpdateTitleBar() {
frame_->GetWindow()->UpdateWindowIcon();
}
-void BrowserView2::SetWindowTitle(const std::wstring& title) {
-}
-
void BrowserView2::Activate() {
frame_->GetWindow()->Activate();
}
@@ -237,17 +235,6 @@ void BrowserView2::FlashFrame() {
FlashWindowEx(&fwi);
}
-void BrowserView2::ShowTabContents(TabContents* contents) {
- contents_container_->SetTabContents(contents);
-
- // Force a LoadingStateChanged notification because the TabContents
- // could be loading (such as when the user unconstrains a tab.
- if (contents && contents->delegate())
- contents->delegate()->LoadingStateChanged(contents);
-
- UpdateUIForContents(contents);
-}
-
void BrowserView2::ContinueDetachConstrainedWindowDrag(
const gfx::Point& mouse_point,
int frame_component) {
@@ -311,13 +298,12 @@ gfx::Rect BrowserView2::GetBoundsForContentBounds(
return frame_->GetWindowBoundsForClientBounds(content_rect);
}
-void BrowserView2::DetachFromBrowser() {
-}
-
void BrowserView2::InfoBubbleShowing() {
+ frame_->GetWindow()->DisableInactiveRendering(true);
}
void BrowserView2::InfoBubbleClosing() {
+ frame_->GetWindow()->DisableInactiveRendering(false);
}
ToolbarStarToggle* BrowserView2::GetStarButton() const {
@@ -349,14 +335,11 @@ BrowserView* BrowserView2::GetBrowserView() const {
return NULL;
}
-void BrowserView2::Update(TabContents* contents, bool should_restore_state) {
+void BrowserView2::UpdateToolbar(TabContents* contents,
+ bool should_restore_state) {
toolbar_->Update(contents, should_restore_state);
}
-void BrowserView2::ProfileChanged(Profile* profile) {
- toolbar_->SetProfile(profile);
-}
-
void BrowserView2::FocusToolbar() {
toolbar_->RequestFocus();
}
@@ -382,18 +365,8 @@ void BrowserView2::Observe(NotificationType type,
///////////////////////////////////////////////////////////////////////////////
// BrowserView2, TabStripModelObserver implementation:
-void BrowserView2::TabClosingAt(TabContents* contents, int index) {
+void BrowserView2::TabDetachedAt(TabContents* contents, int index) {
if (contents == browser_->GetSelectedTabContents()) {
- // TODO(beng): (Cleanup) These should probably eventually live in the
- // TabContentsView, then we could skip all this teardown.
- ChromeViews::View* shelf = contents->GetDownloadShelfView();
- if (shelf && shelf->GetParent() != NULL)
- shelf->GetParent()->RemoveChildView(shelf);
-
- ChromeViews::View* info_bar = contents->GetInfoBarView();
- if (info_bar && info_bar->GetParent() != NULL)
- info_bar->GetParent()->RemoveChildView(info_bar);
-
// We need to reset the current tab contents to NULL before it gets
// freed. This is because the focus manager performs some operations
// on the selected TabContents when it is removed.
@@ -401,10 +374,6 @@ void BrowserView2::TabClosingAt(TabContents* contents, int index) {
}
}
-void BrowserView2::TabDetachedAt(TabContents* contents, int index) {
- // TODO(beng): implement
-}
-
void BrowserView2::TabSelectedAt(TabContents* old_contents,
TabContents* new_contents,
int index,
@@ -420,22 +389,18 @@ void BrowserView2::TabSelectedAt(TabContents* old_contents,
if (BrowserList::GetLastActive() == browser_)
new_contents->RestoreFocus();
+ // Update all the UI bits.
UpdateTitleBar();
- // UpdateToolbar(true);
-
- UpdateUIForContents(new_contents);
-}
-
-void BrowserView2::TabChangedAt(TabContents* old_contents,
- TabContents* new_contents,
- int index) {
+ toolbar_->SetProfile(new_contents->profile());
+ UpdateToolbar(new_contents, true);
UpdateUIForContents(new_contents);
}
void BrowserView2::TabStripEmpty() {
- // We need to reset the frame contents just in case this wasn't done while
- // detaching the tab. This happens when dragging out the last tab.
- contents_container_->SetTabContents(NULL);
+ // Make sure all optional UI is removed before we are destroyed, otherwise
+ // there will be consequences (since our view hierarchy will still have
+ // references to freed views).
+ UpdateUIForContents(NULL);
}
///////////////////////////////////////////////////////////////////////////////
@@ -489,26 +454,23 @@ void BrowserView2::ExecuteWindowsCommand(int command_id) {
void BrowserView2::SaveWindowPosition(const CRect& bounds,
bool maximized,
bool always_on_top) {
- // TODO(beng): implement me!
- //browser_->SaveWindowPosition(gfx::Rect(bounds), maximized);
+ browser_->SaveWindowPosition(gfx::Rect(bounds), maximized);
}
bool BrowserView2::RestoreWindowPosition(CRect* bounds,
bool* maximized,
bool* always_on_top) {
DCHECK(bounds && maximized && always_on_top);
- *always_on_top = false;
- /* TODO(beng): implement this method in Browser
- browser_->RestoreWindowPosition(bounds, maximized);
+ // TODO(beng): (http://b/1317622) Make these functions take gfx::Rects.
+ gfx::Rect b;
+ browser_->RestoreWindowPosition(&b, maximized);
+ *bounds = b.ToRECT();
// We return true because we can _always_ locate reasonable bounds using the
// WindowSizer, and we don't want to trigger the Window's built-in "size to
// default" handling because the browser window has no default preferred
// size.
return true;
- */
- // For now, return false to just use whatever was given to us by Browser...
- return false;
}
void BrowserView2::WindowClosing() {
@@ -605,6 +567,10 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) {
///////////////////////////////////////////////////////////////////////////////
// BrowserView2, ChromeViews::View overrides:
+void BrowserView2::Paint(ChromeCanvas* canvas) {
+ //canvas->FillRectInt(SK_ColorRED, 0, 0, GetWidth(), GetHeight());
+}
+
void BrowserView2::Layout() {
int top = LayoutTabStrip();
top = LayoutToolbar(top);
@@ -635,9 +601,8 @@ void BrowserView2::ViewHierarchyChanged(bool is_add,
int BrowserView2::LayoutTabStrip() {
if (IsTabStripVisible()) {
gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_);
- // TODO(beng): account for OTR avatar.
tabstrip_->SetBounds(tabstrip_bounds.x(), tabstrip_bounds.y(),
- tabstrip_bounds.width(), tabstrip_bounds.height());
+ tabstrip_bounds.width(), tabstrip_bounds.height());
return tabstrip_bounds.bottom();
}
return 0;
@@ -668,7 +633,6 @@ int BrowserView2::LayoutBookmarkAndInfoBars(int top) {
return LayoutBookmarkBar(top);
}
// Otherwise, Bookmark bar first, Info bar second.
- top -= kSeparationLineHeight;
top = LayoutBookmarkBar(top);
}
return LayoutInfoBar(top);
@@ -678,6 +642,8 @@ int BrowserView2::LayoutBookmarkBar(int top) {
if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && active_bookmark_bar_) {
CSize ps;
active_bookmark_bar_->GetPreferredSize(&ps);
+ if (!active_info_bar_ || show_bookmark_bar_pref_.GetValue())
+ top -= kSeparationLineHeight;
active_bookmark_bar_->SetBounds(0, top, GetWidth(), ps.cy);
top += ps.cy;
}
@@ -722,7 +688,8 @@ void BrowserView2::LayoutStatusBubble(int top) {
bool BrowserView2::MaybeShowBookmarkBar(TabContents* contents) {
ChromeViews::View* new_bookmark_bar_view = NULL;
if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) &&
- contents->IsBookmarkBarAlwaysVisible()) {
+ (contents && contents->IsBookmarkBarAlwaysVisible() ||
+ show_bookmark_bar_pref_.GetValue())) {
new_bookmark_bar_view = GetBookmarkBarView();
}
return UpdateChildViewAndLayout(new_bookmark_bar_view,
@@ -744,17 +711,11 @@ bool BrowserView2::MaybeShowDownloadShelf(TabContents* contents) {
}
void BrowserView2::UpdateUIForContents(TabContents* contents) {
- // Only do a Layout if the current contents is non-NULL. We assume that if
- // the contents is NULL, we're either being destroyed, or ShowTabContents is
- // going to be invoked with a non-NULL TabContents again so that there is no
- // need to do a Layout now.
- if (!contents)
- return;
-
- if (MaybeShowBookmarkBar(contents) || MaybeShowInfoBar(contents) ||
- MaybeShowDownloadShelf(contents)) {
+ bool needs_layout = MaybeShowBookmarkBar(contents);
+ needs_layout |= MaybeShowInfoBar(contents);
+ needs_layout |= MaybeShowDownloadShelf(contents);
+ if (needs_layout)
Layout();
- }
}
bool BrowserView2::UpdateChildViewAndLayout(ChromeViews::View* new_view,
diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h
index 164451c..54f154c 100644
--- a/chrome/browser/views/frame/browser_view2.h
+++ b/chrome/browser/views/frame/browser_view2.h
@@ -64,6 +64,10 @@ class BrowserView2 : public BrowserWindow,
void set_frame(BrowserFrame* frame) { frame_ = frame; }
+ // Called by the frame to notify the BrowserView2 that it was moved, and that
+ // any dependent popup windows should be repositioned.
+ void WindowMoved();
+
// Returns the bounds of the toolbar, in BrowserView2 coordinates.
gfx::Rect GetToolbarBounds() const;
@@ -109,19 +113,14 @@ class BrowserView2 : public BrowserWindow,
// Overridden from BrowserWindow:
virtual void Init();
virtual void Show(int command, bool adjust_to_fit);
- virtual void BrowserDidPaint(HRGN region);
virtual void Close();
virtual void* GetPlatformID();
virtual TabStrip* GetTabStrip() const;
virtual StatusBubble* GetStatusBubble();
- virtual ChromeViews::RootView* GetRootView();
- virtual void ShelfVisibilityChanged();
virtual void SelectedTabToolbarSizeChanged(bool is_animating);
virtual void UpdateTitleBar();
- virtual void SetWindowTitle(const std::wstring& title);
virtual void Activate();
virtual void FlashFrame();
- virtual void ShowTabContents(TabContents* contents);
virtual void ContinueDetachConstrainedWindowDrag(
const gfx::Point& mouse_point,
int frame_component);
@@ -132,7 +131,6 @@ class BrowserView2 : public BrowserWindow,
virtual gfx::Rect GetNormalBounds();
virtual bool IsMaximized();
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect);
- virtual void DetachFromBrowser();
virtual void InfoBubbleShowing();
virtual void InfoBubbleClosing();
virtual ToolbarStarToggle* GetStarButton() const;
@@ -140,8 +138,7 @@ class BrowserView2 : public BrowserWindow,
virtual GoButton* GetGoButton() const;
virtual BookmarkBarView* GetBookmarkBarView();
virtual BrowserView* GetBrowserView() const;
- virtual void Update(TabContents* contents, bool should_restore_state);
- virtual void ProfileChanged(Profile* profile);
+ virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
virtual void FocusToolbar();
virtual void DestroyBrowser();
@@ -151,15 +148,11 @@ class BrowserView2 : public BrowserWindow,
const NotificationDetails& details);
// Overridden from TabStripModelObserver:
- virtual void TabClosingAt(TabContents* contents, int index);
virtual void TabDetachedAt(TabContents* contents, int index);
virtual void TabSelectedAt(TabContents* old_contents,
TabContents* new_contents,
int index,
bool user_gesture);
- virtual void TabChangedAt(TabContents* old_contents,
- TabContents* new_contents,
- int index);
virtual void TabStripEmpty();
// Overridden from ChromeViews::WindowDelegate:
@@ -188,6 +181,7 @@ class BrowserView2 : public BrowserWindow,
virtual int NonClientHitTest(const gfx::Point& point);
// Overridden from ChromeViews::View:
+ virtual void Paint(ChromeCanvas* canvas);
virtual void Layout();
virtual void DidChangeBounds(const CRect& previous, const CRect& current);
virtual void ViewHierarchyChanged(bool is_add,
@@ -216,21 +210,25 @@ class BrowserView2 : public BrowserWindow,
// Prepare to show the Bookmark Bar for the specified TabContents. Returns
// true if the Bookmark Bar can be shown (i.e. it's supported for this
// Browser type) and there should be a subsequent re-layout to show it.
+ // |contents| can be NULL.
bool MaybeShowBookmarkBar(TabContents* contents);
// Prepare to show an Info Bar for the specified TabContents. Returns true
// if there is an Info Bar to show and one is supported for this Browser
// type, and there should be a subsequent re-layout to show it.
+ // |contents| can be NULL.
bool MaybeShowInfoBar(TabContents* contents);
// Prepare to show a Download Shelf for the specified TabContents. Returns
// true if there is a Download Shelf to show and one is supported for this
// Browser type, and there should be a subsequent re-layout to show it.
+ // |contents| can be NULL.
bool MaybeShowDownloadShelf(TabContents* contents);
// Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
// Download Shelf in response to a change notification from the specified
- // |contents|.
+ // |contents|. |contents| can be NULL. In this case, all optional UI will be
+ // removed.
void UpdateUIForContents(TabContents* contents);
// Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download
diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc
index c028624..9e9181c 100644
--- a/chrome/browser/views/frame/opaque_frame.cc
+++ b/chrome/browser/views/frame/opaque_frame.cc
@@ -98,6 +98,14 @@ bool OpaqueFrame::GetAccelerator(int cmd_id,
return browser_view_->GetAccelerator(cmd_id, accelerator);
}
+void OpaqueFrame::OnMove(const CPoint& point) {
+ browser_view_->WindowMoved();
+}
+
+void OpaqueFrame::OnMoving(UINT param, const RECT* new_bounds) {
+ browser_view_->WindowMoved();
+}
+
///////////////////////////////////////////////////////////////////////////////
// OpaqueFrame, private:
diff --git a/chrome/browser/views/frame/opaque_frame.h b/chrome/browser/views/frame/opaque_frame.h
index ebb5a20..34ebd47 100644
--- a/chrome/browser/views/frame/opaque_frame.h
+++ b/chrome/browser/views/frame/opaque_frame.h
@@ -61,6 +61,7 @@ class OpaqueFrame : public BrowserFrame,
gfx::Rect GetToolbarBounds() const;
gfx::Rect GetContentsBounds() const;
+ protected:
// Overridden from BrowserFrame:
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds);
@@ -72,6 +73,8 @@ class OpaqueFrame : public BrowserFrame,
virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator);
virtual bool GetAccelerator(int cmd_id,
ChromeViews::Accelerator* accelerator);
+ virtual void OnMove(const CPoint& point);
+ virtual void OnMoving(UINT param, const RECT* new_bounds);
private:
// Return a pointer to the concrete type of our non-client view.
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc
index 823014c..410e95a 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -398,7 +398,7 @@ static const int kTitleTopOffset = 6;
static const int kTitleBottomSpacing = 6;
// The distance between the top edge of the window and the TabStrip when there
// is no title-bar showing, and the window is restored.
-static const int kNoTitleTopSpacing = 10;
+static const int kNoTitleTopSpacing = 15;
// The distance between the top edge of the window and the TabStrip when there
// is no title-bar showing, and the window is maximized.
static const int kNoTitleZoomedTopSpacing = 1;
@@ -426,7 +426,8 @@ static const int kDistributorLogoVerticalOffset = 3;
// OpaqueNonClientView, public:
OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame, bool is_otr)
- : minimize_button_(new ChromeViews::Button),
+ : NonClientView(),
+ minimize_button_(new ChromeViews::Button),
maximize_button_(new ChromeViews::Button),
restore_button_(new ChromeViews::Button),
close_button_(new ChromeViews::Button),
@@ -513,9 +514,9 @@ gfx::Rect OpaqueNonClientView::GetWindowBoundsForClientBounds(
gfx::Rect OpaqueNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) {
int tabstrip_height = tabstrip->GetPreferredHeight();
- int tabstrip_x = frame_->client_view()->GetX() - 4;
- return gfx::Rect(tabstrip_x, frame_->client_view()->GetY() - 1,
- minimize_button_->GetX() - tabstrip_x, tabstrip_height);
+ int tabstrip_x = frame_->client_view()->GetX();
+ return gfx::Rect(0, 0, minimize_button_->GetX() - tabstrip_x,
+ tabstrip_height);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h
index fbc54a3..3290e26 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.h
+++ b/chrome/browser/views/frame/opaque_non_client_view.h
@@ -50,7 +50,8 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
// Retrieve the bounds of the window for the specified contents bounds.
gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect& client_bounds);
- // Retrieve the bounds that the specified |tabstrip| will be laid out within.
+ // Retrieve the bounds (in ClientView coordinates) that the specified
+ // |tabstrip| will be laid out within.
gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip);
protected:
@@ -101,8 +102,8 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
// Returns the set of resources to use to paint this view.
WindowResources* resources() const {
- return frame_->is_active() ? current_active_resources_
- : current_inactive_resources_;
+ return frame_->is_active() || paint_as_active() ?
+ current_active_resources_ : current_inactive_resources_;
}
// The layout rect of the title, if visible.
diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc
index f326ed9..2dba77f 100644
--- a/chrome/browser/vista_frame.cc
+++ b/chrome/browser/vista_frame.cc
@@ -148,7 +148,6 @@ VistaFrame::VistaFrame(Browser* browser)
saved_window_placement_(false),
on_mouse_leave_armed_(false),
in_drag_session_(false),
- browser_paint_pending_(false),
shelf_view_(NULL),
bookmark_bar_view_(NULL),
info_bar_view_(NULL),
@@ -502,10 +501,6 @@ void VistaFrame::Show(int command, bool adjust_to_fit) {
::ShowWindow(*this, command);
}
-void VistaFrame::BrowserDidPaint(HRGN region) {
- browser_paint_pending_ = false;
-}
-
// This is called when we receive WM_ENDSESSION. In Vista the we have 5 seconds
// or will be forcefully terminated if we get stuck servicing this message and
// not pump the final messages.
@@ -627,11 +622,6 @@ gfx::Rect VistaFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) {
return r;
}
-void VistaFrame::DetachFromBrowser() {
- browser_->tabstrip_model()->RemoveObserver(tabstrip_);
- browser_ = NULL;
-}
-
void VistaFrame::InfoBubbleShowing() {
ignore_ncactivate_ = true;
}
@@ -668,7 +658,8 @@ BrowserView* VistaFrame::GetBrowserView() const {
return browser_view_;
}
-void VistaFrame::Update(TabContents* contents, bool should_restore_state) {
+void VistaFrame::UpdateToolbar(TabContents* contents,
+ bool should_restore_state) {
}
void VistaFrame::ProfileChanged(Profile* profile) {
diff --git a/chrome/browser/vista_frame.h b/chrome/browser/vista_frame.h
index ac406b5..eba2aa2 100644
--- a/chrome/browser/vista_frame.h
+++ b/chrome/browser/vista_frame.h
@@ -186,7 +186,6 @@ class VistaFrame : public BrowserWindow,
virtual void Init();
virtual void Show(int command, bool adjust_to_fit);
- virtual void BrowserDidPaint(HRGN region);
virtual void Close();
virtual void* GetPlatformID();
virtual void ShowTabContents(TabContents* contents);
@@ -201,14 +200,13 @@ class VistaFrame : public BrowserWindow,
virtual gfx::Rect GetNormalBounds();
virtual bool IsMaximized();
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect);
- virtual void DetachFromBrowser();
virtual void InfoBubbleShowing();
virtual ToolbarStarToggle* GetStarButton() const;
virtual LocationBarView* GetLocationBarView() const;
virtual GoButton* GetGoButton() const;
virtual BookmarkBarView* GetBookmarkBarView();
virtual BrowserView* GetBrowserView() const;
- virtual void Update(TabContents* contents, bool should_restore_state);
+ virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
virtual void ProfileChanged(Profile* profile);
virtual void FocusToolbar();
@@ -394,9 +392,6 @@ class VistaFrame : public BrowserWindow,
// whether we are currently processing a view level drag session
bool in_drag_session_;
- // whether we are waiting for a browser async paint
- bool browser_paint_pending_;
-
// A view positioned at the bottom of the frame.
ChromeViews::View* shelf_view_;
diff --git a/chrome/browser/xp_frame.cc b/chrome/browser/xp_frame.cc
index 94a59a1..e9e69dd 100644
--- a/chrome/browser/xp_frame.cc
+++ b/chrome/browser/xp_frame.cc
@@ -352,7 +352,6 @@ XPFrame::XPFrame(Browser* browser)
saved_window_placement_(false),
current_action_(FA_NONE),
on_mouse_leave_armed_(false),
- browser_paint_pending_(false),
previous_cursor_(NULL),
minimum_size_(100, 100),
shelf_view_(NULL),
@@ -1581,10 +1580,6 @@ void XPFrame::ButtonPressed(ChromeViews::BaseButton *sender) {
//
////////////////////////////////////////////////////////////////////////////////
-void XPFrame::BrowserDidPaint(HRGN rgn) {
- browser_paint_pending_ = false;
-}
-
bool XPFrame::ShouldRefreshCurrentTabContents() {
if (browser_->tabstrip_model()) {
TabContents* tc = browser_->GetSelectedTabContents();
@@ -1829,11 +1824,6 @@ gfx::Rect XPFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) {
return r;
}
-void XPFrame::DetachFromBrowser() {
- browser_->tabstrip_model()->RemoveObserver(tabstrip_);
- browser_ = NULL;
-}
-
void XPFrame::InfoBubbleShowing() {
ignore_ncactivate_ = true;
paint_as_active_ = true;
@@ -1879,8 +1869,8 @@ BrowserView* XPFrame::GetBrowserView() const {
return browser_view_;
}
-void XPFrame::Update(TabContents* contents, bool should_restore_state) {
- browser_view_->Update(contents, should_restore_state);
+void XPFrame::UpdateToolbar(TabContents* contents, bool should_restore_state) {
+ browser_view_->UpdateToolbar(contents, should_restore_state);
}
void XPFrame::ProfileChanged(Profile* profile) {
diff --git a/chrome/browser/xp_frame.h b/chrome/browser/xp_frame.h
index 6c29efc..92a1ef1 100644
--- a/chrome/browser/xp_frame.h
+++ b/chrome/browser/xp_frame.h
@@ -97,7 +97,6 @@ class XPFrame : public BrowserWindow,
virtual ~XPFrame();
virtual void Init();
virtual void Show(int command, bool adjust_to_fit);
- virtual void BrowserDidPaint(HRGN rgn);
virtual void Close();
virtual void* GetPlatformID();
virtual void SetAcceleratorTable(
@@ -106,7 +105,6 @@ class XPFrame : public BrowserWindow,
virtual gfx::Rect GetNormalBounds();
virtual bool IsMaximized();
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect);
- virtual void DetachFromBrowser();
virtual void InfoBubbleShowing();
virtual void InfoBubbleClosing();
virtual ToolbarStarToggle* GetStarButton() const;
@@ -114,7 +112,7 @@ class XPFrame : public BrowserWindow,
virtual GoButton* GetGoButton() const;
virtual BookmarkBarView* GetBookmarkBarView();
virtual BrowserView* GetBrowserView() const;
- virtual void Update(TabContents* contents, bool should_restore_state);
+ virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
virtual void ProfileChanged(Profile* profile);
virtual void FocusToolbar();
@@ -469,9 +467,6 @@ class XPFrame : public BrowserWindow,
// Initialize static members the first time this is invoked
static void InitializeIfNeeded();
- // true if some painting is already pending
- bool browser_paint_pending_;
-
// cursor storage
HCURSOR previous_cursor_;
diff --git a/chrome/views/hwnd_view_container.h b/chrome/views/hwnd_view_container.h
index aa3a4a9..1ce41f2 100644
--- a/chrome/views/hwnd_view_container.h
+++ b/chrome/views/hwnd_view_container.h
@@ -208,6 +208,7 @@ class HWNDViewContainer : public ViewContainer,
MSG_WM_MOUSELEAVE(OnMouseLeave)
MSG_WM_MOUSEMOVE(OnMouseMove)
MSG_WM_MOUSEWHEEL(OnMouseWheel)
+ MSG_WM_MOVE(OnMove)
MSG_WM_MOVING(OnMoving)
MSG_WM_NCACTIVATE(OnNCActivate)
MSG_WM_NCCALCSIZE(OnNCCalcSize)
@@ -368,6 +369,7 @@ class HWNDViewContainer : public ViewContainer,
virtual LRESULT OnMouseActivate(HWND window, UINT hittest_code, UINT message);
virtual void OnMouseMove(UINT flags, const CPoint& point);
virtual void OnMouseLeave();
+ virtual void OnMove(const CPoint& point) { SetMsgHandled(FALSE); }
virtual void OnMoving(UINT param, const LPRECT new_bounds) { }
virtual LRESULT OnMouseWheel(UINT flags, short distance, const CPoint& point);
virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param);