diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 21:29:50 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 21:29:50 +0000 |
commit | c280bfdd4f944ed9c33f4306efa6d388d82a804a (patch) | |
tree | b484c60677240261fbb04a554ac6efb49270e504 /chrome/browser/chromeos/main_menu.h | |
parent | 371d04994828cbb44f679f2191bbe515ded93809 (diff) | |
download | chromium_src-c280bfdd4f944ed9c33f4306efa6d388d82a804a.zip chromium_src-c280bfdd4f944ed9c33f4306efa6d388d82a804a.tar.gz chromium_src-c280bfdd4f944ed9c33f4306efa6d388d82a804a.tar.bz2 |
Move compact navigation bar('s entry view) to main menu.
* Chagned main menu to use TYPE_WINDOW instead of POPUP.
* Added hooks to close main menu when a user clicked non content area. (see MainMenuContainer::OnMousePressed and MainMenu::ActiveWindowChanged)
* removed entry view from CompactNavigationBar view. We probably should rename this class (later).
* Fixed a mouse coordinates issue in WidgetGtk: A location in the mouse event may not be in its gdk_window when it's originated from child gdk_window.
* UIStyle's enum has to start with 0 * removed DLOG thas I checked in by accident.
BUG=31766
TEST=manual: switch to compact navigation bar using ctrl-shift-c and confirm that no navigation entry in title bar.
main menu has the navigation entry instead.
Review URL: http://codereview.chromium.org/604015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/main_menu.h')
-rw-r--r-- | chrome/browser/chromeos/main_menu.h | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/chrome/browser/chromeos/main_menu.h b/chrome/browser/chromeos/main_menu.h index 359c120..5cc567b 100644 --- a/chrome/browser/chromeos/main_menu.h +++ b/chrome/browser/chromeos/main_menu.h @@ -7,14 +7,17 @@ #include <gtk/gtk.h> +#include "app/active_window_watcher_x.h" #include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/task.h" +#include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/common/renderer_preferences.h" +class AutocompleteEditViewGtk; class Browser; class RenderWidgetHostViewGtk; class SiteInstance; @@ -23,14 +26,22 @@ namespace gfx { class Size; } namespace views { +class NativeViewHost; +class View; class WidgetGtk; } namespace chromeos { -// MainMenu manages showing the main menu. The menu is currently an HTML page. -// When the user clicks a link on the page a new tab is added to the current -// browser and the menu is hidden. +class NavigationBar; + +// MainMenu manages showing the main menu and optionally the +// navigation bar in compact navigation bar mode. The menu is +// currently an HTML page. When the user clicks a link on the page a +// new tab is added to the current browser and the menu is hidden. +// When the user opens a new page from the navigation bar, it opens a +// new tab on left, on right or clobbers the current tab depending on +// the configuration. // // To show the menu invoke Show. // @@ -51,7 +62,9 @@ namespace chromeos { // the life of the browser. This is done to make sure we have the html page // loaded when the user clicks on it. class MainMenu : public RenderViewHostDelegate, - public RenderViewHostDelegate::View { + public RenderViewHostDelegate::View, + public AutocompleteEditController, + public ActiveWindowWatcherX::Observer { public: // Shows the menu. static void Show(Browser* browser); @@ -110,6 +123,7 @@ class MainMenu : public RenderViewHostDelegate, }; friend class TabContentsDelegateImpl; + friend class AppMenuContainer; MainMenu(); @@ -126,14 +140,6 @@ class MainMenu : public RenderViewHostDelegate, // hidden. void Cleanup(); - // Callback from button presses on the render widget host view. Clicks - // outside the widget resulting in closing the menu. - static gboolean CallButtonPressEvent(GtkWidget* widget, - GdkEventButton* event, - MainMenu* menu); - gboolean OnButtonPressEvent(GtkWidget* widget, - GdkEventButton* event); - // RenderViewHostDelegate overrides. virtual int GetBrowserWindowID() const { return -1; @@ -171,6 +177,23 @@ class MainMenu : public RenderViewHostDelegate, virtual void HandleMouseLeave() {} virtual void UpdatePreferredSize(const gfx::Size& pref_size) {} + // AutocompleteController implementation. + virtual void OnAutocompleteAccept(const GURL& url, + WindowOpenDisposition disposition, + PageTransition::Type transition, + const GURL& alternate_nav_url); + virtual void OnChanged(); + virtual void OnInputInProgress(bool in_progress); + virtual void OnKillFocus(); + virtual void OnSetFocus(); + virtual SkBitmap GetFavIcon() const; + virtual std::wstring GetTitle() const; + + // ActiveWindowWatcherX::Observer implementation. + virtual void ActiveWindowChanged(GdkWindow* active_window); + + void AddTabWithURL(const GURL& url, PageTransition::Type transition); + // The currently active browser. We use this to open urls. Browser* browser_; @@ -197,6 +220,15 @@ class MainMenu : public RenderViewHostDelegate, ScopedRunnableMethodFactory<MainMenu> method_factory_; + // Container of NavigationBar and Renderer. + views::View* menu_container_; + + // The navigation bar. Only shown in compact navigation bar mode. + NavigationBar* navigation_bar_; + + // The Renderer view. + views::NativeViewHost* menu_content_view_; + // True if the popup has ever been shown. bool has_shown_; |