| Index: chrome/browser/views/app_launcher.h
|
| ===================================================================
|
| --- chrome/browser/views/app_launcher.h (revision 41617)
|
| +++ chrome/browser/views/app_launcher.h (working copy)
|
| @@ -2,22 +2,18 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_CHROMEOS_APP_LAUNCHER_H_
|
| -#define CHROME_BROWSER_CHROMEOS_APP_LAUNCHER_H_
|
| +#ifndef CHROME_BROWSER_VIEWS_APP_LAUNCHER_H_
|
| +#define CHROME_BROWSER_VIEWS_APP_LAUNCHER_H_
|
|
|
| -#include <gtk/gtk.h>
|
| -
|
| -#include "app/active_window_watcher_x.h"
|
| #include "base/scoped_ptr.h"
|
| -#include "base/task.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/browser/views/info_bubble.h"
|
| #include "chrome/common/renderer_preferences.h"
|
| #include "views/view.h"
|
|
|
| class Browser;
|
| -class RenderWidgetHostViewGtk;
|
| class SiteInstance;
|
|
|
| namespace gfx {
|
| @@ -29,9 +25,9 @@
|
| class WidgetGtk;
|
| }
|
|
|
| -namespace chromeos {
|
| -
|
| +class InfoBubbleContentsView;
|
| class NavigationBar;
|
| +class TabContentsDelegateImpl;
|
|
|
| // AppLauncher manages showing the application launcher and optionally the
|
| // navigation bar in compact navigation bar mode. The app launcher is
|
| @@ -55,95 +51,26 @@
|
| //
|
| // When a new url is opened, or the user clicks outsides the bounds of the
|
| // widget the app launcher is closed.
|
| -class AppLauncher : public RenderViewHostDelegate,
|
| - public RenderViewHostDelegate::View,
|
| - public ActiveWindowWatcherX::Observer,
|
| - public views::AcceleratorTarget {
|
| +class AppLauncher : public InfoBubbleDelegate,
|
| + public RenderViewHostDelegate,
|
| + public RenderViewHostDelegate::View {
|
| public:
|
| - AppLauncher();
|
| - ~AppLauncher();
|
| + // Shows an application launcher bubble pointing to the new tab button.
|
| + // The caller DOES NOT OWN the AppLauncher returned. It is deleted
|
| + // automatically when the AppLauncher is closed.
|
| + static AppLauncher* Show(Browser* browser);
|
|
|
| - // Shows the menu.
|
| - void Show(Browser* browser);
|
| + // Returns the browser this AppLauncher is associated with.
|
| + Browser* browser() const { return browser_; }
|
|
|
| - private:
|
| - // TabContentsDelegate and RenderViewHostDelegate::View have some methods
|
| - // in common (with differing signatures). The TabContentsDelegate methods are
|
| - // implemented by this class.
|
| - class TabContentsDelegateImpl : public TabContentsDelegate {
|
| - public:
|
| - explicit TabContentsDelegateImpl(AppLauncher* app_launcher);
|
| -
|
| - // TabContentsDelegate.
|
| - virtual void OpenURLFromTab(TabContents* source,
|
| - const GURL& url, const GURL& referrer,
|
| - WindowOpenDisposition disposition,
|
| - PageTransition::Type transition);
|
| - virtual void NavigationStateChanged(const TabContents* source,
|
| - unsigned changed_flags) {}
|
| - virtual void AddNewContents(TabContents* source,
|
| - TabContents* new_contents,
|
| - WindowOpenDisposition disposition,
|
| - const gfx::Rect& initial_pos,
|
| - bool user_gesture) {}
|
| - virtual void ActivateContents(TabContents* contents) {}
|
| - virtual void LoadingStateChanged(TabContents* source) {}
|
| - virtual void CloseContents(TabContents* source) {}
|
| - virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {}
|
| - virtual bool IsPopup(TabContents* source) { return false; }
|
| - virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {}
|
| - virtual void URLStarredChanged(TabContents* source, bool starred) {}
|
| - virtual void UpdateTargetURL(TabContents* source, const GURL& url) {}
|
| -
|
| - private:
|
| - AppLauncher* app_launcher_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(TabContentsDelegateImpl);
|
| - };
|
| -
|
| - class TopContainer : public views::View {
|
| - public:
|
| - explicit TopContainer(AppLauncher* app_launcher);
|
| - virtual ~TopContainer() {}
|
| -
|
| - // views::View overrides.
|
| - virtual void Layout();
|
| - virtual bool OnMousePressed(const views::MouseEvent& event);
|
| -
|
| - private:
|
| - AppLauncher* app_launcher_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(TopContainer);
|
| - };
|
| -
|
| - class BubbleContainer : public views::View {
|
| - public:
|
| - explicit BubbleContainer(AppLauncher* app_launcher);
|
| -
|
| - // views::View overrides.
|
| - virtual void Layout();
|
| -
|
| - private:
|
| - AppLauncher* app_launcher_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(BubbleContainer);
|
| - };
|
| -
|
| - friend class BubbleContainer;
|
| - friend class NavigationBar;
|
| - friend class TabContentsDelegateImpl;
|
| - friend class TopContainer;
|
| -
|
| // Hides the app launcher.
|
| void Hide();
|
|
|
| - // Cleans up state. This is invoked before showing and after a delay when
|
| - // hidden.
|
| - void Cleanup();
|
| + // InfoBubbleDelegate overrides.
|
| + virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
| + bool closed_by_escape);
|
| + virtual bool CloseOnEscape() { return true; }
|
|
|
| - // Updates the app launcher's state and layout with the |browser|.
|
| - void Update(Browser* browser);
|
| -
|
| // RenderViewHostDelegate overrides.
|
| virtual int GetBrowserWindowID() const {
|
| return -1;
|
| @@ -168,7 +95,9 @@
|
| const gfx::Rect& initial_pos) {}
|
| virtual void ShowContextMenu(const ContextMenuParams& params) {}
|
| virtual void StartDragging(const WebDropData& drop_data,
|
| - WebKit::WebDragOperationsMask allowed_ops);
|
| + WebKit::WebDragOperationsMask allowed_ops,
|
| + const SkBitmap& image,
|
| + const gfx::Point& image_offset);
|
| virtual void UpdateDragCursor(WebKit::WebDragOperation operation) {}
|
| virtual void GotFocus() {}
|
| virtual void TakeFocus(bool reverse) {}
|
| @@ -181,58 +110,44 @@
|
| virtual void HandleMouseLeave() {}
|
| virtual void UpdatePreferredSize(const gfx::Size& pref_size) {}
|
|
|
| - // ActiveWindowWatcherX::Observer implementation.
|
| - virtual void ActiveWindowChanged(GdkWindow* active_window);
|
| + private:
|
| + friend class DeleteTask<AppLauncher>;
|
| + friend class NavigationBar;
|
| + friend class InfoBubbleContentsView;
|
|
|
| - // views::AcceleratorTarget implementation:
|
| - virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
|
| + explicit AppLauncher(Browser* browser);
|
| + ~AppLauncher();
|
|
|
| void AddTabWithURL(const GURL& url, PageTransition::Type transition);
|
|
|
| // The currently active browser. We use this to open urls.
|
| Browser* browser_;
|
|
|
| - // The widget displaying the rwvh_.
|
| - views::WidgetGtk* popup_;
|
| + // The InfoBubble displaying the omnibox and app contents.
|
| + InfoBubble* info_bubble_;
|
|
|
| // SiteInstance for the RenderViewHosts we create.
|
| - SiteInstance* site_instance_;
|
| + scoped_refptr<SiteInstance> site_instance_;
|
|
|
| // RenderViewHost for the contents.
|
| RenderViewHost* contents_rvh_;
|
|
|
| // RenderWidgetHostView from the contents_rvh_.
|
| - RenderWidgetHostViewGtk* rwhv_;
|
| + RenderWidgetHostView* rwhv_;
|
|
|
| // Handles creating the child TabContents.
|
| RenderViewHostDelegateViewHelper helper_;
|
|
|
| // Delegate of the TabContents created by helper_.
|
| - TabContentsDelegateImpl tab_contents_delegate_;
|
| + scoped_ptr<TabContentsDelegateImpl> tab_contents_delegate_;
|
|
|
| // TabContents created when the user clicks a link.
|
| scoped_ptr<TabContents> pending_contents_;
|
|
|
| - ScopedRunnableMethodFactory<AppLauncher> method_factory_;
|
| + // The view with the navigation bar and render view, shown in the info-bubble.
|
| + InfoBubbleContentsView* info_bubble_content_;
|
|
|
| - // Container of the background, NavigationBar and Renderer.
|
| - views::View* top_container_;
|
| -
|
| - // Container of the NavigationBar and Renderer (shown in a bubble).
|
| - views::View* bubble_container_;
|
| -
|
| - // The navigation bar. Only shown in compact navigation bar mode.
|
| - NavigationBar* navigation_bar_;
|
| -
|
| - // The view containing the renderer view.
|
| - views::NativeViewHost* render_view_container_;
|
| -
|
| - // True if the popup has ever been shown.
|
| - bool has_shown_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(AppLauncher);
|
| };
|
|
|
| -} // namespace chromeos
|
| -
|
| -#endif // CHROME_BROWSER_CHROMEOS_APP_LAUNCHER_H_
|
| +#endif // CHROME_BROWSER_VIEWS_APP_LAUNCHER_H_
|
|
|