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

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

Issue 7011015: Show "About panel" bubble on Windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 7 months 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
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
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/panels/panel_originator_delegate.h"
12 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
13 14
14 class PanelManager; 15 class PanelManager;
16 class PanelOriginatorDelegate;
15 17
16 // A platform independent implementation of BrowserWindow for Panels. This 18 // A platform independent implementation of BrowserWindow for Panels. This
17 // class would get the first crack at all the BrowserWindow calls for Panels and 19 // class would get the first crack at all the BrowserWindow calls for Panels and
18 // do one or more of the following: 20 // do one or more of the following:
19 // - Do nothing. The function is not relevant to Panels. 21 // - Do nothing. The function is not relevant to Panels.
20 // - Throw an exceptions. The function shouldn't be called for Panels. 22 // - Throw an exceptions. The function shouldn't be called for Panels.
21 // - Do Panel specific platform independent processing and then invoke the 23 // - Do Panel specific platform independent processing and then invoke the
22 // function on the platform specific BrowserWindow member. For example, 24 // function on the platform specific BrowserWindow member. For example,
23 // Panel size is restricted to certain limits. 25 // Panel size is restricted to certain limits.
24 // - Invoke an appropriate PanelManager function to do stuff that might affect 26 // - Invoke an appropriate PanelManager function to do stuff that might affect
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 #endif 123 #endif
122 virtual void PrepareForInstant() OVERRIDE; 124 virtual void PrepareForInstant() OVERRIDE;
123 virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE; 125 virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE;
124 virtual void HideInstant(bool instant_is_active) OVERRIDE; 126 virtual void HideInstant(bool instant_is_active) OVERRIDE;
125 virtual gfx::Rect GetInstantBounds() OVERRIDE; 127 virtual gfx::Rect GetInstantBounds() OVERRIDE;
126 virtual WindowOpenDisposition GetDispositionForPopupBounds( 128 virtual WindowOpenDisposition GetDispositionForPopupBounds(
127 const gfx::Rect& bounds) OVERRIDE; 129 const gfx::Rect& bounds) OVERRIDE;
128 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
129 virtual void ShowKeyboardOverlay(gfx::NativeWindow owning_window) OVERRIDE; 131 virtual void ShowKeyboardOverlay(gfx::NativeWindow owning_window) OVERRIDE;
130 #endif 132 #endif
133 virtual Panel* GetAsPanel() OVERRIDE;
131 134
132 // Construct a native panel BrowserWindow implementation for the specified 135 // Construct a native panel BrowserWindow implementation for the specified
133 // |browser|. 136 // |browser|.
134 static BrowserWindow* CreateNativePanel(Browser* browser, Panel* panel); 137 static BrowserWindow* CreateNativePanel(Browser* browser, Panel* panel);
135 138
139 PanelOriginatorDelegate* originator() const { return originator_.get(); }
140 void set_originator(PanelOriginatorDelegate* originator) {
141 originator_.reset(originator);
142 }
143
136 #ifdef UNIT_TEST 144 #ifdef UNIT_TEST
137 BrowserWindow* browser_window() { return browser_window_.get(); } 145 BrowserWindow* browser_window() { return browser_window_.get(); }
138 #endif 146 #endif
139 147
140 protected: 148 protected:
141 virtual void DestroyBrowser() OVERRIDE; 149 virtual void DestroyBrowser() OVERRIDE;
142 150
143 private: 151 private:
144 friend class PanelManager; 152 friend class PanelManager;
145 153
146 // Panel can only be created using PanelManager::CreatePanel(). 154 // Panel can only be created using PanelManager::CreatePanel().
147 Panel(Browser* browser, const gfx::Rect& bounds); 155 Panel(Browser* browser, const gfx::Rect& bounds);
148 156
149 // This is different from BrowserWindow::SetBounds(): 157 // This is different from BrowserWindow::SetBounds():
150 // * SetPanelBounds() is only called by PanelManager to manage its position. 158 // * SetPanelBounds() is only called by PanelManager to manage its position.
151 // * SetBounds() is called by the API to try to change the bounds, which is 159 // * SetBounds() is called by the API to try to change the bounds, which is
152 // not allowed for Panel. 160 // not allowed for Panel.
153 void SetPanelBounds(const gfx::Rect& bounds); 161 void SetPanelBounds(const gfx::Rect& bounds);
154 162
163 scoped_ptr<PanelOriginatorDelegate> originator_;
164
155 // Platform specifc BrowserWindow implementation for panels. It'd be one of 165 // Platform specifc BrowserWindow implementation for panels. It'd be one of
156 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. 166 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa.
157 scoped_ptr<BrowserWindow> browser_window_; 167 scoped_ptr<BrowserWindow> browser_window_;
158 168
159 // The normal bounds when the panel is not minimized. 169 // The normal bounds when the panel is not minimized.
160 gfx::Rect bounds_; 170 gfx::Rect bounds_;
161 171
162 // The bounds when the panel is minimized. 172 // The bounds when the panel is minimized.
163 gfx::Rect minimized_bounds_; 173 gfx::Rect minimized_bounds_;
164 174
165 // Is the panel minimized? 175 // Is the panel minimized?
166 bool minimized_; 176 bool minimized_;
167 177
168 DISALLOW_COPY_AND_ASSIGN(Panel); 178 DISALLOW_COPY_AND_ASSIGN(Panel);
169 }; 179 };
170 180
171 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ 181 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698