Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/ui/panels/panel.h

Issue 8602007: Panels: Disable auto-resize if initial size is specified during creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use golden ratio Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.cc ('k') | chrome/browser/ui/panels/panel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void OnWindowSizeAvailable(); 197 void OnWindowSizeAvailable();
198 198
199 // Asynchronous completion of panel close request. 199 // Asynchronous completion of panel close request.
200 void OnNativePanelClosed(); 200 void OnNativePanelClosed();
201 201
202 NativePanel* native_panel() { return native_panel_; } 202 NativePanel* native_panel() { return native_panel_; }
203 Browser* browser() const; 203 Browser* browser() const;
204 ExpansionState expansion_state() const { return expansion_state_; } 204 ExpansionState expansion_state() const { return expansion_state_; }
205 const gfx::Size& min_size() const { return min_size_; } 205 const gfx::Size& min_size() const { return min_size_; }
206 const gfx::Size& max_size() const { return max_size_; } 206 const gfx::Size& max_size() const { return max_size_; }
207 bool auto_resizable() const { return auto_resizable_; }
207 208
208 protected: 209 protected:
209 virtual void DestroyBrowser() OVERRIDE; 210 virtual void DestroyBrowser() OVERRIDE;
210 211
211 private: 212 private:
212 friend class PanelManager; 213 friend class PanelManager;
213 friend class PanelBrowserTest; 214 friend class PanelBrowserTest;
214 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds); 215 FRIEND_TEST_ALL_PREFIXES(PanelBrowserTest, RestoredBounds);
215 216
216 // Panel can only be created using PanelManager::CreatePanel(). 217 // Panel can only be created using PanelManager::CreatePanel().
217 Panel(Browser* browser, const gfx::Rect& bounds); 218 Panel(Browser* browser,
219 const gfx::Rect& bounds,
220 const gfx::Size& min_size,
221 const gfx::Size& max_size,
222 bool auto_resizable);
218 223
219 // This is different from BrowserWindow::SetBounds(): 224 // This is different from BrowserWindow::SetBounds():
220 // * SetPanelBounds() is only called by PanelManager to manage its position. 225 // * SetPanelBounds() is only called by PanelManager to manage its position.
221 // * SetBounds() is called by the API to try to change the bounds, which is 226 // * SetBounds() is called by the API to try to change the bounds, which is
222 // not allowed for Panel. 227 // not allowed for Panel.
223 void SetPanelBounds(const gfx::Rect& bounds); 228 void SetPanelBounds(const gfx::Rect& bounds);
224 229
225 // Updates the maximum size. 230 // Sets whether the panel will auto resize according to its content.
226 void SetMaxSize(const gfx::Size& max_size); 231 void SetAutoResizable(bool resizable);
227 232
228 // NULL might be returned if the tab has not been added. 233 // NULL might be returned if the tab has not been added.
229 RenderViewHost* GetRenderViewHost() const; 234 RenderViewHost* GetRenderViewHost() const;
230 235
231 void EnableAutoResize(RenderViewHost* render_view_host); 236 // Configures the tab contents for auto resize, including configurations
237 // on the renderer and detecting renderer changes.
238 void EnableTabContentsAutoResize(TabContents* tab_contents);
239
240 // Configures the renderer for auto resize.
241 void EnableRendererAutoResize(RenderViewHost* render_view_host);
232 242
233 // Requests RenderViewHost not to show the scrollbars till |max_size_| since 243 // Requests RenderViewHost not to show the scrollbars till |max_size_| since
234 // the panel can grow to |max_size_|. 244 // the panel can grow to |max_size_|.
235 void RequestRenderViewHostToDisableScrollbars( 245 void RequestRenderViewHostToDisableScrollbars(
236 RenderViewHost* render_view_host); 246 RenderViewHost* render_view_host);
237 247
238 // This is the minimum size that the panel can shrink to. 248 // This is the minimum size that the panel can shrink to.
239 gfx::Size min_size_; 249 gfx::Size min_size_;
240 250
241 // This is the size beyond which the panel is not going to grow to accomodate 251 // This is the size beyond which the panel is not going to grow to accomodate
242 // the growing content and WebKit would add the scrollbars in such case. 252 // the growing content and WebKit would add the scrollbars in such case.
243 gfx::Size max_size_; 253 gfx::Size max_size_;
244 254
255 // True if this panel auto resizes based on content.
256 bool auto_resizable_;
257
245 // Platform specifc implementation for panels. It'd be one of 258 // Platform specifc implementation for panels. It'd be one of
246 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. 259 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa.
247 NativePanel* native_panel_; // Weak, owns us. 260 NativePanel* native_panel_; // Weak, owns us.
248 261
249 ExpansionState expansion_state_; 262 ExpansionState expansion_state_;
250 263
251 // Stores the full height of the panel so we can restore it after it's 264 // Stores the full height of the panel so we can restore it after it's
252 // been minimized. 265 // been minimized.
253 int restored_height_; 266 int restored_height_;
254 267
255 content::NotificationRegistrar registrar_; 268 content::NotificationRegistrar registrar_;
256 269
257 DISALLOW_COPY_AND_ASSIGN(Panel); 270 DISALLOW_COPY_AND_ASSIGN(Panel);
258 }; 271 };
259 272
260 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ 273 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.cc ('k') | chrome/browser/ui/panels/panel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698