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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "chrome/common/content_settings_types.h" | 45 #include "chrome/common/content_settings_types.h" |
46 #include "chrome/common/extensions/extension_constants.h" | 46 #include "chrome/common/extensions/extension_constants.h" |
47 #include "content/public/browser/notification_registrar.h" | 47 #include "content/public/browser/notification_registrar.h" |
48 #include "content/public/browser/page_navigator.h" | 48 #include "content/public/browser/page_navigator.h" |
49 #include "content/public/browser/web_contents_delegate.h" | 49 #include "content/public/browser/web_contents_delegate.h" |
50 #include "content/public/common/page_transition_types.h" | 50 #include "content/public/common/page_transition_types.h" |
51 #include "content/public/common/page_zoom.h" | 51 #include "content/public/common/page_zoom.h" |
52 #include "ui/base/ui_base_types.h" | 52 #include "ui/base/ui_base_types.h" |
53 #include "ui/gfx/rect.h" | 53 #include "ui/gfx/rect.h" |
54 | 54 |
55 class BrowserContentSettingBubbleModelDelegate; | |
56 class BrowserSyncedWindowDelegate; | 55 class BrowserSyncedWindowDelegate; |
57 class BrowserToolbarModelDelegate; | |
58 class BrowserTabRestoreServiceDelegate; | 56 class BrowserTabRestoreServiceDelegate; |
59 class BrowserWindow; | 57 class BrowserWindow; |
60 class Extension; | 58 class Extension; |
61 class ExtensionWindowController; | 59 class ExtensionWindowController; |
62 class FindBarController; | 60 class FindBarController; |
63 class FullscreenController; | 61 class FullscreenController; |
64 class HtmlDialogUIDelegate; | 62 class HtmlDialogUIDelegate; |
65 class InstantController; | 63 class InstantController; |
66 class InstantUnloadHandler; | 64 class InstantUnloadHandler; |
67 class PrefService; | 65 class PrefService; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 Profile* profile() const { return profile_; } | 227 Profile* profile() const { return profile_; } |
230 gfx::Rect override_bounds() const { return override_bounds_; } | 228 gfx::Rect override_bounds() const { return override_bounds_; } |
231 | 229 |
232 // Returns the InstantController or NULL if there is no InstantController for | 230 // Returns the InstantController or NULL if there is no InstantController for |
233 // this Browser. | 231 // this Browser. |
234 InstantController* instant() const { return instant_.get(); } | 232 InstantController* instant() const { return instant_.get(); } |
235 | 233 |
236 // |window()| will return NULL if called before |CreateBrowserWindow()| | 234 // |window()| will return NULL if called before |CreateBrowserWindow()| |
237 // is done. | 235 // is done. |
238 BrowserWindow* window() const { return window_; } | 236 BrowserWindow* window() const { return window_; } |
239 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } | 237 ToolbarModel* toolbar_model() { return &toolbar_model_; } |
240 const SessionID& session_id() const { return session_id_; } | 238 const SessionID& session_id() const { return session_id_; } |
241 CommandUpdater* command_updater() { return &command_updater_; } | 239 CommandUpdater* command_updater() { return &command_updater_; } |
242 bool block_command_execution() const { return block_command_execution_; } | 240 bool block_command_execution() const { return block_command_execution_; } |
243 BrowserContentSettingBubbleModelDelegate* | |
244 content_setting_bubble_model_delegate() { | |
245 return content_setting_bubble_model_delegate_.get(); | |
246 } | |
247 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { | 241 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { |
248 return tab_restore_service_delegate_.get(); | 242 return tab_restore_service_delegate_.get(); |
249 } | 243 } |
250 BrowserSyncedWindowDelegate* synced_window_delegate() { | 244 BrowserSyncedWindowDelegate* synced_window_delegate() { |
251 return synced_window_delegate_.get(); | 245 return synced_window_delegate_.get(); |
252 } | 246 } |
253 | 247 |
254 // Get the FindBarController for this browser, creating it if it does not | 248 // Get the FindBarController for this browser, creating it if it does not |
255 // yet exist. | 249 // yet exist. |
256 FindBarController* GetFindBarController(); | 250 FindBarController* GetFindBarController(); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 bool final_update); | 742 bool final_update); |
749 | 743 |
750 // Helper function to handle crashed plugin notifications. | 744 // Helper function to handle crashed plugin notifications. |
751 static void CrashedPluginHelper(content::WebContents* tab, | 745 static void CrashedPluginHelper(content::WebContents* tab, |
752 const FilePath& plugin_path); | 746 const FilePath& plugin_path); |
753 | 747 |
754 // Helper function to handle url update notifications. | 748 // Helper function to handle url update notifications. |
755 static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, | 749 static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, |
756 const GURL& url); | 750 const GURL& url); |
757 | 751 |
758 // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition. | 752 // Calls ExecuteCommandWithDisposition with the given disposition. |
759 void ExecuteCommand(int id); | 753 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition); |
760 | 754 |
761 // Calls ExecuteCommandWithDisposition with the given event flags. | 755 // Calls ExecuteCommandWithDisposition with the given event flags. |
762 void ExecuteCommand(int id, int event_flags); | 756 void ExecuteCommand(int id, int event_flags); |
763 | 757 |
764 // Executes a command if it's enabled. | 758 // Executes a command if it's enabled. |
765 // Returns true if the command is executed. | 759 // Returns true if the command is executed. |
766 bool ExecuteCommandIfEnabled(int id); | 760 bool ExecuteCommandIfEnabled(int id); |
767 | 761 |
768 // Returns true if |command_id| is a reserved command whose keyboard shortcuts | 762 // Returns true if |command_id| is a reserved command whose keyboard shortcuts |
769 // should not be sent to the renderer or |event| was triggered by a key that | 763 // should not be sent to the renderer or |event| was triggered by a key that |
(...skipping 22 matching lines...) Expand all Loading... |
792 // Shows the cookies collected in the tab contents wrapper. | 786 // Shows the cookies collected in the tab contents wrapper. |
793 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); | 787 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); |
794 | 788 |
795 // Interface implementations //////////////////////////////////////////////// | 789 // Interface implementations //////////////////////////////////////////////// |
796 | 790 |
797 // Overridden from content::PageNavigator: | 791 // Overridden from content::PageNavigator: |
798 virtual content::WebContents* OpenURL( | 792 virtual content::WebContents* OpenURL( |
799 const content::OpenURLParams& params) OVERRIDE; | 793 const content::OpenURLParams& params) OVERRIDE; |
800 | 794 |
801 // Overridden from CommandUpdater::CommandUpdaterDelegate: | 795 // Overridden from CommandUpdater::CommandUpdaterDelegate: |
802 virtual void ExecuteCommandWithDisposition( | 796 virtual void ExecuteCommand(int id) OVERRIDE; |
803 int id, | |
804 WindowOpenDisposition disposition) OVERRIDE; | |
805 | 797 |
806 // Overridden from TabRestoreServiceObserver: | 798 // Overridden from TabRestoreServiceObserver: |
807 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; | 799 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; |
808 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; | 800 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; |
809 | 801 |
810 // Centralized method for creating a TabContents, configuring and installing | 802 // Centralized method for creating a TabContents, configuring and installing |
811 // all its supporting objects and observers. | 803 // all its supporting objects and observers. |
812 static TabContentsWrapper* TabContentsFactory( | 804 static TabContentsWrapper* TabContentsFactory( |
813 Profile* profile, | 805 Profile* profile, |
814 content::SiteInstance* site_instance, | 806 content::SiteInstance* site_instance, |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 // 1) we launch an application via an application shortcut or extension API. | 1355 // 1) we launch an application via an application shortcut or extension API. |
1364 // 2) we launch an undocked devtool window. | 1356 // 2) we launch an undocked devtool window. |
1365 std::string app_name_; | 1357 std::string app_name_; |
1366 | 1358 |
1367 // Unique identifier of this browser for session restore. This id is only | 1359 // Unique identifier of this browser for session restore. This id is only |
1368 // unique within the current session, and is not guaranteed to be unique | 1360 // unique within the current session, and is not guaranteed to be unique |
1369 // across sessions. | 1361 // across sessions. |
1370 const SessionID session_id_; | 1362 const SessionID session_id_; |
1371 | 1363 |
1372 // The model for the toolbar view. | 1364 // The model for the toolbar view. |
1373 scoped_ptr<ToolbarModel> toolbar_model_; | 1365 ToolbarModel toolbar_model_; |
1374 | 1366 |
1375 // UI update coalescing and handling //////////////////////////////////////// | 1367 // UI update coalescing and handling //////////////////////////////////////// |
1376 | 1368 |
1377 typedef std::map<const content::WebContents*, int> UpdateMap; | 1369 typedef std::map<const content::WebContents*, int> UpdateMap; |
1378 | 1370 |
1379 // Maps from TabContents to pending UI updates that need to be processed. | 1371 // Maps from TabContents to pending UI updates that need to be processed. |
1380 // We don't update things like the URL or tab title right away to avoid | 1372 // We don't update things like the URL or tab title right away to avoid |
1381 // flickering and extra painting. | 1373 // flickering and extra painting. |
1382 // See ScheduleUIUpdate and ProcessPendingUIUpdates. | 1374 // See ScheduleUIUpdate and ProcessPendingUIUpdates. |
1383 UpdateMap scheduled_updates_; | 1375 UpdateMap scheduled_updates_; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 }; | 1449 }; |
1458 | 1450 |
1459 // Which deferred action to perform when OnDidGetApplicationInfo is notified | 1451 // Which deferred action to perform when OnDidGetApplicationInfo is notified |
1460 // from a TabContents. Currently, only one pending action is allowed. | 1452 // from a TabContents. Currently, only one pending action is allowed. |
1461 WebAppAction pending_web_app_action_; | 1453 WebAppAction pending_web_app_action_; |
1462 | 1454 |
1463 // The profile's tab restore service. The service is owned by the profile, | 1455 // The profile's tab restore service. The service is owned by the profile, |
1464 // and we install ourselves as an observer. | 1456 // and we install ourselves as an observer. |
1465 TabRestoreService* tab_restore_service_; | 1457 TabRestoreService* tab_restore_service_; |
1466 | 1458 |
1467 // Helper which implements the ContentSettingBubbleModel interface. | |
1468 scoped_ptr<BrowserContentSettingBubbleModelDelegate> | |
1469 content_setting_bubble_model_delegate_; | |
1470 | |
1471 // Helper which implements the ToolbarModelDelegate interface. | |
1472 scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; | |
1473 | |
1474 // Helper which implements the TabRestoreServiceDelegate interface. | 1459 // Helper which implements the TabRestoreServiceDelegate interface. |
1475 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; | 1460 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; |
1476 | 1461 |
1477 // Helper which implements the SyncedWindowDelegate interface. | 1462 // Helper which implements the SyncedWindowDelegate interface. |
1478 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; | 1463 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; |
1479 | 1464 |
1480 scoped_ptr<InstantController> instant_; | 1465 scoped_ptr<InstantController> instant_; |
1481 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1466 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
1482 | 1467 |
1483 BookmarkBar::State bookmark_bar_state_; | 1468 BookmarkBar::State bookmark_bar_state_; |
1484 | 1469 |
1485 scoped_refptr<FullscreenController> fullscreen_controller_; | 1470 scoped_refptr<FullscreenController> fullscreen_controller_; |
1486 | 1471 |
1487 scoped_ptr<ExtensionWindowController> extension_window_controller_; | 1472 scoped_ptr<ExtensionWindowController> extension_window_controller_; |
1488 | 1473 |
1489 // True if the browser window has been shown at least once. | 1474 // True if the browser window has been shown at least once. |
1490 bool window_has_shown_; | 1475 bool window_has_shown_; |
1491 | 1476 |
1492 DISALLOW_COPY_AND_ASSIGN(Browser); | 1477 DISALLOW_COPY_AND_ASSIGN(Browser); |
1493 }; | 1478 }; |
1494 | 1479 |
1495 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1480 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |