OLD | NEW |
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_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_ |
6 #define CHROME_BROWSER_UI_BROWSER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "chrome/browser/ui/shell_dialogs.h" | 36 #include "chrome/browser/ui/shell_dialogs.h" |
37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
38 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 38 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
39 #include "chrome/common/content_settings_types.h" | 39 #include "chrome/common/content_settings_types.h" |
40 #include "chrome/common/extensions/extension_constants.h" | 40 #include "chrome/common/extensions/extension_constants.h" |
41 #include "content/browser/tab_contents/page_navigator.h" | 41 #include "content/browser/tab_contents/page_navigator.h" |
42 #include "content/browser/tab_contents/tab_contents_delegate.h" | 42 #include "content/browser/tab_contents/tab_contents_delegate.h" |
43 #include "content/common/notification_registrar.h" | 43 #include "content/common/notification_registrar.h" |
44 #include "content/common/page_transition_types.h" | 44 #include "content/common/page_transition_types.h" |
45 #include "content/common/page_zoom.h" | 45 #include "content/common/page_zoom.h" |
| 46 #include "ui/base/ui_base_types.h" |
46 #include "ui/gfx/rect.h" | 47 #include "ui/gfx/rect.h" |
47 | 48 |
48 class BrowserSyncedWindowDelegate; | 49 class BrowserSyncedWindowDelegate; |
49 class BrowserTabRestoreServiceDelegate; | 50 class BrowserTabRestoreServiceDelegate; |
50 class BrowserWindow; | 51 class BrowserWindow; |
51 class Extension; | 52 class Extension; |
52 class FindBarController; | 53 class FindBarController; |
53 class InstantController; | 54 class InstantController; |
54 class InstantUnloadHandler; | 55 class InstantUnloadHandler; |
55 class PrefService; | 56 class PrefService; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 FEATURE_TITLEBAR = 1, | 96 FEATURE_TITLEBAR = 1, |
96 FEATURE_TABSTRIP = 2, | 97 FEATURE_TABSTRIP = 2, |
97 FEATURE_TOOLBAR = 4, | 98 FEATURE_TOOLBAR = 4, |
98 FEATURE_LOCATIONBAR = 8, | 99 FEATURE_LOCATIONBAR = 8, |
99 FEATURE_BOOKMARKBAR = 16, | 100 FEATURE_BOOKMARKBAR = 16, |
100 FEATURE_INFOBAR = 32, | 101 FEATURE_INFOBAR = 32, |
101 FEATURE_SIDEBAR = 64, | 102 FEATURE_SIDEBAR = 64, |
102 FEATURE_DOWNLOADSHELF = 128 | 103 FEATURE_DOWNLOADSHELF = 128 |
103 }; | 104 }; |
104 | 105 |
105 // Maximized state on creation. | |
106 enum MaximizedState { | |
107 // The maximized state is set to the default, which varies depending upon | |
108 // what the user has done. | |
109 MAXIMIZED_STATE_DEFAULT, | |
110 | |
111 // Maximized state is explicitly maximized. | |
112 MAXIMIZED_STATE_MAXIMIZED, | |
113 | |
114 // Maximized state is explicitly not maximized (normal). | |
115 MAXIMIZED_STATE_UNMAXIMIZED | |
116 }; | |
117 | |
118 struct CreateParams { | 106 struct CreateParams { |
119 CreateParams(Type type, Profile* profile); | 107 CreateParams(Type type, Profile* profile); |
120 | 108 |
121 // The browser type. | 109 // The browser type. |
122 Type type; | 110 Type type; |
123 | 111 |
124 // The associated profile. | 112 // The associated profile. |
125 Profile* profile; | 113 Profile* profile; |
126 | 114 |
127 // The application name that is also the name of the window to the shell. | 115 // The application name that is also the name of the window to the shell. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 Profile* profile); | 152 Profile* profile); |
165 | 153 |
166 // Like Create, but creates a tabstrip-less and toolbar-less | 154 // Like Create, but creates a tabstrip-less and toolbar-less |
167 // DevTools "app" window. | 155 // DevTools "app" window. |
168 static Browser* CreateForDevTools(Profile* profile); | 156 static Browser* CreateForDevTools(Profile* profile); |
169 | 157 |
170 // Set overrides for the initial window bounds and maximized state. | 158 // Set overrides for the initial window bounds and maximized state. |
171 void set_override_bounds(const gfx::Rect& bounds) { | 159 void set_override_bounds(const gfx::Rect& bounds) { |
172 override_bounds_ = bounds; | 160 override_bounds_ = bounds; |
173 } | 161 } |
174 void set_maximized_state(MaximizedState state) { | 162 void set_show_state(ui::WindowShowState show_state) { |
175 maximized_state_ = state; | 163 show_state_ = show_state; |
176 } | 164 } |
177 // Return true if the initial window bounds have been overridden. | 165 // Return true if the initial window bounds have been overridden. |
178 bool bounds_overridden() const { | 166 bool bounds_overridden() const { |
179 return !override_bounds_.IsEmpty(); | 167 return !override_bounds_.IsEmpty(); |
180 } | 168 } |
181 | 169 |
182 // Creates the Browser Window. Prefer to use the static helpers above where | 170 // Creates the Browser Window. Prefer to use the static helpers above where |
183 // possible. This does not show the window. You need to call window()->Show() | 171 // possible. This does not show the window. You need to call window()->Show() |
184 // to show it. | 172 // to show it. |
185 void InitBrowserWindow(); | 173 void InitBrowserWindow(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // for the new profile as well; it is the static equivalent of the instance | 291 // for the new profile as well; it is the static equivalent of the instance |
304 // method Browser::NewWindow(), used for the creation of a Window from the | 292 // method Browser::NewWindow(), used for the creation of a Window from the |
305 // multi-profile dropdown menu. | 293 // multi-profile dropdown menu. |
306 static void NewWindowWithProfile(Profile* profile); | 294 static void NewWindowWithProfile(Profile* profile); |
307 | 295 |
308 // State Storage and Retrieval for UI /////////////////////////////////////// | 296 // State Storage and Retrieval for UI /////////////////////////////////////// |
309 | 297 |
310 // Save and restore the window position. | 298 // Save and restore the window position. |
311 std::string GetWindowPlacementKey() const; | 299 std::string GetWindowPlacementKey() const; |
312 bool ShouldSaveWindowPlacement() const; | 300 bool ShouldSaveWindowPlacement() const; |
313 void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized); | 301 void SaveWindowPlacement(const gfx::Rect& bounds, |
| 302 ui::WindowShowState show_state); |
314 gfx::Rect GetSavedWindowBounds() const; | 303 gfx::Rect GetSavedWindowBounds() const; |
315 bool GetSavedMaximizedState() const; | 304 ui::WindowShowState GetSavedWindowShowState() const; |
316 | 305 |
317 // Gets the Favicon of the page in the selected tab. | 306 // Gets the Favicon of the page in the selected tab. |
318 SkBitmap GetCurrentPageIcon() const; | 307 SkBitmap GetCurrentPageIcon() const; |
319 | 308 |
320 // Gets the title of the window based on the selected tab's title. | 309 // Gets the title of the window based on the selected tab's title. |
321 string16 GetWindowTitleForCurrentTab() const; | 310 string16 GetWindowTitleForCurrentTab() const; |
322 | 311 |
323 // Prepares a title string for display (removes embedded newlines, etc). | 312 // Prepares a title string for display (removes embedded newlines, etc). |
324 static void FormatTitleForDisplay(string16* title); | 313 static void FormatTitleForDisplay(string16* title); |
325 | 314 |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 // reponse yet. | 1206 // reponse yet. |
1218 RESPONSE_RECEIVED // The user was prompted and made a decision already. | 1207 RESPONSE_RECEIVED // The user was prompted and made a decision already. |
1219 }; | 1208 }; |
1220 | 1209 |
1221 // State used to figure-out whether we should prompt the user for confirmation | 1210 // State used to figure-out whether we should prompt the user for confirmation |
1222 // when the browser is closed with in-progress downloads. | 1211 // when the browser is closed with in-progress downloads. |
1223 CancelDownloadConfirmationState cancel_download_confirmation_state_; | 1212 CancelDownloadConfirmationState cancel_download_confirmation_state_; |
1224 | 1213 |
1225 ///////////////////////////////////////////////////////////////////////////// | 1214 ///////////////////////////////////////////////////////////////////////////// |
1226 | 1215 |
1227 // Override values for the bounds of the window and its maximized state. | 1216 // Override values for the bounds of the window and its maximized or minimized |
| 1217 // state. |
1228 // These are supplied by callers that don't want to use the default values. | 1218 // These are supplied by callers that don't want to use the default values. |
1229 // The default values are typically loaded from local state (last session), | 1219 // The default values are typically loaded from local state (last session), |
1230 // obtained from the last window of the same type, or obtained from the | 1220 // obtained from the last window of the same type, or obtained from the |
1231 // shell shortcut's startup info. | 1221 // shell shortcut's startup info. |
1232 gfx::Rect override_bounds_; | 1222 gfx::Rect override_bounds_; |
1233 MaximizedState maximized_state_; | 1223 ui::WindowShowState show_state_; |
1234 | 1224 |
1235 // The following factory is used to close the frame at a later time. | 1225 // The following factory is used to close the frame at a later time. |
1236 ScopedRunnableMethodFactory<Browser> method_factory_; | 1226 ScopedRunnableMethodFactory<Browser> method_factory_; |
1237 | 1227 |
1238 // The Find Bar. This may be NULL if there is no Find Bar, and if it is | 1228 // The Find Bar. This may be NULL if there is no Find Bar, and if it is |
1239 // non-NULL, it may or may not be visible. | 1229 // non-NULL, it may or may not be visible. |
1240 scoped_ptr<FindBarController> find_bar_controller_; | 1230 scoped_ptr<FindBarController> find_bar_controller_; |
1241 | 1231 |
1242 // Dialog box used for opening and saving files. | 1232 // Dialog box used for opening and saving files. |
1243 scoped_refptr<SelectFileDialog> select_file_dialog_; | 1233 scoped_refptr<SelectFileDialog> select_file_dialog_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 | 1274 |
1285 scoped_ptr<InstantController> instant_; | 1275 scoped_ptr<InstantController> instant_; |
1286 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1276 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
1287 | 1277 |
1288 BookmarkBar::State bookmark_bar_state_; | 1278 BookmarkBar::State bookmark_bar_state_; |
1289 | 1279 |
1290 DISALLOW_COPY_AND_ASSIGN(Browser); | 1280 DISALLOW_COPY_AND_ASSIGN(Browser); |
1291 }; | 1281 }; |
1292 | 1282 |
1293 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1283 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |