diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 20:15:05 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 20:15:05 +0000 |
commit | 959f02f686125777e7a744a81fbfcc240e648e54 (patch) | |
tree | f84a0fad2889cd7adcc798fcc204098fdcac6a89 /chrome/browser/views | |
parent | a3a8fb6d3692cf61db8cfed20e15e83916e6602b (diff) | |
download | chromium_src-959f02f686125777e7a744a81fbfcc240e648e54.zip chromium_src-959f02f686125777e7a744a81fbfcc240e648e54.tar.gz chromium_src-959f02f686125777e7a744a81fbfcc240e648e54.tar.bz2 |
Enable System Context Menu for linux views.
* Chagned WindowGtk to pass through right click mouse event for
HTCAPTION so that ContextMenuController on Frame/Tab view works.
* Added ContetMenuController to NonClientView.
* Added "PointIsWithinWindowCaption to BrowserView to exclude chromeos specific components from Caption area.
Fix a minor bug in NonClientView
* GetViewForPoint was using wrong point. This wasn't causing any issue as the frame_view's origin was (0, 0)
BUG=None
TEST=run chromeos build and right click frame view and verify that you get system menu.
Review URL: http://codereview.chromium.org/303014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 17 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 4 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_browser_frame_view.cc | 7 | ||||
-rw-r--r-- | chrome/browser/views/tabs/browser_tab_strip.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/tabs/browser_tab_strip.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip_wrapper.h | 6 |
8 files changed, 29 insertions, 14 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 674c435..b52ccf1 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -691,6 +691,17 @@ void BrowserView::DetachBrowserBubble(BrowserBubble* bubble) { browser_bubbles_.erase(it); } +bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { + gfx::Point tabstrip_point(point); + View::ConvertPointToView(this, tabstrip()->GetView(), &tabstrip_point); +#if defined(OS_CHROMEOS) + return tabstrip()->IsPositionInWindowCaption(tabstrip_point) + && !browser_extender_->NonClientHitTest(point); +#else + return tabstrip()->IsPositionInWindowCaption(tabstrip_point); +#endif +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView, BrowserWindow implementation: @@ -1537,7 +1548,7 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) { View::ConvertPointToView(GetParent(), tabstrip_->GetView(), &point_in_tabstrip_coords); if (tabstrip_->GetView()->HitTest(point_in_tabstrip_coords)) { - if (tabstrip_->PointIsWithinWindowCaption(point_in_tabstrip_coords)) + if (tabstrip_->IsPositionInWindowCaption(point_in_tabstrip_coords)) return HTCAPTION; return HTCLIENT; } @@ -1556,7 +1567,9 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) { } #if defined(OS_CHROMEOS) - if (browser_extender_->NonClientHitTest(point)) + gfx::Point browser_view_point(point); + ConvertPointToView(GetParent(), this, &browser_view_point); + if (browser_extender_->NonClientHitTest(browser_view_point)) return HTCLIENT; #endif diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 5703306..c48a7e0 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -203,6 +203,10 @@ class BrowserView : public BrowserWindow, void AttachBrowserBubble(BrowserBubble *bubble); void DetachBrowserBubble(BrowserBubble *bubble); + // Returns true if the specified point(BrowserView coordinates) is in + // in the window caption area of the browser window. + bool IsPositionInWindowCaption(const gfx::Point& point); + // Overridden from BrowserWindow: virtual void Show(); virtual void SetBounds(const gfx::Rect& bounds); diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc index 6a23de1..3cc4459 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc @@ -393,10 +393,9 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { // We convert from our parent's coordinates since we assume we fill its bounds // completely. We need to do this since we're not a parent of the tabstrip, // meaning ConvertPointToView would otherwise return something bogus. - gfx::Point tabstrip_point(l); - View::ConvertPointToView(GetParent(), browser_view_->tabstrip()->GetView(), - &tabstrip_point); - return browser_view_->tabstrip()->PointIsWithinWindowCaption(tabstrip_point); + gfx::Point browser_view_point(l); + View::ConvertPointToView(GetParent(), browser_view_, &browser_view_point); + return browser_view_->IsPositionInWindowCaption(browser_view_point); } void OpaqueBrowserFrameView::ViewHierarchyChanged(bool is_add, diff --git a/chrome/browser/views/tabs/browser_tab_strip.cc b/chrome/browser/views/tabs/browser_tab_strip.cc index 64dec1e..7f1bad6 100644 --- a/chrome/browser/views/tabs/browser_tab_strip.cc +++ b/chrome/browser/views/tabs/browser_tab_strip.cc @@ -202,8 +202,7 @@ bool BrowserTabStrip::IsAnimating() const { void BrowserTabStrip::SetBackgroundOffset(gfx::Point offset) { } -bool BrowserTabStrip::PointIsWithinWindowCaption( - const gfx::Point& point) { +bool BrowserTabStrip::IsPositionInWindowCaption(const gfx::Point& point) { return false; } diff --git a/chrome/browser/views/tabs/browser_tab_strip.h b/chrome/browser/views/tabs/browser_tab_strip.h index 8936b45..9057a13 100644 --- a/chrome/browser/views/tabs/browser_tab_strip.h +++ b/chrome/browser/views/tabs/browser_tab_strip.h @@ -60,7 +60,7 @@ class BrowserTabStrip : public TabStrip2, virtual int GetPreferredHeight(); virtual bool IsAnimating() const; virtual void SetBackgroundOffset(gfx::Point offset); - virtual bool PointIsWithinWindowCaption(const gfx::Point& point); + virtual bool IsPositionInWindowCaption(const gfx::Point& point); virtual bool IsDragSessionActive() const; virtual bool IsCompatibleWith(TabStripWrapper* other) const; virtual void SetDraggedTabBounds(int tab_index, diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 950e233..d94aa9a 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -1326,7 +1326,7 @@ void TabStrip::SetBackgroundOffset(gfx::Point offset) { GetTabAt(i)->SetBackgroundOffset(offset); } -bool TabStrip::PointIsWithinWindowCaption(const gfx::Point& point) { +bool TabStrip::IsPositionInWindowCaption(const gfx::Point& point) { views::View* v = GetViewForPoint(point); // If there is no control at this location, claim the hit was in the title diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index 782d6f9..c84527a 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -139,7 +139,7 @@ class TabStrip : public views::View, virtual int GetPreferredHeight(); virtual bool IsAnimating() const; virtual void SetBackgroundOffset(gfx::Point offset); - virtual bool PointIsWithinWindowCaption(const gfx::Point& point); + virtual bool IsPositionInWindowCaption(const gfx::Point& point); virtual bool IsDragSessionActive() const; virtual bool IsCompatibleWith(TabStripWrapper* other) const; virtual void SetDraggedTabBounds(int tab_index, diff --git a/chrome/browser/views/tabs/tab_strip_wrapper.h b/chrome/browser/views/tabs/tab_strip_wrapper.h index 7e94825..c6ff84c 100644 --- a/chrome/browser/views/tabs/tab_strip_wrapper.h +++ b/chrome/browser/views/tabs/tab_strip_wrapper.h @@ -32,9 +32,9 @@ class TabStripWrapper { // Set the background offset used by inactive tabs to match the frame image. virtual void SetBackgroundOffset(gfx::Point offset) = 0; - // Returns true if the specified point(TabStrip coordinates) should be - // considered to be within the window caption area of the browser window. - virtual bool PointIsWithinWindowCaption(const gfx::Point& point) = 0; + // Returns true if the specified point(TabStrip coordinates) is + // in the window caption area of the browser window. + virtual bool IsPositionInWindowCaption(const gfx::Point& point) = 0; // Returns true if a drag session is currently active. virtual bool IsDragSessionActive() const = 0; |