| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_H_ | |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_H_ | |
| 7 | |
| 8 #include "chrome/browser/ui/browser_window.h" | |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | |
| 10 | |
| 11 namespace extensions { | |
| 12 class Extension; | |
| 13 } | |
| 14 | |
| 15 class NativePanel; | |
| 16 class Panel; | |
| 17 | |
| 18 // A platform independent implementation of BrowserWindow for Panels. This | |
| 19 // class gets the first crack at all the BrowserWindow calls for Panels and | |
| 20 // do one or more of the following: | |
| 21 // - Do nothing. The function is not relevant to Panels. | |
| 22 // - Throw an exception. The function shouldn't be called for Panels. | |
| 23 // - Instruct Panel to do panel-specific platform independent processing | |
| 24 // and then invoke the function on the platform specific BrowserWindow member. | |
| 25 // - Invoke the function on the platform specific BrowserWindow member direclty. | |
| 26 class PanelBrowserWindow : public BrowserWindow, | |
| 27 public TabStripModelObserver { | |
| 28 public: | |
| 29 PanelBrowserWindow(Browser* browser, Panel* panel, NativePanel* native_panel); | |
| 30 virtual ~PanelBrowserWindow(); | |
| 31 | |
| 32 // BaseWindow overrides. | |
| 33 virtual bool IsActive() const OVERRIDE; | |
| 34 virtual bool IsMaximized() const OVERRIDE; | |
| 35 virtual bool IsMinimized() const OVERRIDE; | |
| 36 virtual bool IsFullscreen() const OVERRIDE; | |
| 37 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | |
| 38 virtual gfx::Rect GetBounds() const OVERRIDE; | |
| 39 virtual void Show() OVERRIDE; | |
| 40 virtual void ShowInactive() OVERRIDE; | |
| 41 virtual void Close() OVERRIDE; | |
| 42 virtual void Activate() OVERRIDE; | |
| 43 virtual void Deactivate() OVERRIDE; | |
| 44 virtual void Maximize() OVERRIDE; | |
| 45 virtual void Minimize() OVERRIDE; | |
| 46 virtual void Restore() OVERRIDE; | |
| 47 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | |
| 48 virtual void FlashFrame(bool flash) OVERRIDE; | |
| 49 virtual bool IsAlwaysOnTop() const OVERRIDE; | |
| 50 | |
| 51 // BrowserWindow overrides. | |
| 52 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | |
| 53 virtual BrowserWindowTesting* GetBrowserWindowTesting() OVERRIDE; | |
| 54 virtual StatusBubble* GetStatusBubble() OVERRIDE; | |
| 55 virtual void UpdateTitleBar() OVERRIDE; | |
| 56 virtual void BookmarkBarStateChanged( | |
| 57 BookmarkBar::AnimateChangeType change_type) OVERRIDE; | |
| 58 virtual void UpdateDevTools() OVERRIDE; | |
| 59 virtual void SetDevToolsDockSide(DevToolsDockSide side) OVERRIDE; | |
| 60 virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE; | |
| 61 virtual void SetStarredState(bool is_starred) OVERRIDE; | |
| 62 virtual void ZoomChangedForActiveTab(bool can_show_bubble) OVERRIDE; | |
| 63 virtual void EnterFullscreen( | |
| 64 const GURL& url, FullscreenExitBubbleType type) OVERRIDE; | |
| 65 virtual void ExitFullscreen() OVERRIDE; | |
| 66 #if defined(OS_WIN) | |
| 67 virtual void SetMetroSnapMode(bool enable) OVERRIDE; | |
| 68 virtual bool IsInMetroSnapMode() const OVERRIDE; | |
| 69 #endif | |
| 70 virtual void UpdateFullscreenExitBubbleContent( | |
| 71 const GURL& url, | |
| 72 FullscreenExitBubbleType bubble_type) OVERRIDE; | |
| 73 virtual bool IsFullscreenBubbleVisible() const OVERRIDE; | |
| 74 virtual LocationBar* GetLocationBar() const OVERRIDE; | |
| 75 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; | |
| 76 virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE; | |
| 77 virtual void UpdateToolbar(TabContents* contents, | |
| 78 bool should_restore_state) OVERRIDE; | |
| 79 virtual void FocusToolbar() OVERRIDE; | |
| 80 virtual void FocusAppMenu() OVERRIDE; | |
| 81 virtual void FocusBookmarksToolbar() OVERRIDE; | |
| 82 virtual void RotatePaneFocus(bool forwards) OVERRIDE; | |
| 83 virtual bool IsBookmarkBarVisible() const OVERRIDE; | |
| 84 virtual bool IsBookmarkBarAnimating() const OVERRIDE; | |
| 85 virtual bool IsTabStripEditable() const OVERRIDE; | |
| 86 virtual bool IsToolbarVisible() const OVERRIDE; | |
| 87 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; | |
| 88 virtual bool IsPanel() const OVERRIDE; | |
| 89 virtual void DisableInactiveFrame() OVERRIDE; | |
| 90 virtual void ConfirmAddSearchProvider(TemplateURL* template_url, | |
| 91 Profile* profile) OVERRIDE; | |
| 92 virtual void ToggleBookmarkBar() OVERRIDE; | |
| 93 virtual void ShowUpdateChromeDialog() OVERRIDE; | |
| 94 virtual void ShowTaskManager() OVERRIDE; | |
| 95 virtual void ShowBackgroundPages() OVERRIDE; | |
| 96 virtual void ShowBookmarkBubble( | |
| 97 const GURL& url, bool already_bookmarked) OVERRIDE; | |
| 98 virtual void ShowChromeToMobileBubble() OVERRIDE; | |
| 99 #if defined(ENABLE_ONE_CLICK_SIGNIN) | |
| 100 virtual void ShowOneClickSigninBubble( | |
| 101 const StartSyncCallback& start_sync_callback) OVERRIDE; | |
| 102 #endif | |
| 103 virtual bool IsDownloadShelfVisible() const OVERRIDE; | |
| 104 virtual DownloadShelf* GetDownloadShelf() OVERRIDE; | |
| 105 virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; | |
| 106 virtual void UserChangedTheme() OVERRIDE; | |
| 107 virtual int GetExtraRenderViewHeight() const OVERRIDE; | |
| 108 virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; | |
| 109 virtual void ShowPageInfo(content::WebContents* web_contents, | |
| 110 const GURL& url, | |
| 111 const content::SSLStatus& ssl, | |
| 112 bool show_history) OVERRIDE; | |
| 113 virtual void ShowWebsiteSettings(Profile* profile, | |
| 114 TabContents* tab_contents, | |
| 115 const GURL& url, | |
| 116 const content::SSLStatus& ssl, | |
| 117 bool show_history) OVERRIDE; | |
| 118 virtual void ShowAppMenu() OVERRIDE; | |
| 119 virtual bool PreHandleKeyboardEvent( | |
| 120 const content::NativeWebKeyboardEvent& event, | |
| 121 bool* is_keyboard_shortcut) OVERRIDE; | |
| 122 virtual void HandleKeyboardEvent( | |
| 123 const content::NativeWebKeyboardEvent& event) OVERRIDE; | |
| 124 virtual void ShowCreateChromeAppShortcutsDialog( | |
| 125 Profile* profile, const extensions::Extension* app) OVERRIDE; | |
| 126 virtual void Cut() OVERRIDE; | |
| 127 virtual void Copy() OVERRIDE; | |
| 128 virtual void Paste() OVERRIDE; | |
| 129 #if defined(OS_MACOSX) | |
| 130 virtual void OpenTabpose() OVERRIDE; | |
| 131 virtual void EnterPresentationMode( | |
| 132 const GURL& url, | |
| 133 FullscreenExitBubbleType bubble_type) OVERRIDE; | |
| 134 virtual void ExitPresentationMode() OVERRIDE; | |
| 135 virtual bool InPresentationMode() OVERRIDE; | |
| 136 #endif | |
| 137 virtual void ShowInstant(TabContents* preview) OVERRIDE; | |
| 138 virtual void HideInstant() OVERRIDE; | |
| 139 virtual gfx::Rect GetInstantBounds() OVERRIDE; | |
| 140 virtual bool IsInstantTabShowing() OVERRIDE; | |
| 141 virtual WindowOpenDisposition GetDispositionForPopupBounds( | |
| 142 const gfx::Rect& bounds) OVERRIDE; | |
| 143 virtual FindBar* CreateFindBar() OVERRIDE; | |
| 144 virtual void ResizeDueToAutoResize(content::WebContents* web_contents, | |
| 145 const gfx::Size& new_size) OVERRIDE; | |
| 146 virtual void ShowAvatarBubble(content::WebContents* web_contents, | |
| 147 const gfx::Rect& rect) OVERRIDE; | |
| 148 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; | |
| 149 | |
| 150 // TabStripModelObserver overrides. | |
| 151 virtual void TabInsertedAt(TabContents* contents, | |
| 152 int index, | |
| 153 bool foreground) OVERRIDE; | |
| 154 | |
| 155 protected: | |
| 156 virtual void DestroyBrowser() OVERRIDE; | |
| 157 | |
| 158 private: | |
| 159 friend class BasePanelBrowserTest; | |
| 160 friend class OldBasePanelBrowserTest; | |
| 161 friend class PanelBrowserWindowCocoaTest; | |
| 162 Panel* panel() const { return panel_; } // only for tests | |
| 163 | |
| 164 Browser* browser_; // Weak, owned by native panel. | |
| 165 | |
| 166 Panel* panel_; // Weak pointer. Owns us. | |
| 167 | |
| 168 // Platform specifc implementation for panels. It'd be one of | |
| 169 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. | |
| 170 NativePanel* native_panel_; // Weak, owns us (through ownership of Panel). | |
| 171 | |
| 172 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindow); | |
| 173 }; | |
| 174 | |
| 175 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_H_ | |
| OLD | NEW |