diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 20:10:00 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 20:10:00 +0000 |
commit | da8df5919cf2942b25fe284d14a30c29f94e41a4 (patch) | |
tree | 76170f379cb40425edd414c5a37a462b3d2cbcf8 /chrome | |
parent | b880b1feb398ed0de47d355a0ee330c1f4cb89a8 (diff) | |
download | chromium_src-da8df5919cf2942b25fe284d14a30c29f94e41a4.zip chromium_src-da8df5919cf2942b25fe284d14a30c29f94e41a4.tar.gz chromium_src-da8df5919cf2942b25fe284d14a30c29f94e41a4.tar.bz2 |
Add End-session handling and app modal dialog handling to BrowserView2/New Frames.
B=1031854
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/frame_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_frame.cc | 27 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_frame.h | 8 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view2.cc | 20 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view2.h | 8 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_frame.cc | 20 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_frame.h | 5 |
7 files changed, 82 insertions, 8 deletions
diff --git a/chrome/browser/frame_util.cc b/chrome/browser/frame_util.cc index 194488a..85a1b6f 100644 --- a/chrome/browser/frame_util.cc +++ b/chrome/browser/frame_util.cc @@ -169,6 +169,8 @@ bool FrameUtil::ActivateAppModalDialog(Browser* browser) { } // static +// TODO(beng): post new frames, move somewhere more logical, maybe Browser or +// BrowserList. void FrameUtil::EndSession() { // EndSession is invoked once per frame. Only do something the first time. static bool already_ended = false; diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index 6ea83de..117ea52 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -32,6 +32,7 @@ #include "chrome/browser/views/frame/aero_glass_frame.h" #include "chrome/app/theme/theme_resources.h" +#include "chrome/browser/frame_util.h" #include "chrome/browser/views/frame/browser_view2.h" #include "chrome/browser/views/frame/aero_glass_non_client_view.h" #include "chrome/common/resource_bundle.h" @@ -116,13 +117,31 @@ ChromeViews::Window* AeroGlassFrame::GetWindow() { /////////////////////////////////////////////////////////////////////////////// // AeroGlassFrame, ChromeViews::HWNDViewContainer implementation: +LRESULT AeroGlassFrame::OnMouseActivate(HWND window, UINT hittest_code, + UINT message) { + return browser_view_->ActivateAppModalDialog() ? MA_NOACTIVATEANDEAT + : MA_ACTIVATE; +} + +void AeroGlassFrame::OnMove(const CPoint& point) { + browser_view_->WindowMoved(); +} + +void AeroGlassFrame::OnMoving(UINT param, const RECT* new_bounds) { + browser_view_->WindowMoved(); +} + LRESULT AeroGlassFrame::OnNCActivate(BOOL active) { + if (browser_view_->ActivateAppModalDialog()) + return TRUE; + if (!frame_initialized_) { ::SetWindowPos(GetHWND(), NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED); UpdateDWMFrame(); frame_initialized_ = true; } + browser_view_->ActivationChanged(!!active); return TRUE; } @@ -176,12 +195,8 @@ 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(); +void AeroGlassFrame::OnEndSession(BOOL ending, UINT logoff) { + FrameUtil::EndSession(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h index c4b67bd..bbb5f8c 100644 --- a/chrome/browser/views/frame/aero_glass_frame.h +++ b/chrome/browser/views/frame/aero_glass_frame.h @@ -73,11 +73,15 @@ 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: + virtual void OnEndSession(BOOL ending, UINT logoff); + virtual LRESULT OnMouseActivate(HWND window, + UINT hittest_code, + UINT message); + virtual void OnMove(const CPoint& point); + virtual void OnMoving(UINT param, const RECT* new_bounds); virtual LRESULT OnNCActivate(BOOL active); virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); virtual LRESULT OnNCHitTest(const CPoint& pt); diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index 0efd982..60603fb 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -30,6 +30,7 @@ #include "chrome/browser/views/frame/browser_view2.h" #include "chrome/app/theme/theme_resources.h" +#include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/tab_contents_container_view.h" @@ -148,6 +149,25 @@ void BrowserView2::AddViewToDropList(ChromeViews::View* view) { dropable_views_.insert(view); } +bool BrowserView2::ActivateAppModalDialog() const { + // If another browser is app modal, flash and activate the modal browser. + if (BrowserList::IsShowingAppModalDialog()) { + if (browser_ != BrowserList::GetLastActive()) { + BrowserList::GetLastActive()->window()->FlashFrame(); + BrowserList::GetLastActive()->MoveToFront(true); + } + AppModalDialogQueue::ActivateModalDialog(); + return true; + } + return false; +} + +void BrowserView2::ActivationChanged(bool activated) { + // The Browser wants to update the BrowserList to let it know it's now + // active. + browser_->WindowActivationChanged(activated); +} + bool BrowserView2::SupportsWindowFeature(WindowFeature feature) const { return !!(FeaturesForBrowserType(browser_->GetType()) & feature); } diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h index ef3b7c8..eb9b33c 100644 --- a/chrome/browser/views/frame/browser_view2.h +++ b/chrome/browser/views/frame/browser_view2.h @@ -97,6 +97,14 @@ class BrowserView2 : public BrowserWindow, // and you want to allow drops on. void AddViewToDropList(ChromeViews::View* view); + // Shows the next app-modal dialog box, if there is one to be shown, or moves + // an existing showing one to the front. Returns true if one was shown or + // activated, false if none was shown. + bool ActivateAppModalDialog() const; + + // Called when the activation of the frame changes. + void ActivationChanged(bool activated); + // Possible elements of the Browser window. enum WindowFeature { FEATURE_TITLEBAR = 1, diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc index 9e9181c..dd8a37b 100644 --- a/chrome/browser/views/frame/opaque_frame.cc +++ b/chrome/browser/views/frame/opaque_frame.cc @@ -29,6 +29,7 @@ #include "chrome/browser/views/frame/opaque_frame.h" +#include "chrome/browser/frame_util.h" #include "chrome/browser/tabs/tab_strip.h" #include "chrome/browser/views/frame/browser_view2.h" #include "chrome/browser/views/frame/opaque_non_client_view.h" @@ -98,6 +99,16 @@ bool OpaqueFrame::GetAccelerator(int cmd_id, return browser_view_->GetAccelerator(cmd_id, accelerator); } +void OpaqueFrame::OnEndSession(BOOL ending, UINT logoff) { + FrameUtil::EndSession(); +} + +LRESULT OpaqueFrame::OnMouseActivate(HWND window, UINT hittest_code, + UINT message) { + return browser_view_->ActivateAppModalDialog() ? MA_NOACTIVATEANDEAT + : MA_ACTIVATE; +} + void OpaqueFrame::OnMove(const CPoint& point) { browser_view_->WindowMoved(); } @@ -106,6 +117,15 @@ void OpaqueFrame::OnMoving(UINT param, const RECT* new_bounds) { browser_view_->WindowMoved(); } +LRESULT OpaqueFrame::OnNCActivate(BOOL active) { + if (browser_view_->ActivateAppModalDialog()) + return TRUE; + + CustomFrameWindow::OnNCActivate(active); + browser_view_->ActivationChanged(!!active); + return TRUE; +} + /////////////////////////////////////////////////////////////////////////////// // OpaqueFrame, private: diff --git a/chrome/browser/views/frame/opaque_frame.h b/chrome/browser/views/frame/opaque_frame.h index 34ebd47..5d2889d 100644 --- a/chrome/browser/views/frame/opaque_frame.h +++ b/chrome/browser/views/frame/opaque_frame.h @@ -73,8 +73,13 @@ class OpaqueFrame : public BrowserFrame, virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator); virtual bool GetAccelerator(int cmd_id, ChromeViews::Accelerator* accelerator); + virtual void OnEndSession(BOOL ending, UINT logoff); + virtual LRESULT OnMouseActivate(HWND window, + UINT hittest_code, + UINT message); virtual void OnMove(const CPoint& point); virtual void OnMoving(UINT param, const RECT* new_bounds); + virtual LRESULT OnNCActivate(BOOL active); private: // Return a pointer to the concrete type of our non-client view. |