Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 class InstantController; | 63 class InstantController; |
| 64 class InstantUnloadHandler; | 64 class InstantUnloadHandler; |
| 65 class PrefService; | 65 class PrefService; |
| 66 class Profile; | 66 class Profile; |
| 67 class SkBitmap; | 67 class SkBitmap; |
| 68 class StatusBubble; | 68 class StatusBubble; |
| 69 class TabNavigation; | 69 class TabNavigation; |
| 70 class TabStripModel; | 70 class TabStripModel; |
| 71 struct WebApplicationInfo; | 71 struct WebApplicationInfo; |
| 72 | 72 |
| 73 namespace chrome { | |
| 74 namespace search { | |
| 75 class SearchDelegate; | |
| 76 class SearchModel; | |
| 77 } | |
| 78 } | |
| 79 | |
| 73 namespace content { | 80 namespace content { |
| 74 class NavigationController; | 81 class NavigationController; |
| 75 class SessionStorageNamespace; | 82 class SessionStorageNamespace; |
| 76 } | 83 } |
| 77 | 84 |
| 78 namespace extensions { | 85 namespace extensions { |
| 79 class Extension; | 86 class Extension; |
| 80 } | 87 } |
| 81 | 88 |
| 82 namespace gfx { | 89 namespace gfx { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 gfx::Rect override_bounds() const { return override_bounds_; } | 276 gfx::Rect override_bounds() const { return override_bounds_; } |
| 270 | 277 |
| 271 // Returns the InstantController or NULL if there is no InstantController for | 278 // Returns the InstantController or NULL if there is no InstantController for |
| 272 // this Browser. | 279 // this Browser. |
| 273 InstantController* instant() const { return instant_.get(); } | 280 InstantController* instant() const { return instant_.get(); } |
| 274 | 281 |
| 275 // |window()| will return NULL if called before |CreateBrowserWindow()| | 282 // |window()| will return NULL if called before |CreateBrowserWindow()| |
| 276 // is done. | 283 // is done. |
| 277 BrowserWindow* window() const { return window_; } | 284 BrowserWindow* window() const { return window_; } |
| 278 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } | 285 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } |
| 286 chrome::search::SearchModel* search_model() { return search_model_.get(); } | |
| 279 const SessionID& session_id() const { return session_id_; } | 287 const SessionID& session_id() const { return session_id_; } |
| 280 CommandUpdater* command_updater() { return &command_updater_; } | 288 CommandUpdater* command_updater() { return &command_updater_; } |
| 281 bool block_command_execution() const { return block_command_execution_; } | 289 bool block_command_execution() const { return block_command_execution_; } |
| 282 BrowserContentSettingBubbleModelDelegate* | 290 BrowserContentSettingBubbleModelDelegate* |
| 283 content_setting_bubble_model_delegate() { | 291 content_setting_bubble_model_delegate() { |
| 284 return content_setting_bubble_model_delegate_.get(); | 292 return content_setting_bubble_model_delegate_.get(); |
| 285 } | 293 } |
| 286 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { | 294 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { |
| 287 return tab_restore_service_delegate_.get(); | 295 return tab_restore_service_delegate_.get(); |
| 288 } | 296 } |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1136 | 1144 |
| 1137 // UI update coalescing and handling //////////////////////////////////////// | 1145 // UI update coalescing and handling //////////////////////////////////////// |
| 1138 | 1146 |
| 1139 // Asks the toolbar (and as such the location bar) to update its state to | 1147 // Asks the toolbar (and as such the location bar) to update its state to |
| 1140 // reflect the current tab's current URL, security state, etc. | 1148 // reflect the current tab's current URL, security state, etc. |
| 1141 // If |should_restore_state| is true, we're switching (back?) to this tab and | 1149 // If |should_restore_state| is true, we're switching (back?) to this tab and |
| 1142 // should restore any previous location bar state (such as user editing) as | 1150 // should restore any previous location bar state (such as user editing) as |
| 1143 // well. | 1151 // well. |
| 1144 void UpdateToolbar(bool should_restore_state); | 1152 void UpdateToolbar(bool should_restore_state); |
| 1145 | 1153 |
| 1154 // Updates the browser's search model with the tab's search model. | |
| 1155 void UpdateSearchState(TabContents* contents); | |
| 1156 | |
| 1146 // Does one or both of the following for each bit in |changed_flags|: | 1157 // Does one or both of the following for each bit in |changed_flags|: |
| 1147 // . If the update should be processed immediately, it is. | 1158 // . If the update should be processed immediately, it is. |
| 1148 // . If the update should processed asynchronously (to avoid lots of ui | 1159 // . If the update should processed asynchronously (to avoid lots of ui |
| 1149 // updates), then scheduled_updates_ is updated for the |source| and update | 1160 // updates), then scheduled_updates_ is updated for the |source| and update |
| 1150 // pair and a task is scheduled (assuming it isn't running already) | 1161 // pair and a task is scheduled (assuming it isn't running already) |
| 1151 // that invokes ProcessPendingUIUpdates. | 1162 // that invokes ProcessPendingUIUpdates. |
| 1152 void ScheduleUIUpdate(const content::WebContents* source, | 1163 void ScheduleUIUpdate(const content::WebContents* source, |
| 1153 unsigned changed_flags); | 1164 unsigned changed_flags); |
| 1154 | 1165 |
| 1155 // Processes all pending updates to the UI that have been scheduled by | 1166 // Processes all pending updates to the UI that have been scheduled by |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1329 AppType app_type_; | 1340 AppType app_type_; |
| 1330 | 1341 |
| 1331 // Unique identifier of this browser for session restore. This id is only | 1342 // Unique identifier of this browser for session restore. This id is only |
| 1332 // unique within the current session, and is not guaranteed to be unique | 1343 // unique within the current session, and is not guaranteed to be unique |
| 1333 // across sessions. | 1344 // across sessions. |
| 1334 const SessionID session_id_; | 1345 const SessionID session_id_; |
| 1335 | 1346 |
| 1336 // The model for the toolbar view. | 1347 // The model for the toolbar view. |
| 1337 scoped_ptr<ToolbarModel> toolbar_model_; | 1348 scoped_ptr<ToolbarModel> toolbar_model_; |
| 1338 | 1349 |
| 1350 // The model for the "active" search state. | |
|
sky
2012/06/21 18:26:49
Wrap these to 80 chars please.
dhollowa
2012/06/21 22:16:43
Done.
| |
| 1351 // There are per-tab search models as well. When a tab is active | |
| 1352 // its model is kept in sync with this one. When a new tab is activated | |
| 1353 // its model state is propagated to this active model. This way, observers | |
| 1354 // only have to attach to this single model for updates, and don't have to | |
| 1355 // worry about active tab changes directly. | |
| 1356 scoped_ptr<chrome::search::SearchModel> search_model_; | |
| 1357 | |
| 1339 // UI update coalescing and handling //////////////////////////////////////// | 1358 // UI update coalescing and handling //////////////////////////////////////// |
| 1340 | 1359 |
| 1341 typedef std::map<const content::WebContents*, int> UpdateMap; | 1360 typedef std::map<const content::WebContents*, int> UpdateMap; |
| 1342 | 1361 |
| 1343 // Maps from WebContents to pending UI updates that need to be processed. | 1362 // Maps from WebContents to pending UI updates that need to be processed. |
| 1344 // We don't update things like the URL or tab title right away to avoid | 1363 // We don't update things like the URL or tab title right away to avoid |
| 1345 // flickering and extra painting. | 1364 // flickering and extra painting. |
| 1346 // See ScheduleUIUpdate and ProcessPendingUIUpdates. | 1365 // See ScheduleUIUpdate and ProcessPendingUIUpdates. |
| 1347 UpdateMap scheduled_updates_; | 1366 UpdateMap scheduled_updates_; |
| 1348 | 1367 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1420 // and we install ourselves as an observer. | 1439 // and we install ourselves as an observer. |
| 1421 TabRestoreService* tab_restore_service_; | 1440 TabRestoreService* tab_restore_service_; |
| 1422 | 1441 |
| 1423 // Helper which implements the ContentSettingBubbleModel interface. | 1442 // Helper which implements the ContentSettingBubbleModel interface. |
| 1424 scoped_ptr<BrowserContentSettingBubbleModelDelegate> | 1443 scoped_ptr<BrowserContentSettingBubbleModelDelegate> |
| 1425 content_setting_bubble_model_delegate_; | 1444 content_setting_bubble_model_delegate_; |
| 1426 | 1445 |
| 1427 // Helper which implements the ToolbarModelDelegate interface. | 1446 // Helper which implements the ToolbarModelDelegate interface. |
| 1428 scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; | 1447 scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; |
| 1429 | 1448 |
| 1449 // A delegate that handles the details of updating the "active" | |
| 1450 // |search_model_| state with the tab's state. | |
| 1451 scoped_ptr<chrome::search::SearchDelegate> search_delegate_; | |
| 1452 | |
| 1430 // Helper which implements the TabRestoreServiceDelegate interface. | 1453 // Helper which implements the TabRestoreServiceDelegate interface. |
| 1431 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; | 1454 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; |
| 1432 | 1455 |
| 1433 // Helper which implements the SyncedWindowDelegate interface. | 1456 // Helper which implements the SyncedWindowDelegate interface. |
| 1434 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; | 1457 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; |
| 1435 | 1458 |
| 1436 scoped_ptr<InstantController> instant_; | 1459 scoped_ptr<InstantController> instant_; |
| 1437 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1460 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
| 1438 | 1461 |
| 1439 BookmarkBar::State bookmark_bar_state_; | 1462 BookmarkBar::State bookmark_bar_state_; |
| 1440 | 1463 |
| 1441 scoped_refptr<FullscreenController> fullscreen_controller_; | 1464 scoped_refptr<FullscreenController> fullscreen_controller_; |
| 1442 | 1465 |
| 1443 scoped_ptr<ExtensionWindowController> extension_window_controller_; | 1466 scoped_ptr<ExtensionWindowController> extension_window_controller_; |
| 1444 | 1467 |
| 1445 // True if the browser window has been shown at least once. | 1468 // True if the browser window has been shown at least once. |
| 1446 bool window_has_shown_; | 1469 bool window_has_shown_; |
| 1447 | 1470 |
| 1448 // Currently open color chooser. Non-NULL after OpenColorChooser is called and | 1471 // Currently open color chooser. Non-NULL after OpenColorChooser is called and |
| 1449 // before DidEndColorChooser is called. | 1472 // before DidEndColorChooser is called. |
| 1450 scoped_ptr<content::ColorChooser> color_chooser_; | 1473 scoped_ptr<content::ColorChooser> color_chooser_; |
| 1451 | 1474 |
| 1452 DISALLOW_COPY_AND_ASSIGN(Browser); | 1475 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 1453 }; | 1476 }; |
| 1454 | 1477 |
| 1455 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1478 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
| OLD | NEW |