summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 20:15:05 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 20:15:05 +0000
commit959f02f686125777e7a744a81fbfcc240e648e54 (patch)
treef84a0fad2889cd7adcc798fcc204098fdcac6a89 /chrome/browser/chromeos
parenta3a8fb6d3692cf61db8cfed20e15e83916e6602b (diff)
downloadchromium_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/chromeos')
-rw-r--r--chrome/browser/chromeos/browser_extender.cc14
-rw-r--r--chrome/browser/chromeos/browser_extender.h4
2 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/chromeos/browser_extender.cc b/chrome/browser/chromeos/browser_extender.cc
index 2d12293..44b4e51 100644
--- a/chrome/browser/chromeos/browser_extender.cc
+++ b/chrome/browser/chromeos/browser_extender.cc
@@ -10,6 +10,7 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/chromeos/main_menu.h"
#include "chrome/browser/chromeos/status_area_view.h"
+#include "chrome/browser/views/frame/browser_frame_gtk.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/panel_controller.h"
#include "chrome/browser/views/tabs/tab_overview_types.h"
@@ -54,9 +55,16 @@ class NormalExtender : public BrowserExtender,
browser_view()->AddChildView(status_area_);
status_area_->Init();
- // TODO(oshima): set the context menu controller to NonClientFrameView.
InitSystemMenu();
MainMenu::ScheduleCreation();
+
+ // The ContextMenuController has to be set to a NonClientView but
+ // not to a NonClientFrameView because a TabStrip is not a child of
+ // a NonClientFrameView even though visually a TabStrip is over a
+ // NonClientFrameView.
+ BrowserFrameGtk* gtk_frame =
+ static_cast<BrowserFrameGtk*>(browser_view()->frame());
+ gtk_frame->GetNonClientView()->SetContextMenuController(this);
}
virtual gfx::Rect Layout(const gfx::Rect& bounds) {
@@ -83,11 +91,11 @@ class NormalExtender : public BrowserExtender,
virtual bool NonClientHitTest(const gfx::Point& point) {
gfx::Point point_in_main_menu_coords(point);
- views::View::ConvertPointToView(browser_view()->GetParent(), main_menu_,
+ views::View::ConvertPointToView(browser_view(), main_menu_,
&point_in_main_menu_coords);
gfx::Point point_in_status_area_coords(point);
- views::View::ConvertPointToView(browser_view()->GetParent(), status_area_,
+ views::View::ConvertPointToView(browser_view(), status_area_,
&point_in_status_area_coords);
return main_menu_->HitTest(point_in_main_menu_coords) ||
diff --git a/chrome/browser/chromeos/browser_extender.h b/chrome/browser/chromeos/browser_extender.h
index d1ae11a..3cc3d5d 100644
--- a/chrome/browser/chromeos/browser_extender.h
+++ b/chrome/browser/chromeos/browser_extender.h
@@ -42,9 +42,9 @@ class BrowserExtender {
// bounds for tabstip to be layed out.
virtual gfx::Rect Layout(const gfx::Rect& bounds) { return bounds; }
- // Tests if the given |point|, which is given in window coordinates,
+ // Tests if the given |point|, which is given in BrowserView coordinates,
// hits any of controls.
- virtual bool NonClientHitTest(const gfx::Point& point) = 0;
+ virtual bool NonClientHitTest(const gfx::Point& browser_view_point) = 0;
// Updates the title bar (if any).
virtual void UpdateTitleBar() {}